|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.beans.FeatureDescriptor org.openide.nodes.Node org.openide.nodes.AbstractNode org.openide.nodes.BeanNode
Represents one JavaBean in the nodes hierarchy. It provides all methods that are needed for communication between the IDE and the bean.
You may use this node type for an already-existing JavaBean (possibly using BeanContext) in order for its JavaBean properties to be reflected as corresponding node properties. Thus, it serves as a compatibility wrapper.
Nested Class Summary | |
static class |
BeanNode.Descriptor
Descriptor of three types of properties. |
Nested classes inherited from class org.openide.nodes.Node |
Node.Cookie, Node.Handle, Node.IndexedProperty, Node.Property, Node.PropertySet |
Field Summary |
Fields inherited from class org.openide.nodes.AbstractNode |
displayFormat, systemActions |
Fields inherited from class org.openide.nodes.Node |
EMPTY, PROP_COOKIE, PROP_DISPLAY_NAME, PROP_ICON, PROP_LEAF, PROP_NAME, PROP_OPENED_ICON, PROP_PARENT_NODE, PROP_PROPERTY_SETS, PROP_SHORT_DESCRIPTION |
Constructor Summary | |
|
BeanNode(Object bean)
Constructs a node for a JavaBean. |
protected |
BeanNode(Object bean,
Children children)
Constructs a node for a JavaBean with a defined child list. |
Method Summary | |
boolean |
canCopy()
Can this node be copied? |
boolean |
canCut()
Can this node be cut? |
boolean |
canDestroy()
Can this node be removed? |
boolean |
canRename()
Can this node be renamed? |
static BeanNode.Descriptor |
computeProperties(Object bean,
BeanInfo info)
Computes a descriptor for properties from a bean info. |
protected SystemAction[] |
createActions()
Lazily initialize set of node's actions (overridable). |
protected void |
createProperties(Object bean,
BeanInfo info)
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. |
protected Object |
getBean()
Provides access to the bean represented by this BeanNode. |
Component |
getCustomizer()
Get the customizer. |
HelpCtx |
getHelpCtx()
Get context help associated with this node. |
Image |
getIcon(int type)
Get an icon for this node in the closed state. |
Image |
getOpenedIcon(int type)
Get an icon for this node in the open state. |
Action |
getPreferredAction()
Gets preferred action. |
boolean |
hasCustomizer()
Does this node have a customizer? |
void |
setName(String s)
Set the node name. |
protected void |
setSynchronizeName(boolean watch)
Set whether or not to keep the node name and Bean name synchronized automatically. |
Methods inherited from class org.openide.nodes.AbstractNode |
clipboardCopy, clipboardCut, cloneNode, createPasteTypes, createSheet, drag, getActions, getCookie, getCookieSet, getDefaultAction, getDropType, getHandle, getNewTypes, getPasteTypes, getPropertySets, getSheet, setCookieSet, setDefaultAction, setIconBase, setIconBaseWithExtension, setSheet |
Methods inherited from class java.beans.FeatureDescriptor |
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setExpert, setHidden, setPreferred, setValue |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BeanNode(Object bean) throws IntrospectionException
BeanContext
,
creates a child list as well.
bean
- the bean this node will be based on
IntrospectionException
- if the bean cannot be analyzedprotected BeanNode(Object bean, Children children) throws IntrospectionException
bean
- the bean this node will be based onchildren
- children for the node (default if null)
IntrospectionException
- if the bean cannot be analyzedMethod Detail |
protected void setSynchronizeName(boolean watch)
getName ()
, getDisplayName ()
or from FeatureDescriptor.getDisplayName()
.
Also when the (system) name of the node is changing, the change propagates if possible to
methods setName (String)
or setDisplayName (String)
. (This
does not apply to setting the display name of the node, however.)
By default this feature is turned on.
watch
- true
if the name of the node should be synchronized with
the name of the bean, false
if the name of the node should be independent
or manually updatedprotected Object getBean()
public void destroy() throws IOException
IOException
- if there was a problempublic boolean canDestroy()
canDestroy
in class AbstractNode
true
in this implementationpublic void setName(String s)
setSynchronizeName(boolean)
.
setName
in class AbstractNode
s
- the new namepublic boolean canRename()
canRename
in class AbstractNode
true
if there is no name synchronization, or there is
a valid setter method for the namepublic Image getIcon(int type)
getIcon
in class AbstractNode
type
- constant from BeanInfo
public Image getOpenedIcon(int type)
getOpenedIcon
in class AbstractNode
type
- type constants
getIcon(int)
.public HelpCtx getHelpCtx()
Node
getHelpCtx
in interface HelpCtx.Provider
getHelpCtx
in class AbstractNode
protected void createProperties(Object bean, BeanInfo info)
bean
- bean to compute properties forinfo
- information about the beancomputeProperties(java.lang.Object, java.beans.BeanInfo)
public boolean canCopy()
canCopy
in class AbstractNode
true
in the default implementationpublic boolean canCut()
canCut
in class AbstractNode
false
in the default implementationprotected SystemAction[] createActions()
AbstractNode
null
.
Warning: do not call AbstractNode.getActions()
within this method.
createActions
in class AbstractNode
null
to use the default node actionspublic boolean hasCustomizer()
AbstractNode
hasCustomizer
in class AbstractNode
false
public Component getCustomizer()
AbstractNode
getCustomizer
in class AbstractNode
null
in the default implementationpublic static BeanNode.Descriptor computeProperties(Object bean, BeanInfo info)
Property code names are taken from the property descriptor names
according to the JavaBeans specification. For example, a pair of
methods getFoo
and setFoo
would result in
a node property with code name foo
. If you call
MyBean.setFoo(...)
, this should result in a property
change event with name foo
; if you are using these
properties in some other context (attached to something other than
a BeanNode
) then be careful to fire changes with the correct
name, or there may be problems with refreshing display of the property etc.
bean
- bean to create properties forinfo
- about the bean
public Action getPreferredAction()
AbstractNode
getPreferredAction
in class AbstractNode
Node.getPreferredAction()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |