ARoad0.Gui1
Class AssociationMapPropertyEditor

java.lang.Object
  extended by ARoad0.Gui1.SimplePropertyEditor
      extended by ARoad0.Gui1.StringMapPropertyEditor
          extended by ARoad0.Gui1.StringTwoKeysMapPropertyEditor
              extended by ARoad0.Gui1.AssociationMapPropertyEditor
All Implemented Interfaces:
CommonPropertyEditor, CreationDialogListener, NewBaseObjectListener, SelectionDialogListener, MVC_Controller, MVC_View, java.awt.event.ActionListener, java.beans.PropertyChangeListener, java.beans.PropertyEditor, java.util.EventListener, javax.swing.event.ListSelectionListener

public class AssociationMapPropertyEditor
extends StringTwoKeysMapPropertyEditor

This class is responsible for creating, by the mean of panels, associations to do as calls to constructors and methods in gBase, with all the required arguments.

It is used by ACSFactoryImpl to define the list of associations to perform when a new object is created in an ACS, and to define a list of creations when a child ACS is opening, to update its ACSObject roots in its parent ACS.

This class reads and updates a modifiable property map of a gBase JavaBean, for which the type is a Map, and where the map values are the associations.

The map keys have the format 'keyStarting.subkey' as criteria for defining the new objects which comply to the required associations by the acs designer.

This class works with gBase.AssociateUtilityImpl strongly for the values updating. The map updating is never done through a write method or a 'choiceMethodForNew' in the property descriptor, but through 'add/remove' methods defined in the property descriptor. See the Copyright.


Field Summary
protected  java.lang.String limitedValuesMethodKey_
          The key to use as argument in the call of the limited values method.
 
Fields inherited from class ARoad0.Gui1.StringTwoKeysMapPropertyEditor
jList_, textField_
 
Fields inherited from class ARoad0.Gui1.StringMapPropertyEditor
addMethod_, boundComponentTwo_, keyScrollPane_, keysModel_, keysUpdateInMap_, limitedValuesMethod_, maxKeySize_, maxValueSize_, propertyTypeInGroup_, removeMethod_, selectedTypeInGroup_, valueScrollPane_, valuesModel_
 
Fields inherited from class ARoad0.Gui1.SimplePropertyEditor
boundComponent_, displayName_, EMPTY_INSTANCE, EMPTY_OBJECT, INITIAL_CAPACITY, isRestrictedArgument_, listeners_, propertyDescriptor_, propertyType_, readMethod_, source_, sourceBeanInfo_, writeMethod_
 
Fields inherited from interface ARoad0.Gui1.CommonPropertyEditor
BOOLEAN_FIELD_DIMENSION, BOOLEAN_NAME_DIMENSION, BUTTON_DIMENSION, BUTTON_DIMENSION_2, BUTTON_DIMENSION_3, COLOMN_DIMENSION, COMBOBOX_FIELD_DIMENSION, EMPTY_FIELD_DIMENSION, HEIGHT_DIMENSION, INT_EMPTY_FIELD_DIMENSION, INT_FIELD_DIMENSION, LIST_HEIGHT_DIMENSION, LIST_WIDTH_DIMENSION, MAP_NAME_WIDTH_DIMENSION, NAME_DIMENSION, NAME_MAP_DIMENSION, NAME_WIDTH_DIMENSION, NAME_WIDTH_DIMENSION_2, NO_BUTTON_FIELD_DIMENSION, NO_BUTTON_WIDTH_DIMENSION, ONE_BUTTON_FIELD_DIMENSION, THREE_BUTTONS_FIELD_DIMENSION, TWO_BUTTONS_FIELD_DIMENSION
 
Constructor Summary
AssociationMapPropertyEditor()
          Constructor FOR USE ONLY through the valueOf() method, EMPTY_INSTANCE and the subclasses.
 
Method Summary
protected  void addRestrictedValueElements(java.lang.String _key)
          Called by actionPerformed() when the user clicks on the button 'NewV' to add new values in the map.
 java.lang.String toString()
          Get the values of variables for the instance.
static CommonPropertyEditor valueOf(BaseObject _source, java.beans.PropertyDescriptor _propertyDescriptor)
          Factory method to use when a AssociationMapPropertyEditor is delegating to us.
 
Methods inherited from class ARoad0.Gui1.StringTwoKeysMapPropertyEditor
actionPerformed, addKeyElement, finalizeForProcess, handleCreationDialog, setPanelDimension
 
Methods inherited from class ARoad0.Gui1.StringMapPropertyEditor
addValueElements, changeDimensions, getAsText, getCustomEditor, getMaximumValuesListSize, propertyChange, removeValueElements, setAsText, setKeysModel, setValue, setValuesModel, valueChanged, viewElement
 
