instrument/JTree API Documentation

org.pvv.bcd.instrument.JTree
Interface NodeFactory

All Known Implementing Classes:
DefaultNodeFactory

public interface NodeFactory

Objects implementing NodeFactory are useful when you want to build instrumented trees with specialized tree nodes. While you will be best served to use DefaultMutableTreeNode type nodes, the NodeFactory gives you complete freedom in what kind of user objects to put into those nodes. The Instrument/JTree classes use node factories throughout when building new nodes.

If a NodeFactory implements XmlNodeFactory, then it can build nodes from imported XML.

If a NodeFactory implements UserObjectFactory, then the user will be able to rename the nodes if he so wishes.

See Also:
NodeInfo, UserObjectFactory, XmlNodeFactory, DefaultNodeFactory

Method Summary
 javax.swing.tree.TreeNode cloneNode(javax.swing.tree.TreeNode node)
          Creates a new node that is identical to another.
 javax.swing.tree.TreeNode createNode(java.lang.Object ob)
          Creates a new node with a given user object.
 javax.swing.tree.TreeNode createNode(java.lang.String title, java.lang.String contents)
          Creates a new node with a given title and contents.
 javax.swing.tree.TreeNode createNode(javax.swing.tree.TreeNode parent)
          Creates a default empty node.
 java.awt.datatransfer.Transferable createTransferable(java.lang.Object[] nodes, DndId dndId)
          Will create and return a suitable Transferable carrying data for multiple nodes.
 java.awt.datatransfer.Transferable createTransferable(java.lang.Object node, DndId dndId)
          Will create and return a suitable Transferable carrying data for one node.
 

Method Detail

cloneNode

public javax.swing.tree.TreeNode cloneNode(javax.swing.tree.TreeNode node)
Creates a new node that is identical to another. Should create a deep copy of the original, unless there are specific reasons to want it otherwise.
Parameters:
node - Node to make a copy of.
Returns:
Reference to new copied node. Should not return the same object as given in the node parameter.

createNode

public javax.swing.tree.TreeNode createNode(javax.swing.tree.TreeNode parent)
Creates a default empty node.
Parameters:
parent - Reference to the parent that the new node will be put under. This parameter may be null. Implementations are quite free to ignore this parameter if they do not need it.
Returns:
Reference to created node.

createNode

public javax.swing.tree.TreeNode createNode(java.lang.Object ob)
Creates a new node with a given user object.
Returns:
Reference to created node.

createNode

public javax.swing.tree.TreeNode createNode(java.lang.String title,
                                            java.lang.String contents)
Creates a new node with a given title and contents.
Returns:
Reference to created node.

createTransferable

public java.awt.datatransfer.Transferable createTransferable(java.lang.Object node,
                                                             DndId dndId)
                                                      throws org.pvv.bcd.Util.FeatureNotSupportedException
Will create and return a suitable Transferable carrying data for one node.
Parameters:
node - Node to create a Transferable for.
Unique - DND id associated with this transfer.
Returns:
A Transferable suitable for transferring the given node data.
Throws:
org.pvv.bcd.Util.FeatureNotSupportedException - if data transfer is not supported by this node factory.
See Also:
createTransferable(Object[], DndId), DefaultTransferable

createTransferable

public java.awt.datatransfer.Transferable createTransferable(java.lang.Object[] nodes,
                                                             DndId dndId)
                                                      throws org.pvv.bcd.Util.FeatureNotSupportedException
Will create and return a suitable Transferable carrying data for multiple nodes.
Parameters:
nodes - Nodes to create a Transferable for.
Unique - DND id associated with this transfer.
Returns:
A Transferable suitable for transferring the given node data.
Throws:
org.pvv.bcd.Util.FeatureNotSupportedException - if data transfer is not supported by this node factory.
See Also:
createTransferable(Object, DndId), DefaultTransferable

instrument/JTree API Documentation