org.wingx.tree
Class XTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.wingx.tree.XTreeNode
All Implemented Interfaces:
Serializable, Cloneable, MutableTreeNode, TreeNode, LazyNode
Direct Known Subclasses:
DefaultTreeTableNode

public abstract class XTreeNode
extends DefaultMutableTreeNode
implements LazyNode

basic node class

See Also:
Serialized Form

Nested Class Summary
static class XTreeNode.InitializationListener
          initialise the nodes when they are expanded
 
Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
protected XTreeNode(Object userObject)
          Creates a tree node with no parent, no children, initialized with the specified user object.
  XTreeNode(TreeModel treeModel, Object userObject, boolean allowsChildren)
          construct the node with the tree model, the tree model must always be passed in the constructor, each node knows it's model from the start.
 
Method Summary
 void addNotify(MutableTreeNode newChild)
          add the child node, and notify the model if it is a default tree model
protected abstract  void doInitialize()
          do the initialization
 int getDepth()
          get the distance of this node from the root node the children of the root node have a depth of 1.
 XTreeNode getNodeChildAt(int index)
          type cast the child ot an onode
 TreeModel getTreeModel()
          return the tree model
 void initialize()
          lazy initialization
 void insertNotify(MutableTreeNode newChild, int index)
          insert the child node, and notify the model if it is a default tree model
 boolean isExpanded()
          return the expanded state.
 boolean isInitialized()
           
 void reinitialize()
          reinitialize
 void removeAllChildrenNotify()
          remove all children
 void setExpanded(boolean expanded)
           
 void setInitialized(boolean initialized)
           
 void setTreeModel(TreeModel treeModel)
          Set the tree model as tree model of current node.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, 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, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XTreeNode

protected XTreeNode(Object userObject)
Creates a tree node with no parent, no children, initialized with the specified user object. For default the XTreeTableNode doesn't allow children.

Parameters:
userObject - an Object provided by the user that constitutes the node's data

XTreeNode

public XTreeNode(TreeModel treeModel,
                 Object userObject,
                 boolean allowsChildren)
construct the node with the tree model, the tree model must always be passed in the constructor, each node knows it's model from the start.

Parameters:
treeModel -
Method Detail

initialize

public void initialize()
lazy initialization

Specified by:
initialize in interface LazyNode

doInitialize

protected abstract void doInitialize()
do the initialization


reinitialize

public void reinitialize()
reinitialize


isInitialized

public boolean isInitialized()
Returns:
Returns the initialized.

setInitialized

public void setInitialized(boolean initialized)

getTreeModel

public TreeModel getTreeModel()
return the tree model

Returns:

setTreeModel

public void setTreeModel(TreeModel treeModel)
Set the tree model as tree model of current node.

Parameters:
treeModel - The tree model of the whole tree.

getNodeChildAt

public XTreeNode getNodeChildAt(int index)
type cast the child ot an onode

Parameters:
index -
Returns:

getDepth

public int getDepth()
get the distance of this node from the root node the children of the root node have a depth of 1.

Overrides:
getDepth in class DefaultMutableTreeNode
Returns:
Returns the depth.

isExpanded

public boolean isExpanded()
return the expanded state. the expanded state is held in the model because certain tree implementations perform expand / collapse at the model level.

Returns:
Returns the expanded.

setExpanded

public void setExpanded(boolean expanded)
Parameters:
expanded - The expanded to set.

insertNotify

public void insertNotify(MutableTreeNode newChild,
                         int index)
insert the child node, and notify the model if it is a default tree model

Parameters:
newChild -
index -

removeAllChildrenNotify

public void removeAllChildrenNotify()
remove all children


addNotify

public void addNotify(MutableTreeNode newChild)
add the child node, and notify the model if it is a default tree model

Parameters:
newChild -
parent -
index -


wingS Swings ;-)