public class DataNode extends AbstractNode
Node.Cookie, Node.Handle, Node.IndexedProperty<T,E>, Node.Property<T>, Node.PropertySet
displayFormat, systemActions
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 and Description |
---|
DataNode(DataObject obj,
Children ch)
Create a data node with the given children set for the given data object.
|
DataNode(DataObject obj,
Children ch,
Lookup lookup)
Create a data node for a given data object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canCopy() |
boolean |
canCut() |
boolean |
canDestroy()
Indicate whether the node may be destroyed.
|
boolean |
canRename()
Indicate whether the node may be renamed.
|
Transferable |
clipboardCopy()
Copy this node to the clipboard.
|
Transferable |
clipboardCut()
Cut this node to the clipboard.
|
protected SystemAction[] |
createActions()
Deprecated.
Use
DataNode.getActions(boolean) or do nothing and let the
data loader specify actions. |
protected void |
createPasteTypes(Transferable t,
List<PasteType> s) |
protected Sheet |
createSheet() |
void |
destroy()
Removes the node from its parent, deletes it and fires a property change.
|
SystemAction[] |
getActions()
Deprecated.
Use getActions(boolean)
|
Action[] |
getActions(boolean context)
Get actions for this data object.
|
<T extends Node.Cookie> |
getCookie(Class<T> cl)
Get a cookie.
|
DataObject |
getDataObject()
Get the represented data object.
|
String |
getDisplayName()
Get the display name for the node.
|
Node.Handle |
getHandle()
Handle for location of given data object.
|
HelpCtx |
getHelpCtx() |
String |
getHtmlDisplayName()
Get a display name formatted using the limited HTML subset supported by
HtmlRenderer . |
Image |
getIcon(int type)
Get the displayed icon for this node.
|
Image |
getOpenedIcon(int type)
Get the displayed icon for this node.
|
Action |
getPreferredAction()
Get default action.
|
static boolean |
getShowFileExtensions()
Determine whether file extensions should be shown by default.
|
Object |
getValue(String attributeName) |
void |
setName(String name) |
void |
setName(String name,
boolean rename)
Changes the name of the node and may also rename the data object.
|
static void |
setShowFileExtensions(boolean s)
Set whether file extensions should be shown by default.
|
cloneNode, drag, getCookieSet, getCustomizer, getDefaultAction, getDropType, getNewTypes, getPasteTypes, getPropertySets, getSheet, hasCustomizer, setCookieSet, setDefaultAction, setIconBase, setIconBaseWithExtension, setSheet
addNodeListener, addPropertyChangeListener, clone, equals, fireCookieChange, fireDisplayNameChange, fireIconChange, fireNameChange, fireNodeDestroyed, fireOpenedIconChange, firePropertyChange, firePropertySetsChange, fireShortDescriptionChange, getChildren, getContextActions, getContextMenu, getLookup, getParentNode, hashCode, hasPropertyChangeListener, isLeaf, removeNodeListener, removePropertyChangeListener, setChildren, setDisplayName, setHidden, setShortDescription, toString
attributeNames, getName, getShortDescription, isExpert, isHidden, isPreferred, setExpert, setPreferred, setValue
public DataNode(DataObject obj, Children ch)
obj
- object to work withch
- children container for the nodeDataNode.getShowFileExtensions()
public DataNode(DataObject obj, Children ch, Lookup lookup)
obj
- object to work withch
- children container for the nodelookup
- the lookup to provide content of Node.getLookup()
and also DataNode.getCookie(java.lang.Class<T>)
DataNode.getShowFileExtensions()
public DataObject getDataObject()
public void setName(String name, boolean rename)
name
- new name for the objectrename
- rename the data object?IllegalArgumentException
- if the rename failedpublic void setName(String name)
setName
in class AbstractNode
public String getDisplayName()
specially alter
this.
Subclassers overriding this method should consider the recommendations
in DataObject.createNodeDelegate()
.getDisplayName
in class FeatureDescriptor
public String getHtmlDisplayName()
HtmlRenderer
. If the underlying
StatusDecorator
supports HTML annotations, this method
will return non-null if status information is added.getHtmlDisplayName
in class Node
HtmlRenderer
,
Node.getHtmlDisplayName()
public Image getIcon(int type)
specially alter
this.
Subclassers overriding this method should consider the recommendations
in DataObject.createNodeDelegate()
.getIcon
in class AbstractNode
type
- the icon type from BeanInfo
public Image getOpenedIcon(int type)
specially alter
this.
Subclassers overriding this method should consider the recommendations
in DataObject.createNodeDelegate()
.getOpenedIcon
in class AbstractNode
type
- the icon type from BeanInfo
public HelpCtx getHelpCtx()
getHelpCtx
in interface HelpCtx.Provider
getHelpCtx
in class AbstractNode
public boolean canRename()
canRename
in class AbstractNode
DataObject.isRenameAllowed()
public boolean canDestroy()
canDestroy
in class AbstractNode
DataObject.isDeleteAllowed()
public void destroy() throws IOException
destroy
in class Node
IOException
public boolean canCopy()
canCopy
in class AbstractNode
public boolean canCut()
canCut
in class AbstractNode
protected void createPasteTypes(Transferable t, List<PasteType> s)
createPasteTypes
in class AbstractNode
@Deprecated protected SystemAction[] createActions()
DataNode.getActions(boolean)
or do nothing and let the
data loader specify actions.createActions
in class AbstractNode
public Action[] getActions(boolean context)
getActions
in class Node
null
DataLoader.getActions()
@Deprecated public SystemAction[] getActions()
getActions
in class AbstractNode
null
public Action getPreferredAction()
null
is returned in case the underlying data
object is a template. The templates should not have any default
action.getPreferredAction
in class AbstractNode
null
then
the first action returned from getActions (false) method is used.public <T extends Node.Cookie> T getCookie(Class<T> cl)
DataObject.getCookie(java.lang.Class<T>)
is
called. If it produces non-null
result, that is returned.
Otherwise the superclass is tried.
Subclassers overriding this method should consider the recommendations
in DataObject.createNodeDelegate()
. Since version 5.6, if
non-null Lookup
is passed to the constructor, then this
method directly delegates to super.getCookie and does
not query data object at all. This is supposed to provide consistency
between results in getLookup().lookup
and getCookie
.getCookie
in class AbstractNode
null
protected Sheet createSheet()
createSheet
in class AbstractNode
public Object getValue(String attributeName)
getValue
in class FeatureDescriptor
public Transferable clipboardCopy() throws IOException
clipboardCopy
in class AbstractNode
ExTransferable.Single
with one copy flavorIOException
- if it could not copyNodeTransfer
public Transferable clipboardCut() throws IOException
clipboardCut
in class AbstractNode
ExTransferable.Single
with one cut flavorIOException
- if it could not cutNodeTransfer
public Node.Handle getHandle()
getHandle
in class AbstractNode
public static boolean getShowFileExtensions()
true
if sopublic static void setShowFileExtensions(boolean s)
Note that this method affects all DataNode
s.
s
- true
if so