SPT Core API

com.sptci.echo.tree
Class TreeNode<M>

java.lang.Object
  extended by echopoint.tree.DefaultMutableTreeNode<M>
      extended by com.sptci.echo.tree.TreeNode<M>
All Implemented Interfaces:
MutableTreeNode<M>, TreeNode, Serializable
Direct Known Subclasses:
FileSystemTreeNode

public class TreeNode<M>
extends DefaultMutableTreeNode<M>

A tree node that maintains a initialised flag to enable lazy loading of child nodes.

© Copyright 2009 Sans Pareil Technologies, Inc.

Version:
$Id: TreeNode.java 4856 2009-08-11 15:22:46Z rakesh $
Author:
Rakesh Vidyadharan 2009-06-03
See Also:
Serialized Form

Field Summary
protected  boolean initialised
          A flag used to indicate that this node is un-initialised.
 
Fields inherited from class echopoint.tree.DefaultMutableTreeNode
actionCommand, allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
TreeNode()
          Default constructor.
TreeNode(M model)
          Create a new tree node with the specified model object backing it.
TreeNode(M model, boolean allowsChildren)
          Create a new node with the specified model and flag indicating whether the node allows children.
 
Method Summary
 boolean isLeaf()
          Over-ridden to always return false.
 
Methods inherited from class echopoint.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, getUserObject, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setActionCommand, setAllowsChildren, setParent, setUserObject, 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 un-initialised. Used to lazily load child components. Typically checked in DefaultMutableTreeNode.getChildCount() and set accordingly. Default to false.

Constructor Detail

TreeNode

public TreeNode()
Default constructor. No special actions required.


TreeNode

public TreeNode(M model)
Create a new tree node with the specified model object backing it.

Parameters:
model - The model object backing the node.

TreeNode

public TreeNode(M model,
                boolean allowsChildren)
Create a new node with the specified model and flag indicating whether the node allows children.

Parameters:
model - The model object backing the node.
allowsChildren - A flag indiciating whether the node allows children.
Method Detail

isLeaf

public boolean isLeaf()
Over-ridden to always return false. This enables lazy loading of the children of nodes.

Specified by:
isLeaf in interface TreeNode
Overrides:
isLeaf in class DefaultMutableTreeNode<M>

SPT Core API