ARoad0.Gui1
Class SimplePropertyEditor

java.lang.Object
  extended by ARoad0.Gui1.SimplePropertyEditor
All Implemented Interfaces:
CommonPropertyEditor, NewBaseObjectListener, SelectionDialogListener, MVC_Controller, MVC_View, java.awt.event.ActionListener, java.beans.PropertyChangeListener, java.beans.PropertyEditor, java.util.EventListener
Direct Known Subclasses:
CollectionPropertyEditor, StringMapPropertyEditor

public class SimplePropertyEditor
extends java.lang.Object
implements MVC_Controller, MVC_View, CommonPropertyEditor, java.awt.event.ActionListener, java.beans.PropertyChangeListener, SelectionDialogListener, NewBaseObjectListener

This class is responsible for displaying and editing the more simple properties in the gBase classes, by the mean of panels. The getCustomEditor() method is used then. This class is selected by the numerous XXXBeanInfo classes in gBase, in their property descriptors. It is used by Gui1.BeamerManager.addPropertyEditor().

The possible property types are boolean, int, String, ARoad0.gBase.ImmutableName and any ARoad0.gBase.BaseObject. Object is not an allowed type. This class is a PropertyEditor that gets, updates and listens the property in the relevant gBase instance. It has several subclasses. It is also a custom editor that provides getCustomEditor(), and specifies the prefered size of the panel to be displayed.

This instance listens actions from the JComponent property when the user enters data, and from gBase objects when the program updates the property. When the user updates make changes in the data base, this instance updates the base, then these changes are fired to this instance to update the JComponent in the GUI. So, the GUI always DISPLAYS THE RIGHT DATA which is in the base. After an user update, the sequence of calls is: - actionPerformed() from the JComponent, - setAsText() or setValue(), which updates the data base object, - propertyChange() from the object, with firing to the JComponent and before, unregisters this PropertyEditor as a JComponent listener, to avoid a loop. The updating handles all the exceptions in the same way. A message is displayed to the user from the exception, and the editor data is reset through the call to the current value. So, the called gBase class for the updating method may choose how the exception impacts the current value. Caution: the property sourceBeanInfo_ is initialized only when the property values are constrained.

As a PropertyEditor, it must be able to register PropertyChangeListeners but this is not a feature to use so far. Use only registration on gBase BoundBeans, that handle PropertyChangeListeners. In the same way, do not use the ActionEvents handling - add/removeActionListener() - in the JComponent property.

An instance is constructed through the factory method 'valueOf()'. This static constructor has to be called by all the subclasses, which have to be build up by an overriding version of this method. It is possible to get a reusable empty instance. java.beans.PropertyEditorManager is not used. When a String is entered in a JTextField, its length is limited to 200, to prevent any unauthorized input. A space is always added to the end of the string. For a boolean property, the editor may be a combobox with a specified text, or a checkbox to select to select yes/no simply. The right editor is get from the property descriptor in the BeanInfo class.

Since:
0.5.1

Field Summary
protected  javax.swing.JComponent boundComponent_
          The component that displays a bound property in the beamer.
protected  java.lang.String displayName_
          It is not the display name of the property, given by the property descriptor.
static SimplePropertyEditor EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected static java.lang.Object EMPTY_OBJECT
          An empty object for initialization
protected static int INITIAL_CAPACITY
           
protected  boolean isRestrictedArgument_
          Is true if it is a constrained property that is not in the constructor.
protected  java.util.Vector listeners_
          The listeners for property updates
protected  java.beans.PropertyDescriptor propertyDescriptor_
          The property descriptor
protected  java.lang.Class propertyType_
          The type of the property.
protected  java.lang.reflect.Method readMethod_
          The read method if it exists, for the property
protected  BaseObject source_
          The instance owning the property
protected  BeanInfoPattern sourceBeanInfo_
          The BeanInfo instance associated to the source_.
