org.netbeans.spi.viewmodel/2 1.32.1

org.netbeans.spi.viewmodel
Interface ExtendedNodeModel

All Superinterfaces:
Model, NodeModel
All Known Implementing Classes:
Models.CompoundModel

public interface ExtendedNodeModel
extends NodeModel

Provides extension to NodeModel with cut/copy/paste and rename functionality, and also allowing to set icons with extension.

Since:
1.12

Method Summary
 boolean canCopy(Object node)
          Test whether this node permits copying.
 boolean canCut(Object node)
          Test whether this node permits cutting.
 boolean canRename(Object node)
          Test whether this node permits renaming.
 Transferable clipboardCopy(Object node)
          Called when a node is to be copied to the clipboard.
 Transferable clipboardCut(Object node)
          Called when a node is to be cut to the clipboard.
 String getIconBaseWithExtension(Object node)
          Returns icon resource with extension for given node.
 PasteType[] getPasteTypes(Object node, Transferable t)
          Determine which paste operations are allowed when a given transferable is in the clipboard.
 void setName(Object node, String name)
          Sets a new name for given node.
 
Methods inherited from interface org.netbeans.spi.viewmodel.NodeModel
addModelListener, getDisplayName, getIconBase, getShortDescription, removeModelListener
 

Method Detail

canRename

boolean canRename(Object node)
                  throws UnknownTypeException
Test whether this node permits renaming.

Returns:
true if so
Throws:
UnknownTypeException

canCopy

boolean canCopy(Object node)
                throws UnknownTypeException
Test whether this node permits copying.

Returns:
true if so
Throws:
UnknownTypeException

canCut

boolean canCut(Object node)
               throws UnknownTypeException
Test whether this node permits cutting.

Returns:
true if so
Throws:
UnknownTypeException

clipboardCopy

Transferable clipboardCopy(Object node)
                           throws IOException,
                                  UnknownTypeException
Called when a node is to be copied to the clipboard.

Parameters:
node - The node object
Returns:
the transferable object representing the content of the clipboard
Throws:
IOException - when the copy cannot be performed
UnknownTypeException

clipboardCut

Transferable clipboardCut(Object node)
                          throws IOException,
                                 UnknownTypeException
Called when a node is to be cut to the clipboard.

Parameters:
node - The node object
Returns:
the transferable object representing the content of the clipboard
Throws:
IOException - when the cut cannot be performed
UnknownTypeException

getPasteTypes

PasteType[] getPasteTypes(Object node,
                          Transferable t)
                          throws UnknownTypeException
Determine which paste operations are allowed when a given transferable is in the clipboard. For example, a node representing a Java package will permit classes to be pasted into it.

Parameters:
node - The node object
t - the transferable in the clipboard
Returns:
array of operations that are allowed
Throws:
UnknownTypeException

setName

void setName(Object node,
             String name)
             throws UnknownTypeException
Sets a new name for given node.

Parameters:
node - The object to set the new name to.
name - The new name for the given node
Throws:
UnknownTypeException

getIconBaseWithExtension

String getIconBaseWithExtension(Object node)
                                throws UnknownTypeException
Returns icon resource with extension for given node. This is the preferred way of icon specification over org.netbeans.spi.viewmodel.NodeModel.getIconBase

Parameters:
node - The node object
Returns:
The base resouce name with extension (no initial slash)
Throws:
UnknownTypeException - if this NodeModel implementation is not able to resolve icon for given node type

org.netbeans.spi.viewmodel/2 1.32.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.