Public Member Functions | |
void | addPropertyChangeListener (PropertyChangeListener listener) |
void | addPropertyChangeListener (String propertyName, PropertyChangeListener listener) |
void | removePropertyChangeListener (PropertyChangeListener listener) |
void | removePropertyChangeListener (String propertyName, PropertyChangeListener listener) |
String | getDisplayName () |
String | getName () |
String[] | getNodeActions () |
String | getNodeDefaultAction () |
Image | getNodeIcon () |
Boolean | getNodePropertiesCacheable () |
String | getShortDescription () |
PropertyInfo[] | getPropertyInfo () |
Protected Member Functions | |
BeanSupport () | |
void | firePropertyChange (String propertyName, Object oldValue, Object newValue) |
void | fireNamePropertyChange (String newName) |
void | fireDisplayNamePropertyChange (String newDisplayName) |
void | fireShortDescriptionPropertyChange (String newShortDescription) |
void | fireNodeIconPropertyChange (java.awt.Image newIcon) |
void | fireNodeDefaultActionPropertyChange (String newDefaultAction) |
java.awt.Image | getNodeIconFromPathname (String newIconPathname) |
synchronized void | checkPropertyChangeSupport () |
Static Protected Member Functions | |
String[] | mergeNodeActions (String[] actions1, String[] actions2) |
PropertyInfo[] | mergePropertyInfo (PropertyInfo[] info1, PropertyInfo[] info2) |
Private Attributes | |
PropertyChangeSupport | propertyChangeSupport |
This support class provides the necessary methods to register a listener and provides methods to send PropertyChangeEvents. The bean can use the protected methods to fire events each time a property changes.
In order to be represented by a node, the bean can provide extra information that is not directly related to the business of the bean but that is nevertheless interesting to control the node. The bean can provide that information through its BeanInfo
or through specific getters (defined in the interface GPNode
). The information provided can be static or dynamic. It is static if the value is just given once when the node is created, it is dynamic if the bean allow the node to register itself as PropertyChangeListener
and fire events when those properties changes.
The list of properties recognized by the node and associated getters is given by the GPBean
interface. This support class implements all the getter methods in GPNode
by returning a null value. You should override each method you want to provide information for. For each property that can be dynamically updated there is a protected method in this class you can use to fire an event to update the value. Here is the list :
property name | method name | method to fire related event |
name | getName() | fireNamePropertyChange() |
displayName | getDisplayName() | fireDisplayNamePropertyChange() |
shortDescription | getShortDescription() | fireShortDescriptionPropertyChange() |
nodeDefaultAction | getNodeDefaultAction() | fireNodeDefaultActionPropertyChange() |
nodeIcon | getNodeIcon | fireNodeIconPropertyChange() |
If the bean fire a given event, it should provide the getter matching the PropertyChangeEvent
that it fires. For instance if the bean call the protected method fireNamePropertyChange
when a name change occurs, it should have the matching getter getName()
implemented and returning a non null value.
When a given getter is not available in this bean, the corresponding information will be looked-up in the BeanInfo
. It will only be static, because the BeanInfo provides static information common to all beans. There is only one BeanInfo for a given class of beans and therefore the information founds inside the BeanInfo is shared by all beans of that class. If the BeanInfo
does not contain the information, a standard default value will be applied when possible.
|
|
|
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.
|
|
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.
|
|
Lazily creates the PropertyChangeSupport |
|
Reports a DisplayName property update to any registered listeners.
|
|
Reports a Name property update to any registered listeners.
|
|
Reports a default action property update to any registered listeners.
|
|
Reports a icon property update to any registered listeners.
|
|
Reports a bound property update to any registered listeners. No event is fired if old and new are equal and non-null. You pass null for all 3 parameters, to tell the listeners to read all properties again, using the accessor methods. This is useful if you want to force all properties of this bean to be refreshed in the GUI (e.g. refresh the whole property sheet or a row in a ListTable at once).
|
|
Reports a ShortDescription property update to any registered listeners.
|
|
Returns the internal display name of the associated bean. If null is returned a default name will be used.
Implements cern::gp::beans::GPBean.
Reimplemented in cern::laser::guiplatform::configuration::ConfigurationBean, and cern::laser::guiplatform::user::UserBean.
|
|
Returns the internal name of the associated bean. If null is returned a default name will be used.
Implements cern::gp::beans::GPBean.
Reimplemented in cern::laser::guiplatform::configuration::ConfigurationBean, cern::laser::guiplatform::filters::FilterItemBean, and cern::laser::guiplatform::user::UserBean.
|
|
Returns an array of qualified name of actions for the node representing the associated bean. Null can be used in the array to represent a separator.
Implements cern::gp::beans::GPBean.
Reimplemented in cern::laser::guiplatform::configuration::ConfigurationBean, cern::laser::guiplatform::filters::FilterItemBean, and cern::laser::guiplatform::user::UserBean.
|
|
Returns the qualified name of the default action for the node representing the associated bean. The default action is the one triggered when the user double-clic on the node. If null is returned a default default action will be used.
Implements cern::gp::beans::GPBean.
Reimplemented in cern::laser::guiplatform::configuration::ConfigurationBean, cern::laser::guiplatform::filters::FilterItemBean, and cern::laser::guiplatform::user::UserBean.
|
|
Returns the icon in 16x16 size used to display the node representing the associated bean. If null is returned a default icon will be used.
Implements cern::gp::beans::GPBean.
Reimplemented in cern::laser::guiplatform::configuration::ConfigurationBean, cern::laser::guiplatform::filters::FilterItemBean, and cern::laser::guiplatform::user::UserBean.
|
|
Returns the icon image from the pathname of the icon.
The pathname should be relative to the package of this bean and be contained in the classpath. For instance if this bean is in
|
|
Returns true if the value of the properties can be cached in the node, false if they cannot or null if no behavior is specified. The default behavior is not to cache the value of the properties. If the value of a property is not cached, the getter method will be invoked whenever the node need to get the value of the property.
If the value of the property is cached, the getter method for the property will only be invoked once to read the value. Then, whenever the node need the value of the property it will used the cached one until a
Caching values can improve performance greatly but it adds one more responsibility on the developer who has to fire
This property gives the caching strategy for all properties. It is possible to override the bean level caching strategy at the property level by using the property information
Implements cern::gp::beans::GPBean.
|
|
Returns an array of
Each
Implements cern::gp::beans::GPBean.
Reimplemented in cern::laser::guiplatform::configuration::ConfigurationBean, cern::laser::guiplatform::filters::FilterItemBean, and cern::laser::guiplatform::user::UserBean.
|
|
Returns a short description of the associated bean (used in tooltip for instance). If null is returned a default description will be used.
Implements cern::gp::beans::GPBean.
Reimplemented in cern::laser::guiplatform::configuration::ConfigurationBean, and cern::laser::guiplatform::user::UserBean.
|
|
Merges the two String[] parentArray= super.getNodeActions(); String[] myArray = new String [] { .... }; return mergePropertyInfo(parentPI, myPI);
|
|
Merges the two PropertyInfo[] parentPI = super.getPropertyInfo(); PropertyInfo[] myPI = new PropertyInfo[] { .... }; return mergePropertyInfo(parentPI, myPI);
|
|
Remove a PropertyChangeListener for a specific property.
|
|
Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property.
|
|
|