protected  java.lang.reflect.Method writeMethod_
          The write method if it exists, for the property
 
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
SimplePropertyEditor()
          Constructor FOR USE ONLY through the valueOf() method, EMPTY_INSTANCE and the subclasses.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent _evt)
          Manages the events fired by the components in the JPanel displayed in the beamer, returned by getCustomEditor().
 void addPropertyChangeListener(java.beans.PropertyChangeListener _listener)
          Register a listener for the PropertyChange event - NO USE SO FAR.
 void finalizeForProcess()
          Finalizes the instance.
private  void firePropertyChange()
          Reports that we have been modified to any interested listeners - NOT USED SO FAR.
 java.lang.String getAsText()
          Gets the property value as a string suitable for presentation to a human to edit.
private  javax.swing.JPanel getBooleanEditor()
          Gets the boolean editor with the property name.
protected  boolean[] getButtonsDisplaying()
          Gets the status of buttons: to display or not in the property editor, through a reading of the property descriptor.
 java.awt.Component getCustomEditor()
          Returns a full custom Component that edits its property value, with the relevant buttons following the property descriptor.
 java.lang.String getDisplayName()
          Gets the value of the display property name (not the true name, given by the property descriptor).
private  javax.swing.JPanel getGeneralEditor(java.lang.String _displayName, java.lang.String _text, boolean _withWriteMethod, boolean _isBound, boolean _isBaseObject)
          Gets the editor with the property name when the property type is not boolean: int, String, ImmutableName or BaseObject.
 java.lang.String getJavaInitializationString()
          This method is intended for use when generating Java code to set the value of the property.
protected  java.lang.Object[] getKnownValuesForNewElement()
          Some constructor/add/copy arguments may be set as mandatory by the BeanInfo, and this method returns an array of these known values, at the right position for the arguments array to use.
protected  ImmutableName getNameFromDetailledName(java.lang.String _detailledName)
          Uses the property source_ to get the name of an ACSObject from its detailled name.
 java.awt.Dimension getPreferedSizeForEditing()
          Get the prefered size for the rectangle into which the value is displayed, in the component returned by getCustomEditor().
 java.beans.PropertyDescriptor getPropertyDescriptor()
          Gets the descriptor of the property.
 java.lang.Class getPropertyType()
          Gets the value of the property type, that is the Class of the returned object in getValue(): boolean (not Boolean here), String, ImmutableName,.
protected  java.lang.String[] getRestrictedValues(ACS _acs)
          Gets the restricted String values for the argument or the key.
 BaseObject getSource()
          Gets the value of the property source.
 java.lang.String[] getTags()
          When the value is a boolean, the tags are empty to indicate that a checkbox is required, excepted if a couple of tags is set in the property descriptor with the key 'tags', to indicate that a combobox with the tags is required.
 java.lang.Object getValue()
          Gets the value of the property, from the gBase instance, through the property descriptor in the relevant BeanInfo class.
 java.lang.reflect.Method getWriteMethod()
          Gets the method on the source for updates.
 void handleNewBaseObject(BaseObject _obj)
          NO USE SO FAR.
 void handleSelectionDialog(java.util.Map _validatedObjectsSetMap)
          Called by DialogBox.showExplorerSelectionDialogt() for actionPerformed(), when the property is a BaseObject which has been selected in the explorer.
 boolean isPaintable()
          Determines whether the class will honor the paintValue method.
 void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box)
          Paint a representation of the value into a given area of screen real estate.
 void propertyChange(java.beans.PropertyChangeEvent _evt)
          Manages the events fired by the base object source_ displayed in the beamer, if it is a bound property and when the property value changes.
 void removePropertyChangeListener(java.beans.PropertyChangeListener _listener)
          Remove a listener for the PropertyChange event - NO USE SO FAR.
private  void resetUpdate(java.lang.String _text)
          Resets the update when the user enter is not correct, and display an error message.
 void setAsText(java.lang.String _text)
          Sets the property value by parsing a given String.
