All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.trumphurst.controls.Tree

java.lang.Object
   |
   +----com.trumphurst.controls.Tree

public class Tree
extends Object
Basic class to hold a tree structure.


Variable Index

 o o
The object held in the Tree.

Constructor Index

 o Tree(Object)
Construct a Tree, with its attached Object.

Method Index

 o addChild(Tree)
Add a child.
 o deleteChild()
Delete this item (and all its children) from the Tree.
 o depth()
Work out the depth of the current item.
 o getFirst()
Return the first child of this item, or null if there are no children.
 o getLast()
Return the last child of this item, or null if there are no children.
 o getNext()
Return the next sibling of this item, or null if there are no more siblings.
 o getParent()
Return the parent of this item, or null if root.
 o getRoot()
Get the root of the current item.
 o hasChildren()
Are there any children?
 o isExpanded()
Indicates whether children are visible in a View.
 o isFirst()
Is this the first child of its parent?
 o isLast()
Is this the last child of its parent? This is useful when drawing a representation of the Tree.
 o isRoot()
Is this the root?
 o processTree(TreeProcessor)
Run the TreeProcessor on every item in the Tree.
 o toString()
Standard toString method forwards to the attached Object.

Variables

 o o
 public Object o
The object held in the Tree. Note that this is public, so you can change the Object without having to change the Tree structure.

Constructors

 o Tree
 public Tree(Object o)
Construct a Tree, with its attached Object.

Parameters:
o - the Object to attach.

Methods

 o hasChildren
 public boolean hasChildren()
Are there any children?

 o isRoot
 public boolean isRoot()
Is this the root?

 o isLast
 public boolean isLast()
Is this the last child of its parent? This is useful when drawing a representation of the Tree.

 o isFirst
 public boolean isFirst()
Is this the first child of its parent?

 o getParent
 public Tree getParent()
Return the parent of this item, or null if root.

 o getFirst
 public Tree getFirst()
Return the first child of this item, or null if there are no children.

 o getLast
 public Tree getLast()
Return the last child of this item, or null if there are no children.

 o getNext
 public Tree getNext()
Return the next sibling of this item, or null if there are no more siblings.

 o isExpanded
 public boolean isExpanded()
Indicates whether children are visible in a View.

 o depth
 public int depth()
Work out the depth of the current item.

 o getRoot
 public Tree getRoot()
Get the root of the current item.

 o addChild
 public void addChild(Tree child)
Add a child.

 o deleteChild
 public boolean deleteChild()
Delete this item (and all its children) from the Tree. Note that the children of this item will still be attached to it.

Returns:
true only if this is the root.
 o processTree
 public boolean processTree(TreeProcessor p)
Run the TreeProcessor on every item in the Tree. The TreeProcessor continueProcess method is called for each item in the tree, in a depth-first search. If the continueProcess method returns false for any item, the search is stopped.

Parameters:
p - the TreeProcessor to process the items.
Returns:
false if any continueProcess returned false, true otherwise.
 o toString
 public String toString()
Standard toString method forwards to the attached Object.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index