ARoad0.Gui1
Class StringTwoKeysMapPropertyEditor
java.lang.Object
ARoad0.Gui1.SimplePropertyEditor
ARoad0.Gui1.StringMapPropertyEditor
ARoad0.Gui1.StringTwoKeysMapPropertyEditor
- 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
- Direct Known Subclasses:
- AssociationMapPropertyEditor
public class StringTwoKeysMapPropertyEditor
- extends StringMapPropertyEditor
- implements CreationDialogListener
This class is responsible for creating, by the mean of panels, maps where the keys
have a constrained first part, and an user-defined subkey, and where
the values are constrained String arrays. This class may also replace StringMapPropertyEditor
to display a map (String, String[]) when there is no button, because the value panel
has here a greater width.
This class reads and updates a modifiable property map of a gBase JavaBean,
for which the type is a Map.
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.
The key 'choiceMethodForNew' of the property descriptor has to be used
to get the allowed values for the key starting,
then DialogBox.showBackedJLists() is called to get the user choices for the starting
and the subkey, and this method calls back handleCreationDialog().
Tests the key 'ForOneKeyAsName' in the property descriptor, and if true,
sets the key as a name.
A subkey has to be entered, when the key starting is ending with a point.
This class is quite similar to RightMapPropertyEditor, but with Strings values,
and a strong control on the key structure, without using a constrained set of
allowed keys.
See the Copyright.
Field Summary |
protected javax.swing.JList |
jList_
The JList for selectiong in addKeyElement() the first part
of a new key |
protected javax.swing.JTextField |
textField_
The text to get the subkey, or second part in a new key |
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 |
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent _evt)
Manages the events fired by the buttons 'New' and 'Delete' for the map keys,
and 'NewV', 'Select', 'Remove' and 'DeletV' for the map values. |
protected void |
addKeyElement()
Called by actionPerformed() when the user clicks on the button 'New' to
add a new key having the format 'keyStarting.subkey' in the map. |
void |
finalizeForProcess()
Finalizes the instance; the call is reserved to BeamerManager. |
void |
handleCreationDialog(boolean _data)
From a click on 'New', read the updated new map key which is set
through DialogBox.showBackedJComponents() from addKeyElement(). |
void |
setPanelDimension(boolean _keyButton,
boolean _valueButton)
Sets the two panels for the keys and the values lists. |
java.lang.String |
toString()
Gets the values of variables for the instance. |
static CommonPropertyEditor |
valueOf(BaseObject _source,
java.beans.PropertyDescriptor _propertyDescriptor)
Factory method to use when a StringTwoKeysMapPropertyEditor is delegating to us. |
Methods inherited from class ARoad0.Gui1.StringMapPropertyEditor |
addRestrictedValueElements, 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 |
jList_
protected javax.swing.JList jList_
- The JList for selectiong in addKeyElement() the first part
of a new key
textField_
protected javax.swing.JTextField textField_
- The text to get the subkey, or second part in a new key
StringTwoKeysMapPropertyEditor
StringTwoKeysMapPropertyEditor()
- Constructor FOR USE ONLY through the valueOf() method,
EMPTY_INSTANCE and the subclasses.
valueOf
public static CommonPropertyEditor valueOf(BaseObject _source,
java.beans.PropertyDescriptor _propertyDescriptor)
throws java.lang.NullPointerException,
ProcessError
- Factory method to use when a StringTwoKeysMapPropertyEditor 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.
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 StringTwoKeysMapPropertyEditor instance
- Throws:
java.lang.NullPointerException
- if _source or _displayName is null
ProcessError
- if BeanInfo and PropertyDecriptor calls fail
setPanelDimension
public void setPanelDimension(boolean _keyButton,
boolean _valueButton)
- Sets the two panels for the keys and the values lists.
Calls SimplePropertyEditor.setListPanelDimension() and getMaximumValuesListSize().
- Overrides:
setPanelDimension
in class StringMapPropertyEditor
- Parameters:
_keyButton
- true if there is a vertical panel for key buttons._valueButton
- true if there is a vertical panel for value buttons.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent _evt)
- Manages the events fired by the buttons 'New' and 'Delete' for the map keys,
and 'NewV', 'Select', 'Remove' and 'DeletV' for the map values.
Overrides the super method to handle 'New', 'DeleteV' and 'NewV',
and calls it for the buttons 'Delete', 'Select', 'Remove'.
Called by AssociationMapPropertyEditor.
- Specified by:
actionPerformed
in interface java.awt.event.ActionListener
- Overrides:
actionPerformed
in class StringMapPropertyEditor
- Parameters:
_evt
- is the event fired by a button
handleCreationDialog
public void handleCreationDialog(boolean _data)
- From a click on 'New', read the updated new map key which is set
through DialogBox.showBackedJComponents() from addKeyElement().
Calls 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 or empty
when the selected item in the list is not ending with a point,
if a list has not been selected, or if the new key is a current key.
Used by AssociationMapPropertyEditor.
- 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()
- Gets the values of variables for the instance.
- Overrides:
toString
in class StringMapPropertyEditor
- 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 StringMapPropertyEditor
addKeyElement
protected void addKeyElement()
- Called by actionPerformed() when the user clicks on the button 'New' to
add a new key having the format 'keyStarting.subkey' in the map.
The key beginning is constrained, and the subkey is a free text to enter.
Tests the value 'ForOneKeyAsName' in the property descriptor, and if true,
allows only the key end 'xxxx.name'.
To get the restricted keys or key startings, it calls getRestrictedValues(),
with a null argument if the source is not an ACSObject.
Call DialogBox.showBackedJLists() to get the user choices, and this method
calls back handleCreationDialog().
Overrides the super method. Used by the subclass AssociationMapPropertyEditor.
- Overrides:
addKeyElement
in class StringMapPropertyEditor