protected  void setListPanelDimension(int _listSize, javax.swing.JScrollPane _component, boolean _largeWidth, boolean _buttonPanel, boolean _namePanel)
          Called by RightMapPropertyEditor, CollectionPropertyEditor, StringMapPropertyEditor, AssociationMapPropertyEditor, to set the dimension of the list.
 void setValue(java.lang.Object _value)
          Sets a new value.
protected  javax.swing.JPanel setVerticalButtonsInEditor(boolean[] _l_buttons, boolean _forMapKey, boolean _forMapValue)
          Creates a vertical panel with the relevant buttons.
 boolean supportsCustomEditor()
          Determines whether the propertyEditor can provide a custom editor.
 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 CommonPropertyEditor is delegating to us.
protected  void viewOneElement(java.lang.Object _toView)
          Called when the user clicks on the button 'See'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
See Also:
Constant Field Values

propertyType_

protected java.lang.Class propertyType_
The type of the property. If the property is an array in CollectionPropertyEditor, it is the type of the array elements.


displayName_

protected java.lang.String displayName_
It is not the display name of the property, given by the property descriptor.


source_

protected BaseObject source_
The instance owning the property


propertyDescriptor_

protected java.beans.PropertyDescriptor propertyDescriptor_
The property descriptor


boundComponent_

protected javax.swing.JComponent boundComponent_
The component that displays a bound property in the beamer. That is the very component which displays it, not the panel arround. It is a JComboBox if the property is a Boolean, a JTextField if the property is a String, an ImmutableName or a BaseObject, or a JList in a CollectionPropertyEditor or RightMapPropertEditor for the keys list. No use in StringMapPropertyEditor.


readMethod_

protected java.lang.reflect.Method readMethod_
The read method if it exists, for the property


writeMethod_

protected java.lang.reflect.Method writeMethod_
The write method if it exists, for the property


listeners_

protected java.util.Vector listeners_
The listeners for property updates


isRestrictedArgument_

protected boolean isRestrictedArgument_
Is true if it is a constrained property that is not in the constructor. The restricted values are get in the property descriptor from 'staticSetOfItems', for Strings only, or from 'choiceMethodForNew', or through a search in the ACS by this PropertyEditor.


sourceBeanInfo_

protected BeanInfoPattern sourceBeanInfo_
The BeanInfo instance associated to the source_. caution: it is initialized only if isRestrictedArgument_ is true, to select the restricted keys or values.


EMPTY_OBJECT

protected static final java.lang.Object EMPTY_OBJECT
An empty object for initialization


EMPTY_INSTANCE

public static final SimplePropertyEditor EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. Caution: never change the state of the returned instance.

Constructor Detail

SimplePropertyEditor

SimplePropertyEditor()
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 CommonPropertyEditor is delegating to us. It selects the class to use for building up the object. It constructs the read and write methods for the property, if they exist, and all the common properties. Called by BeamerManager.addPropertyEditor().

Parameters:
_source - owning the property, to update through setValue() and to use for any events we fire.
_propertyDescriptor - is the descriptor of the property
Returns:
a SimplePropertyEditor or a subclass instance
Throws:
java.lang.NullPointerException - if _source or _displayName is null
ProcessError - if BeanInfo and PropertyDecriptor calls fail

setValue

public void setValue(java.lang.Object _value)
Sets a new value. No action if the write method is unknown. Works when the property is a primitive: boolean, which is set with Boolean, and int which is set with Integer. Noop if the value Class is not the property type, or if there is no write method, or if the invocation to the write method fires an exception, or if the String value is superior to 200 - then, a user error dialog is displayed, and a ProcessError is created but not thrown, since the method signature does not allow it.

Specified by:
setValue in interface java.beans.PropertyEditor
Parameters:
_value - object to be edited. This object is not modified by the PropertyEditor. May be null.

getValue

public java.lang.Object getValue()
Gets the value of the property, from the gBase instance, through the property descriptor in the relevant BeanInfo class. Caution: if the property type is boolean, the returned value is Boolean.TYPE, and it is Integer.TYPE for int. Create a ProcessError without thrown it, if there is an exception fired by java.lang.reflect.Method.invoke(). Called by StringMapPropertyEditor and RightMapPropertyEditor.

