SPT Core API

com.sptci.epng
Class TreeNode<S>

java.lang.Object
  extended by echopointng.tree.DefaultMutableTreeNode
      extended by com.sptci.epng.TreeNode<S>
All Implemented Interfaces:
MutableTreeNode, TreeNode, Serializable

public class TreeNode<S>
extends DefaultMutableTreeNode

A genericised subclass of DefaultMutableTreeNode.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: TreeNode.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2007-09-27
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class echopointng.tree.DefaultMutableTreeNode
DefaultMutableTreeNode.BreadthFirstEnumeration, DefaultMutableTreeNode.PathBetweenNodesEnumeration, DefaultMutableTreeNode.PostorderEnumeration, DefaultMutableTreeNode.PreorderEnumeration
 
Field Summary
protected  boolean initialised
          A flag used to indicate that this node is uninitialised.
 
Fields inherited from class echopointng.tree.DefaultMutableTreeNode
actionCommand, allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
TreeNode()
          Creates a tree node that has no parent and no children, but which allows children.
TreeNode(S userObject)
          Creates a tree node with no parent, no children, but which allows children, and initialises it with the specified user object.
TreeNode(S userObject, boolean allowsChildren)
          Creates a tree node with no parent, no children, initialised with the specified user object, and that allows children only if specified.
 
Method Summary
 S getUserObject()
          Returns the underlying data object represented by this node.
 void setUserObject(Object userObject)
          Sets the underlying data object represented by this node.
 
Methods inherited from class echopointng.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, depthFirstEnumeration, getActionCommand, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setActionCommand, setAllowsChildren, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

initialised

protected boolean initialised
A flag used to indicate that this node is uninitialised. Used to lazily load child components. Typically checked in DefaultMutableTreeNode.getChildCount() and set accordingly.

Constructor Detail

TreeNode

public TreeNode()
Creates a tree node that has no parent and no children, but which allows children.


TreeNode

public TreeNode(S userObject)
Creates a tree node with no parent, no children, but which allows children, and initialises it with the specified user object.

Parameters:
userObject - The underlying object represented by this node.

TreeNode

public TreeNode(S userObject,
                boolean allowsChildren)
Creates a tree node with no parent, no children, initialised with the specified user object, and that allows children only if specified.

Parameters:
userObject - The underlying object represented by this node.
allowsChildren - Indicates whether this node allows children or not.
Method Detail

getUserObject

public S getUserObject()
Returns the underlying data object represented by this node.

Overrides:
getUserObject in class DefaultMutableTreeNode

setUserObject

public void setUserObject(Object userObject)
                   throws IllegalArgumentException
Sets the underlying data object represented by this node.

Specified by:
setUserObject in interface MutableTreeNode
Overrides:
setUserObject in class DefaultMutableTreeNode
Parameters:
userObject - The data object to represent.
Throws:
IllegalArgumentException - If the specified userObject does not match the type for this node.

SPT Core API