public class BeanNode extends org.openide.nodes.AbstractNode implements Cacheable
You may use this node type for an already-existing JavaBean in order for its JavaBean properties to be reflected as corresponding node properties. Thus, it serves as a compatibility wrapper.
This BeanNode is based on a NodeUpdater that provides it the information
it needs. BeanNode builds a NodeUpdater based on the introspection of the bean.
Then it tries to register itself as PropertyChangeListener provided that the
bean implements the method addPropertyChangeListener. In such a case,
the BeanNode will receive the PropertyChangeEvent and update itself
when needed.
Whether or not the BeanNode can register itself as PropertyChangeListener or
receives any PropertyChangeEvent, it will still try to use the getters
available through introspection to initialize itself. When a given getter is not available
for a property needed by the node, the node will try to find a default value in the
BeanInfo.
To see the property this node is interested in, see the class
cern.gp.beans.IntrospectionBasedNodeUpdater.
NodeUpdater,
NodeUpdaterProvider,
IntrospectionBasedNodeUpdater| Modifier | Constructor and Description |
|---|---|
protected |
BeanNode(java.lang.Object bean,
Children children)
Constructs a node for a JavaBean with a defined child list.
|
| Modifier and Type | Method and Description |
|---|---|
protected SystemAction[] |
createActions()
Returns the actions that shall be displayed in the pop-up menu for this node.
|
protected void |
createProperties(java.lang.Object bean,
java.beans.BeanInfo info,
PropertyInfo[] propertyInfo)
Prepare node properties based on the bean, storing them into the current property sheet.
|
void |
destroy()
Detaches all listeners from the bean and destroys it.
|
java.lang.Object |
getBean() |
java.awt.Component |
getCustomizer()
Returns the customizer component.
|
java.awt.Image |
getIcon(int type)
Get an icon for this node in the closed state.
|
java.awt.Image |
getOpenedIcon(int type)
Get an icon for this node in the open state.
|
javax.swing.Action |
getPreferredAction() |
boolean |
hasCustomizer()
Test if there is a customizer for this node.
|
void |
resetCache()
reset the cache for this Node.
|
protected BeanNode(java.lang.Object bean,
Children children)
throws java.beans.IntrospectionException
bean - the bean this node will be based onchildren - the children of this nodejava.beans.IntrospectionException - if the bean cannot be analyzedpublic javax.swing.Action getPreferredAction()
public java.lang.Object getBean()
public void destroy()
throws java.io.IOException
IOException - if there was a problempublic java.awt.Image getIcon(int type)
type - constant from BeanInfopublic java.awt.Image getOpenedIcon(int type)
type - type constantsgetIcon(int).public boolean hasCustomizer()
true
the customizer can be obtained via getCustomizer method.true if there is a customizer.public java.awt.Component getCustomizer()
null if there is no customizerpublic void resetCache()
resetCache in interface Cacheableprotected void createProperties(java.lang.Object bean,
java.beans.BeanInfo info,
PropertyInfo[] propertyInfo)
bean - bean to compute properties forinfo - information about the beanpropertyInfo - extra information of some properties (possibly null)org.openide.nodes.BeanNode#computePropertiesprotected SystemAction[] createActions()