Specified by:
getValue in interface java.beans.PropertyEditor
Returns:
The value of the property. Is an empty object if there is no read method, and null if it is the returned value.

getAsText

public java.lang.String getAsText()
Gets the property value as a string suitable for presentation to a human to edit.

Specified by:
getAsText in interface java.beans.PropertyEditor
Returns:
The property value as a string suitable for presentation to a human to edit. Is " " if the value is null.

Returns "" if the value can't be expressed as a string.


setAsText

public void setAsText(java.lang.String _text)
               throws java.lang.IllegalArgumentException
Sets the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text. If the property type is a name, suppose that _text is conform to the standard form with ' :: ' between name components. Caution: getAsText() returns all the components of the name to display, and the name to enter is also the full one. If the property type is a BaseObject, it cannot be an editable property so far.

Specified by:
setAsText in interface java.beans.PropertyEditor
Parameters:
_text - is the string to be parsed.
Throws:
if - the argument is null, empty or not well matched.
java.lang.IllegalArgumentException

getSource

public BaseObject getSource()
Gets the value of the property source.

Specified by:
getSource in interface NewBaseObjectListener
Returns:
the source of the property.

getDisplayName

public java.lang.String getDisplayName()
Gets the value of the display property name (not the true name, given by the property descriptor).

Specified by:
getDisplayName in interface CommonPropertyEditor
Returns:
the display name of the property.

getPropertyType

public java.lang.Class getPropertyType()
Gets the value of the property type, that is the Class of the returned object in getValue(): boolean (not Boolean here), String, ImmutableName,. or a BaseObject instance.

Specified by:
getPropertyType in interface CommonPropertyEditor
Returns:
The type of the property.

getPropertyDescriptor

public java.beans.PropertyDescriptor getPropertyDescriptor()
Gets the descriptor of the property.

Specified by:
getPropertyDescriptor in interface CommonPropertyEditor
Returns:
The descriptor of the property.

getWriteMethod

public java.lang.reflect.Method getWriteMethod()
Gets the method on the source for updates.

Specified by:
getWriteMethod in interface CommonPropertyEditor
Returns:
The method on the source for updates.

getTags

public java.lang.String[] getTags()
When the value is a boolean, the tags are empty to indicate that a checkbox is required, excepted if a couple of tags is set in the property descriptor with the key 'tags', to indicate that a combobox with the tags is required.

Specified by:
getTags in interface java.beans.PropertyEditor
Returns:
the tags or an empty array (length == 0) for a boolean, and null else.

supportsCustomEditor

public boolean supportsCustomEditor()
Determines whether the propertyEditor can provide a custom editor.

Specified by:
supportsCustomEditor in interface java.beans.PropertyEditor
Returns:
true.

getCustomEditor

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

Specified by:
getCustomEditor in interface CommonPropertyEditor
Specified by:
getCustomEditor in interface java.beans.PropertyEditor
Returns:
a JPanel that will allow a human to directly edit the current property value.
See Also:
PropertyEditor.getCustomEditor()

getJavaInitializationString

public java.lang.String getJavaInitializationString()
This method is intended for use when generating Java code to set the value of the property. It should return a fragment of Java code that can be used to initialize a variable with the current property value.

Example results are "2", "new Color(127,127,34)", "Color.orange", etc.

Specified by:
getJavaInitializationString in interface java.beans.PropertyEditor
Returns:
"???".

getPreferedSizeForEditing

public java.awt.Dimension getPreferedSizeForEditing()
Get the prefered size for the rectangle into which the value is displayed, in the component returned by getCustomEditor().

Specified by:
getPreferedSizeForEditing in interface CommonPropertyEditor
Returns:
prefered size.

isPaintable

public boolean isPaintable()
Determines whether the class will honor the paintValue method.

Specified by:
isPaintable in interface java.beans.PropertyEditor
Returns:
false.

paintValue

public void paintValue(java.awt.Graphics gfx,
                       java.awt.Rectangle box)
