com.alee.laf.tree
Class UniqueNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.alee.laf.tree.UniqueNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
AsyncUniqueNode

public class UniqueNode
extends javax.swing.tree.DefaultMutableTreeNode
implements java.io.Serializable

This class provides a custom node with a specific ID. This node is used in various WebLookAndFeel tree components to properly save selections and expansion states. This node might also be used for some advanced cases like asynchronous tree.

Author:
Mikle Garin
See Also:
Serialized Form

Field Summary
protected  java.lang.String id
          Unique node ID.
protected static java.lang.String ID_PREFIX
          Prefix for node ID.
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
UniqueNode()
          Costructs a simple node.
UniqueNode(java.lang.Object userObject)
          Costructs a node with a specified user object.
 
Method Summary
 java.lang.String getId()
          Returns node ID and creates it if it doesn't exist.
 UniqueNode getParent()
          
 javax.swing.tree.TreePath getTreePath()
          Returns TreePath for this node.
protected  void setId()
          Changes node ID to new random ID.
 void setId(java.lang.String id)
          Changes node ID.
 java.lang.String toString()
          Returns text node representation.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID_PREFIX

protected static final java.lang.String ID_PREFIX
Prefix for node ID.

See Also:
Constant Field Values

id

protected java.lang.String id
Unique node ID.

Constructor Detail

UniqueNode

public UniqueNode()
Costructs a simple node.


UniqueNode

public UniqueNode(java.lang.Object userObject)
Costructs a node with a specified user object.

Parameters:
userObject - custom user object
Method Detail

getId

public java.lang.String getId()
Returns node ID and creates it if it doesn't exist.

Returns:
node ID

setId

public void setId(java.lang.String id)
Changes node ID.

Parameters:
id - new node ID

setId

protected void setId()
Changes node ID to new random ID.


getParent

public UniqueNode getParent()

Specified by:
getParent in interface javax.swing.tree.TreeNode
Overrides:
getParent in class javax.swing.tree.DefaultMutableTreeNode

getTreePath

public javax.swing.tree.TreePath getTreePath()
Returns TreePath for this node.

Returns:
TreePath for this node

toString

public java.lang.String toString()
Returns text node representation.

Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode
Returns:
text node representation