Methods inherited from class ARoad0.Gui1.SimplePropertyEditor
addPropertyChangeListener, getButtonsDisplaying, getDisplayName, getJavaInitializationString, getKnownValuesForNewElement, getNameFromDetailledName, getPreferedSizeForEditing, getPropertyDescriptor, getPropertyType, getRestrictedValues, getSource, getTags, getValue, getWriteMethod, handleNewBaseObject, handleSelectionDialog, isPaintable, paintValue, removePropertyChangeListener, setListPanelDimension, setVerticalButtonsInEditor, supportsCustomEditor, viewOneElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

limitedValuesMethodKey_

protected java.lang.String limitedValuesMethodKey_
The key to use as argument in the call of the limited values method. On the contrary of the super class, the argument is not the currently selected key in the map. The argument is static, and the limited values method returns only the first value of the values array. The set of the first values is smaller when this class is the property editor of a child ACS. To detect this case, the BeanInfo must have a 'ForChildACS' property which initializes this property. In other cases, this property should remains null.

Constructor Detail

AssociationMapPropertyEditor

AssociationMapPropertyEditor()
Constructor FOR USE ONLY through the valueOf() method, EMPTY_INSTANCE and the subclasses.

Method Detail

valueOf

public static CommonPropertyEditor valueOf(BaseObject _source,
                                           java.beans.PropertyDescriptor _propertyDescriptor)
                                    throws java.lang.NullPointerException,
                                           ProcessError
Factory method to use when a AssociationMapPropertyEditor is delegating to us. It constructs the read method for the property, from the BeanInfo information. The property must be a map of Strings as keys, and String arrays as values. Overrides the super method and calls it. Called by BeamerManager.addPropertyEditor().

Parameters:
_source - owning the property.
_propertyDescriptor - is the descriptor of the property
Returns:
a AssociationMapPropertyEditor instance
Throws:
java.lang.NullPointerException - if _source or _displayName is null
ProcessError - if BeanInfo and PropertyDecriptor calls fail

toString

public java.lang.String toString()
Get the values of variables for the instance.

Overrides:
toString in class StringTwoKeysMapPropertyEditor
Returns:
source, propertyName and listeners (if they have toString() methods).

addRestrictedValueElements

protected void addRestrictedValueElements(java.lang.String _key)
Called by actionPerformed() when the user clicks on the button 'NewV' to add new values in the map. The allowed String map values depends lightly on the map key. The values define one or several actions to do if the key matches. The possible formats for the first value of the action N, are get from the method limitedValuesMethod_ among this set:

- .XXX which specifies the class name XXX in gBase, without the Impl String,

of an associate object to build up or to finalize when the master is build up

or finalized

- ..YYY which specifies the method YYY to call on the master,

- ..YYY which specifies the method YYY to call on the master ACS,

- ..C.ZZZ which specifies the method ZZZ

to call on the associate previously created by the action number C.

- ..XXX++ZZZ which specifies the method ZZZ

to call on the object having the name XXX, where the parameters must be the master or an associate to set the reverse operation when it is finalized.

After each first value, there is the optional list of the constraints on the arguments of the constructor (case 1) or the method (cases 2 to 5), and there is one constraint specification per argument. Each argument constraint specification must belong to a set of 10 allowed formats, presented herein without the number 'N.' at the start, for the action N:

- 'PropertyName'.: null value for the argument having the name 'PropertyName'

- 'PropertyName'.: the master is the argument

- 'PropertyName'.: boolean true if the master is creating, false if it is finalizing

- 'PropertyName'..C: the associate or argument number C object

- 'PropertyName'..XXX: the argument is XXX as String or ImmutableName if it is the property type, or any BaseObject get from its name

- 'PropertyName'..XXX++YYY: the master value

for the same property in its BeanInfo (the read method has to not return an array), with some optional pre and post String values if the property type is String

- 'PropertyName'..XXX++YYY:

the last component in the master name, with some optional

pre and post Name values as Strings

- 'PropertyName'..+YYY

the context in the master name, with a post Name value as String

- 'PropertyName'..+YYY: the master ACS name,

with a post Name value as String

- 'PropertyName'..XXX++YYY:

the last component in the child ACS name, with some optional pre and post Name values as Strings.

If the last value is the gBase message 'Error: lack of arguments', allow the adding of value(s). If it starts with 'Error to delete', request to the user a removing of the current values. Detect the cases when a first-format value has to be added, and when there is a lack of arguments to add. Calls StringMapPropertyEditor.addValueElements(). Overrides the StringMapPropertyEditor method.

Overrides:
addRestrictedValueElements in class StringMapPropertyEditor
Parameters:
_key - current selected key
See Also:
AssociateUtilityImpl.addAssociatesAfterCreation(ARoad0.gBaseInterface.ACSObject)