Paint a representation of the value into a given area of screen real estate. Note that the propertyEditor is responsible for doing its own clipping so that it fits into the given rectangle. If the PropertyEditor doesn't honor paint requests (see isPaintable) this method should be a silent noop.

Specified by:
paintValue in interface java.beans.PropertyEditor
Parameters:
gfx - Graphics object to paint into.
box - Rectangle within graphics object into which we should paint.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener _listener)
Register a listener for the PropertyChange event - NO USE SO FAR. The class will fire a PropertyChange value whenever the value is updated.

Specified by:
addPropertyChangeListener in interface java.beans.PropertyEditor
Parameters:
_listener - An object to be invoked when a PropertyChange event is fired.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener _listener)
Remove a listener for the PropertyChange event - NO USE SO FAR.

Specified by:
removePropertyChangeListener in interface java.beans.PropertyEditor
Parameters:
_listener - The PropertyChange listener to be removed.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent _evt)
Manages the events fired by the components in the JPanel displayed in the beamer, returned by getCustomEditor(). The components may be JComboBox, JCheckBox, JButton or JTextField. The buttons are 'See', 'Select', 'Clear'. For a BaseObject property, use the DialogBox class for the 'Select', and use the setAsText() method for the direct updates in the JTextField. DialogBox.showExplorerSelectionDialog() calls handleSelectionDialog().

When a string is entered in a JTextField, its length is limited to 200. Then, after the user text, a space is added to the end of the string. When an integer is entered in a JTextField, its length is limited to 50. When a name is entered, this method checks its format and if it is wrong, it displays an error message and returns.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
_evt - is the event fired by a JComboBox, a JCheckBox, a JTextField or a JButton class

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent _evt)
Manages the events fired by the base object source_ displayed in the beamer, if it is a bound property and when the property value changes. The main behavior is that the old and new property values in the argument are not ridden to update the values. This allow to process a PropertyChangeEvent that does not describe these values, but is fired by the gBase package when the relevant values are changed in practice. Before updating the component in the GUI, unregisters this instance as ActionListener to avoid loops. The properties of _evt are never used there, since this method reads directly the new value in the base.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
_evt - only source and property name in _evt are used in this method

toString

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

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

handleSelectionDialog

public void handleSelectionDialog(java.util.Map _validatedObjectsSetMap)
Called by DialogBox.showExplorerSelectionDialogt() for actionPerformed(), when the property is a BaseObject which has been selected in the explorer. Overridden method by RightMapPropertyEditor.

Specified by:
handleSelectionDialog in interface SelectionDialogListener
Parameters:
_validatedObjectsSetMap - with one element, where - the key is propertyType_, - the value is a List of one selected object. May be null or empty if the user cancels the operation.

handleNewBaseObject

public void handleNewBaseObject(BaseObject _obj)
NO USE SO FAR. Called by BaseObjectHandler for actionPerformed(), when the property is a BaseObject which has been created from scratch, and then set as a property.

Specified by:
handleNewBaseObject in interface NewBaseObjectListener
Parameters:
_obj - is the BaseObject instance to set for this property

finalizeForProcess

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

Specified by:
finalizeForProcess in interface CommonPropertyEditor

getRestrictedValues

protected java.lang.String[] getRestrictedValues(ACS _acs)
Gets the restricted String values for the argument or the key. When a value is restricted, the allowed values are get: - 1 - from the property descriptor if 'staticSetOfItems' is not null,

- 2 - uses the 'choiceMethodForNew' to call a method which returns a String array, a List or a Set of Strings, and this method is from a specified objet or from the source,

- 3 - from BaseUtilityImpl.getL_AcsRestrictedTypes() if there is a matching key.

For the subclasses of this class where the property is a map, this method is used only for the map keys, not for the map values. Called by actionPerformed() when the value has been entered by the user, CollectionPropertyEditor.addOneStringOrNameElements() and StringMapPropertyEditor.addKeyElement(). Calls BaseUtilityImpl.getL_AcsRestrictedStrings().

