public abstract class IntrospectionBasedNodeUpdater extends java.lang.Object implements NodeUpdater
NodeUpdater based on introspection.
For beans that do not implement any interface we use the JavaBeans specification for doing the introspection of the
properties we are interested in. Those properties should have at least an associated getter. The list of properties
we look for is defined by the GPBean interface.
This NodeUpdater also supports the BeanInfo tagging done through the BeanTagger class.
Tagging a BeanInfo allows to add information that is not directly supported by the
BeanInfo. Three tags are recognized by BeanNode :
BeanTagger.getActions() to get the actions for this node. By default
no action is added.BeanTagger.getDefaultAction() to get the default action for this node.
By default the Property action is used.BeanTagger.isCacheable() to get whether the value of the properties of
the bean can be cached or not.CLASS_PROPERTY_NAME, DISPLAYNAME_PROPERTY_DISPLAY_NAME, DISPLAYNAME_PROPERTY_NAME, NAME_PROPERTY_DISPLAY_NAME, NAME_PROPERTY_NAME, NODE_ACTIONS_PROPERTY_NAME, NODE_DEFAULT_ACTION_PROPERTY_NAME, NODE_ICON_PROPERTY_NAME, NODE_PROPERTIES_CACHEABLE_PROPERTY_NAME, PROPERTY_INFO_PROPERTY_NAME, SHORTDESCRIPTION_PROPERTY_DISPLAY_NAME, SHORTDESCRIPTION_PROPERTY_NAME| Modifier | Constructor and Description |
|---|---|
protected |
IntrospectionBasedNodeUpdater(java.lang.Object bean)
Creates a new
GuiUpdaterIntrospector |
protected |
IntrospectionBasedNodeUpdater(java.lang.Object bean,
java.beans.BeanInfo beanInfo)
Creates a new
GuiUpdaterIntrospector |
protected |
IntrospectionBasedNodeUpdater(java.lang.Object bean,
java.beans.BeanInfo beanInfo,
java.lang.Class targetClass)
Creates a new
GuiUpdaterIntrospector |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
fireDisplayNameChange(java.lang.String newDisplayName) |
protected abstract void |
fireNameChange(java.lang.String newName) |
protected abstract void |
fireNodeDefaultActionChange(java.lang.String newDefaultAction) |
protected abstract void |
fireNodeIconChange(java.awt.Image newIcon) |
protected abstract void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue) |
protected abstract void |
fireShortDescriptionChange(java.lang.String newShortDescription) |
java.lang.String |
getDisplayName()
Returns the internal display name of the associated bean.
|
java.lang.String |
getName()
Returns the internal name of the associated bean.
|
java.lang.String[] |
getNodeActions()
Returns an array of qualified name of actions for the node representing the associated bean.
|
java.lang.String |
getNodeDefaultAction()
Returns the qualified name of the default action for the node representing the associated bean.
|
java.awt.Image |
getNodeIcon()
Returns the icon in 16x16 size used to display the node representing the associated bean.
|
java.lang.Boolean |
getNodePropertiesCacheable()
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.
|
PropertyInfo[] |
getPropertyInfo()
Returns an array of
PropertyInfo specifying information on some properties. |
java.lang.String |
getShortDescription()
Returns a short description of the associated bean (used in tooltip for instance).
|
protected boolean |
hasRegisteredListener() |
boolean |
isPropertyHidden(java.beans.PropertyDescriptor propertyDescriptor)
Returns whether or not the property having the given
PropertyDescriptor is a property
supported by this introspector that should automatically be hidden. |
protected void |
removePropertyChangeListener() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddNodeUpdaterListener, removeNodeUpdaterListenerprotected IntrospectionBasedNodeUpdater(java.lang.Object bean)
throws java.beans.IntrospectionException
GuiUpdaterIntrospectorjava.beans.IntrospectionExceptionprotected IntrospectionBasedNodeUpdater(java.lang.Object bean,
java.beans.BeanInfo beanInfo)
throws java.beans.IntrospectionException
GuiUpdaterIntrospectorjava.beans.IntrospectionExceptionprotected IntrospectionBasedNodeUpdater(java.lang.Object bean,
java.beans.BeanInfo beanInfo,
java.lang.Class targetClass)
throws java.beans.IntrospectionException
GuiUpdaterIntrospectorjava.beans.IntrospectionExceptionpublic boolean isPropertyHidden(java.beans.PropertyDescriptor propertyDescriptor)
PropertyDescriptor is a property
supported by this introspector that should automatically be hidden.
In the case the property is supported and should not be hidden, the PropertyDescriptor will
be updated with the display name of the property.propertyName - the property name to checkpublic java.lang.String getName()
GPBeannamenormal (visible in a property sheet)a unique name generated using BeanUtils.
generateUniqueBeanName()
public java.lang.String getDisplayName()
GPBeandisplayNamenormal (visible in a property sheet)if getName() is available it is used instead of
getDisplayName(), else beanInfo.getBeanDescriptor().getDisplayName() is usedgetDisplayName in interface GPBeanpublic java.lang.String getShortDescription()
GPBeanshortDescriptionnormal (visible in a property sheet)beanInfo.getBeanDescriptor().
getShortDescription()getShortDescription in interface GPBeanpublic java.awt.Image getNodeIcon()
GPBeannodeIconhidden (not visible in a property sheet)beanInfo.getIcon()getNodeIcon in interface GPBeanpublic java.lang.String getNodeDefaultAction()
GPBeannodeDefaultActionhiddenuse the possible tagging of the BeanDescriptor
of the BeanInfo : BeanTagger.getDefaultAction(beanInfo.getBeanDescriptor())getNodeDefaultAction in interface GPBeanpublic java.lang.String[] getNodeActions()
GPBeannodeActionshidden (not visible in a property sheet)use the possible tagging of the BeanDescriptor
of the BeanInfo : BeanTagger.getActions(beanInfo.getBeanDescriptor())getNodeActions in interface GPBeanpublic java.lang.Boolean getNodePropertiesCacheable()
GPBeanIf 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 PropertyChangeEvent for the property (or for all properties) is fired.
Caching values can improve performance greatly but it adds one more responsibility on the developer
who has to fire PropertyChangeEvent whenever the property values change.
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 getPropertyInformation().
nodePropertiesCacheablehidden (not visible in a property sheet)use the possible tagging of the BeanDescriptor
of the BeanInfo : BeanTagger.isCacheable(beanInfo.getBeanDescriptor())getNodePropertiesCacheable in interface GPBeanpublic PropertyInfo[] getPropertyInfo()
GPBeanPropertyInfo specifying information on some properties.
Each PropertyInfo of this array defines information for one property of this bean. Defining a
PropertyInfo for a given property is usefull when there is no explicit BeanInfo for the
bean and when the property have non default characteristics such as, for instance, a specific
PropertyEditor.
propertyInfohidden (not visible in a property sheet)use PropertyDescriptors from
BeanInfogetPropertyInfo in interface GPBeanprotected abstract void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
protected abstract void fireNameChange(java.lang.String newName)
protected abstract void fireDisplayNameChange(java.lang.String newDisplayName)
protected abstract void fireShortDescriptionChange(java.lang.String newShortDescription)
protected abstract void fireNodeDefaultActionChange(java.lang.String newDefaultAction)
protected abstract void fireNodeIconChange(java.awt.Image newIcon)
protected final void removePropertyChangeListener()
protected final boolean hasRegisteredListener()