站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

DataNode (NetBeans Loaders API) - NetBeans API Javadoc 5.0.0

 

org.openide.loaders
Class DataNode

java.lang.Object
  extended byjava.beans.FeatureDescriptor
      extended byorg.openide.nodes.Node
          extended byorg.openide.nodes.AbstractNode
              extended byorg.openide.loaders.DataNode
All Implemented Interfaces:
HelpCtx.Provider, Lookup.Provider
Direct Known Subclasses:
DataFolder.FolderNode

public class DataNode
extends AbstractNode

Standard node representing a data object.


Nested Class Summary
 
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
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.
 
Method Summary
 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 getActions(boolean) or do nothing and let the data loader specify actions.
protected  Sheet createSheet()
           
 void destroy()
           
 SystemAction[] getActions()
          Deprecated. Use getActions(boolean)
 Action[] getActions(boolean context)
          Get actions for this data object.
 Node.Cookie getCookie(Class 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.
 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.
 
Methods inherited from class org.openide.nodes.AbstractNode
cloneNode, createPasteTypes, drag, getCookieSet, getCustomizer, getDefaultAction, getDropType, getNewTypes, getPasteTypes, getPropertySets, getSheet, hasCustomizer, setCookieSet, setDefaultAction, setIconBase, setIconBaseWithExtension, setSheet
 
Methods inherited from class org.openide.nodes.Node
addNodeListener, addPropertyChangeListener, clone, equals, fireCookieChange, fireDisplayNameChange, fireIconChange, fireNameChange, fireNodeDestroyed, fireOpenedIconChange, firePropertyChange, firePropertySetsChange, fireShortDescriptionChange, getChildren, getContextActions, getContextMenu, getLookup, getParentNode, hasPropertyChangeListener, isLeaf, removeNodeListener, removePropertyChangeListener, setChildren, setDisplayName, setShortDescription, toString
 
Methods inherited from class java.beans.FeatureDescriptor
attributeNames, 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

DataNode

public DataNode(DataObject obj,
                Children ch)
Create a data node with the given children set for the given data object.

Parameters:
obj - object to work with
ch - children container for the node
See Also:
getShowFileExtensions()

DataNode

public DataNode(DataObject obj,
                Children ch,
                Lookup lookup)
Create a data node for a given data object. The provided children object will be used to hold all child nodes. The name is always set to the base name of the primary file; the display name may instead be set to the base name with extension.

Parameters:
obj - object to work with
ch - children container for the node
lookup - the lookup to provide content of Node.getLookup() and also getCookie(java.lang.Class)
Since:
5.6
See Also:
getShowFileExtensions()
Method Detail

getDataObject

public DataObject getDataObject()
Get the represented data object.

Returns:
the data object

setName

public void setName(String name,
                    boolean rename)
Changes the name of the node and may also rename the data object. If the object is renamed and file extensions are to be shown, the display name is also updated accordingly.

Parameters:
name - new name for the object
rename - rename the data object?
Throws:
IllegalArgumentException - if the rename failed

setName

public void setName(String name)

getDisplayName

public String getDisplayName()
Get the display name for the node. A filesystem may specially alter this. Subclassers overriding this method should consider the recommendations in DataObject.createNodeDelegate().

Returns:
the desired name

getHtmlDisplayName

public String getHtmlDisplayName()
Get a display name formatted using the limited HTML subset supported by HtmlRenderer. If the underlying FileSystem.Status is an instance of HmlStatus, this method will return non-null if status information is added.

Returns:
a string containing compliant HTML markup or null
Since:
4.13
See Also:
HtmlRenderer, Node.getHtmlDisplayName()

getIcon

public Image getIcon(int type)
Get the displayed icon for this node. A filesystem may specially alter this. Subclassers overriding this method should consider the recommendations in DataObject.createNodeDelegate().

Parameters:
type - the icon type from BeanInfo
Returns:
the desired icon

getOpenedIcon

public Image getOpenedIcon(int type)
Get the displayed icon for this node. A filesystem may specially alter this. Subclassers overriding this method should consider the recommendations in DataObject.createNodeDelegate().

Parameters:
type - the icon type from BeanInfo
Returns:
the desired icon

getHelpCtx

public HelpCtx getHelpCtx()

canRename

public boolean canRename()
Indicate whether the node may be renamed.

Returns:
tests DataObject.isRenameAllowed()

canDestroy

public boolean canDestroy()
Indicate whether the node may be destroyed.

Returns:
tests DataObject.isDeleteAllowed()

destroy

public void destroy()
             throws IOException
Throws:
IOException

canCopy

public boolean canCopy()

canCut

public boolean canCut()

createActions

protected SystemAction[] createActions()
Deprecated. Use getActions(boolean) or do nothing and let the data loader specify actions.

This method returns null to signal that actions provide by DataLoader.getActions should be returned from method getActions. If overriden to provide some actions, then these actions will be preferred to the loader's ones.

Returns:
null

getActions

public Action[] getActions(boolean context)
Get actions for this data object.

Returns:
array of actions or null
See Also:
DataLoader.getActions()

getActions

public SystemAction[] getActions()
Deprecated. Use getActions(boolean)

Get actions for this data object.

Returns:
array of actions or null

getPreferredAction

public Action getPreferredAction()
Get default action. In the current implementation the null is returned in case the underlying data object is a template. The templates should not have any default action.

Returns:
no action if the underlying data object is a template. Otherwise the abstract node's default action is returned, if null then the first action returned from getActions (false) method is used.

getCookie

public Node.Cookie getCookie(Class cl)
Get a cookie. First of all DataObject.getCookie(java.lang.Class) 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.

Returns:
the cookie or null

createSheet

protected Sheet createSheet()

clipboardCopy

public Transferable clipboardCopy()
                           throws IOException
Copy this node to the clipboard.

Returns:
ExTransferable.Single with one copy flavor
Throws:
IOException - if it could not copy
See Also:
NodeTransfer

clipboardCut

public Transferable clipboardCut()
                          throws IOException
Cut this node to the clipboard.

Returns:
ExTransferable.Single with one cut flavor
Throws:
IOException - if it could not cut
See Also:
NodeTransfer

getHandle

public Node.Handle getHandle()
Handle for location of given data object.

Returns:
handle that remembers the data object.

getShowFileExtensions

public static boolean getShowFileExtensions()
Determine whether file extensions should be shown by default. By default, no.

Returns:
true if so

setShowFileExtensions

public static void setShowFileExtensions(boolean s)
Set whether file extensions should be shown by default.

Parameters:
s - true if so

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.