Parameters:
_acs - is the new object ACS. Not null only for the third case with BaseUtilityImpl.getL_AcsRestrictedTypes().
Returns:
the restricted values, or null if they are not found

getButtonsDisplaying

protected boolean[] getButtonsDisplaying()
Gets the status of buttons: to display or not in the property editor, through a reading of the property descriptor. Generally speaking, return the buttons 'New'/ 'Delete' when they are not external reference objects, or 'Select'/ Remove' when they are external reference objects, or 'Delete' only, or nothing. The 'See' (or 'View') button may be always added if it is not a string. The 'Previous' button may be added if the previous property editor handles an array with the same type. 'Delete' goes generally with 'New'. On the contrary, 'Remove' goes generally with 'Select'. The buttons 'NewV'/ 'DeletV' are used for handling the values in a map, as an alternative to 'Select'/ 'Remove'. For a map, 'New'/ 'Delete' is reserved to the keys.

Returns:
an array of 9 booleans: withPreviousButton at 0, withViewButton, withSelectButton, withNewButton, withDeleteButton, withRemoveButton, withClearButton at 6, withNewVButton, withDeletVButton at 8
See Also:
setVerticalButtonsInEditor(boolean[], boolean, boolean)

setVerticalButtonsInEditor

protected javax.swing.JPanel setVerticalButtonsInEditor(boolean[] _l_buttons,
                                                        boolean _forMapKey,
                                                        boolean _forMapValue)
Creates a vertical panel with the relevant buttons. The current instance is a button listener. The integrity rules are, as described following:

- _forMapKey and _forMapValue are not both true

- for collections, Select/Remove or New/Delete, but not together

- only New and Delete for map keys

- for map values, Select/Remove or NewV/DeletV, but not together

The returned value is sometimes used only to test if it is null. Called by CollectionPropertyEditor, StringMapPropertyEditor, RightMapPropertyEditor.

Parameters:
_l_buttons - is an array of 9 booleans from getButtonsDisplaying()
_forMapKey - is true when the panel is for the buttons of the key in a MapPropertyEditor. Only 'New' and 'Delete' buttons are relevant then.
_forMapValue - is true when the panel is for the buttons of the value in a MapPropertyEditor. 'New' and 'Delete' buttons are never relevant then.
Returns:
the panel with the right buttons and BoxLayout.Y_AXIS, or null if there is no button to display, or if the integrity rules are not followed
See Also:
getButtonsDisplaying()

viewOneElement

protected void viewOneElement(java.lang.Object _toView)
Called when the user clicks on the button 'See'. This method selects a BaseObject in the explorer, and then it is displayed in the beamer. Displays an user message if the item is not found. This method finalizes this instance if it is in the beamer, through a call to TreeManager which fires a property change to the BeamerManager. Called from actionPerformed(), CollectionPropertyEditor and RightMapPropertyEditor. Calls TreeManager.selectNodeInExplorer() for a BaseObject, and BeamerManager.getBaseObject() when the argument is a name. In this latter case, propertyType_ is passed on, but it is ridden only if it is an instance of StringRight or an array of StringRight. When the element is displayed as a String, it may be because it is trully a String, or because it is the detailled name of an AclEntry or a Privilege. But for this method, the true element cannot be a simple String, since it is viewable as a BaseObject. Caution: for the DetailledName of an AclEntry or a Privilege, it is necessary to use the ACS of the property source_ to get the object from the name. This method does not make the job if the property displays an external AclEntry or Privilege as a property of another ACS.

Parameters:
_toView - BaseObject to view, or ImmutableName of the BaseObject to view, or String of DetailledName for an AclEntry or Privilege to view in the beamer

getKnownValuesForNewElement

protected java.lang.Object[] getKnownValuesForNewElement()
Some constructor/add/copy arguments may be set as mandatory by the BeanInfo, and this method returns an array of these known values, at the right position for the arguments array to use.

