ARoad0.Gui1
Class RightMapPropertyEditor

java.lang.Object
  extended by ARoad0.Gui1.SimplePropertyEditor
      extended by ARoad0.Gui1.StringMapPropertyEditor
          extended by ARoad0.Gui1.BaseObjectMapPropertyEditor
              extended by ARoad0.Gui1.RightMapPropertyEditor
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 RightMapPropertyEditor
extends BaseObjectMapPropertyEditor
implements CreationDialogListener

This class is responsible for displaying, by the mean of panels, a modifiable property map of a gBase JavaBean, for which the type is a Map.

The map updating, if any, is never done through a write method or a 'choiceMethodForNew' in the property descriptor, but always through 'add/remove' methods defined in the property descriptor.

The keys updating may be forbidden or constrained, and if this updating is allowed, the deleting of a key is always through the call of the removing method with a null value for each key to delete. The values updating may be constrained by a specific method which declares the allowed values. The Value buttons are mandatory, at least for 'See'.

The keys are sometimes very structured strings for specialized rights. It completes CollectionPropertyEditor, which handles more complex types but handles maps only as collections of values, and StringMapPropertyEditor which is for unmodifiable all-String maps.

This class design is a merging of CollectionPropertyEditor, for the buttons handling, and StringMapPropertyEditor for the map handling. This class uses the property value 'restrictedKeyForSpecializedRight' at true to detect the need to update the specialized rights. It uses ACSFactoryUtilityImpl.getL_MapKeysStartsForSpecializedRights() to get the triplet of the allowed values for the key. Then it calls DialogBox.showBackedJLists() to get the user choices, and this method calls back handleCreationDialog().

This calss is called by Gui1.BeamerManager.addPropertyEditor(). It is specified by the BeanInfo classes for the property descriptors of StringMetaRightImpl.ACSRights, ACSImpl.SpecializedRightsSet and ConstraintsForRightValues. It is used by Gui1.BeamerManager.addPropertyEditor().

An instance is constructed through the factory method valueOf() which calls the super valueOf() method. It is possible to get a reusable empty instance. java.beans.PropertyEditorManager is not used. setValue(), setAsText() and getAsText() are not operational.


Field Summary
(package private)  javax.swing.JList[] l_jLists_
          The 3 JLists for selectiong in addKeyElement() the main components of a new key for a specialized right
(package private)  javax.swing.JTextField textField_
          The text to get the subkey in a new key for a specialized right
 
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
RightMapPropertyEditor()
          Constructor FOR USE ONLY through the valueOf() method, EMPTY_INSTANCE and the subclasses.
 
Method Summary
protected  void addKeyElement()
          Called by actionPerformed() when the user clicks on the button 'New' to add a new key in the right map.
 void changeDimensions()
          Updates the dimensions of the key and value panels.
 void finalizeForProcess()
          Finalizes the instance; the call is reserved to BeamerManager.
 java.awt.Component getCustomEditor()
          Returns a full custom Component that displays its property value, with the relevant buttons following the property descriptor.
 void handleCreationDialog(boolean _data)
          From a click on 'New', read the new key set through DialogBox.showBackedJComponents() called by addKeyElement().
 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 RightMapPropertyEditor is delegating to us.
 
Methods inherited from class ARoad0.Gui1.BaseObjectMapPropertyEditor
actionPerformed, handleSelectionDialog
 
Methods inherited from class ARoad0.Gui1.StringMapPropertyEditor
addRestrictedValueElements, addValueElements, getAsText, getMaximumValuesListSize, propertyChange, removeValueElements, setAsText, setKeysModel, setPanelDimension, 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, 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

l_jLists_

javax.swing.JList[] l_jLists_
The 3 JLists for selectiong in addKeyElement() the main components of a new key for a specialized right


textField_

javax.swing.JTextField textField_
The text to get the subkey in a new key for a specialized right

Constructor Detail

RightMapPropertyEditor

RightMapPropertyEditor()
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 RightMapPropertyEditor 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 StringRight arrays as values. Called by BeamerManager.addPropertyEditor(). Overrides the super method and calls it.

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

getCustomEditor

public java.awt.Component getCustomEditor()
Returns a full custom Component that displays its property value, with the relevant buttons following the property descriptor. Called by BeamerManager.addPropertyEditor(). Calls changeDimensions().

Specified by:
getCustomEditor in interface CommonPropertyEditor
Specified by:
getCustomEditor in interface java.beans.PropertyEditor
Overrides:
getCustomEditor in class StringMapPropertyEditor
Returns:
a JPanel which contains one panel for the keys and their buttons, and one panel for the values and their buttons.
See Also:
PropertyEditor.getCustomEditor()

changeDimensions

public void changeDimensions()
Updates the dimensions of the key and value panels. Called by StringMapPropertyEditor.propertyChange() and overrides the same method in this superclass. The Value buttons are mandatory.

Overrides:
changeDimensions in class StringMapPropertyEditor

handleCreationDialog

public void handleCreationDialog(boolean _data)
From a click on 'New', read the new key set through DialogBox.showBackedJComponents() called by addKeyElement(). Call the 'add' method with the new key and an empty right array. No operation if the text at the end of the key is null, empty or too large, if a list has not been selected, or if the text is already a key.

Specified by:
handleCreationDialog in interface CreationDialogListener
Parameters:
_data - true if the user clicks on OK, and false if the user clicks on Cancel

toString

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

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

finalizeForProcess

public void finalizeForProcess()
Finalizes the instance; the call is reserved to BeamerManager.

Specified by:
finalizeForProcess in interface CommonPropertyEditor
Overrides:
finalizeForProcess in class BaseObjectMapPropertyEditor

addKeyElement

protected void addKeyElement()
Called by actionPerformed() when the user clicks on the button 'New' to add a new key in the right map. This is only for specialized rights. This method uses the property value 'restrictedKeyForSpecializedRight' at true to detect the need to update the specialized rights. It uses ACSFactoryUtilityImpl.getL_MapKeysStartsForSpecializedRights() to get the triplet of the allowed values for the map key, then it calls DialogBox.showBackedJLists() to get the user choices, and this method calls back handleCreationDialog(). Overrides the super method.

Overrides:
addKeyElement in class StringMapPropertyEditor