In the property descritor, 'withKnownArgumentsForNew' allows to define the constructor arguments which has to be fixed - with 'choiceMethodForNew' or not, add method or not - when a new instance is created through the 'New' button.

First case for the fixed argument: the string 'this' is used to point to the object in the beamer; but this object is NOT get as argument if the 'this' index in the array is after the last specified argument for the constructor or the add method. Second case: search the right property descriptor in the beamer, and call the read method to initialize a l_fixedValue from this object. Third case for the fixed argument: the string 'thisname' is used to point to the value returned from getName() by the object in the beamer. Fourth case: the string 'true' or 'false' is used to define a boolean value. Fifth case, if none of the previous cases matches: takes directly the fixed argument if it is a String.

When the value of an argument is not determined, the returned array sets 'null'. The returned array may be shorter than the argument arrays for the new object. Called by actionPerformed() and CollectionPropertyEditor.addElements().

Returns:
array of known values for the arguments of the new element, in the right order for their use. May be equal to new Object[1].

setListPanelDimension

protected void setListPanelDimension(int _listSize,
                                     javax.swing.JScrollPane _component,
                                     boolean _largeWidth,
                                     boolean _buttonPanel,
                                     boolean _namePanel)
Called by RightMapPropertyEditor, CollectionPropertyEditor, StringMapPropertyEditor, AssociationMapPropertyEditor, to set the dimension of the list. The tresholds for the height are 3, 7, 15, and "limitedSizeForPresentation" from the property descriptor, if this value is greater than 4 and if _listSize is not lesser than 4.

Parameters:
_listSize - height of the list in _component
_component - is the scrollpane which contains the JList to display
_largeWidth - true to have a width equal to the beamer width, as for CollectionPropertyEditor
_buttonPanel - true if there is a vertical panel for buttons, for which the width is from CommonPropertyEditor.BUTTON_DIMENSION_2.
_namePanel - false if the name of the property is not displayed, and the panel is then larger.

getNameFromDetailledName

protected ImmutableName getNameFromDetailledName(java.lang.String _detailledName)
Uses the property source_ to get the name of an ACSObject from its detailled name. Only an AclEntry or a Privilege has a DetailledName. An external AclEntry or Linked Privilege detailled name starts with the name of its ACS ('ACS: ACS_name |'). For an internal AclEntry or Privilege, the ACS of the source is used. Called by viewOneElement() and CollectionPropertyEditor.

Parameters:
_detailledName -
Returns:
the name
See Also:
DetailledName

getBooleanEditor

private javax.swing.JPanel getBooleanEditor()
Gets the boolean editor with the property name. The editor is a JComboBox defined with getTags(), if the property is editable, or a JCheckBox if there is no tags, and else, the editor is a JTextField. If it is a bound property, the editor is updated through propertyChange(). The size of the panel is shorted than the other returned panels. Called by getCustomEditor() when getGeneralEditor() does not match.

Returns:
the panel for editing a boolean value.

getGeneralEditor

private javax.swing.JPanel getGeneralEditor(java.lang.String _displayName,
                                            java.lang.String _text,
                                            boolean _withWriteMethod,
                                            boolean _isBound,
                                            boolean _isBaseObject)
Gets the editor with the property name when the property type is not boolean: int, String, ImmutableName or BaseObject. Calls actionPerformed() when the button "View", "Select" or "Clear" is actionned, if the property type is a BaseObject. Called by getCustomEditor() when getBooleanEditor() does not match.

Parameters:
_displayName - of the property
_text - is the current value of the property, in a textual form
_withWriteMethod - true if the property may be updated through this editor
_isBound - true if the property may change (even if _withWriteMethod is false)
_isBaseObject - true if the property type is a BaseObject. The 'View' button is then displayed.
Returns:
the JPanel for editing the property.

firePropertyChange

private void firePropertyChange()
Reports that we have been modified to any interested listeners - NOT USED SO FAR.


resetUpdate

private void resetUpdate(java.lang.String _text)
Resets the update when the user enter is not correct, and display an error message.

Parameters:
_text - message that explains the error to the user