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.
-
o
- The object held in the Tree.
-
Tree(Object)
- Construct a Tree, with its attached Object.
-
addChild(Tree)
- Add a child.
-
deleteChild()
- Delete this item (and all its children) from the Tree.
-
depth()
- Work out the depth of the current item.
-
getFirst()
- Return the first child of this item, or null if there are no children.
-
getLast()
- Return the last child of this item, or null if there are no children.
-
getNext()
- Return the next sibling of this item, or null if there are no more siblings.
-
getParent()
- Return the parent of this item, or null if root.
-
getRoot()
- Get the root of the current item.
-
hasChildren()
- Are there any children?
-
isExpanded()
- Indicates whether children are visible in a View.
-
isFirst()
- Is this the first child of its parent?
-
isLast()
- Is this the last child of its parent?
This is useful when drawing a representation of the Tree.
-
isRoot()
- Is this the root?
-
processTree(TreeProcessor)
- Run the TreeProcessor on every item in the Tree.
-
toString()
- Standard toString method forwards to the attached Object.
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.
Tree
public Tree(Object o)
- Construct a Tree, with its attached Object.
- Parameters:
- o - the Object to attach.
hasChildren
public boolean hasChildren()
- Are there any children?
isRoot
public boolean isRoot()
- Is this the root?
isLast
public boolean isLast()
- Is this the last child of its parent?
This is useful when drawing a representation of the Tree.
isFirst
public boolean isFirst()
- Is this the first child of its parent?
getParent
public Tree getParent()
- Return the parent of this item, or null if root.
getFirst
public Tree getFirst()
- Return the first child of this item, or null if there are no children.
getLast
public Tree getLast()
- Return the last child of this item, or null if there are no children.
getNext
public Tree getNext()
- Return the next sibling of this item, or null if there are no more siblings.
isExpanded
public boolean isExpanded()
- Indicates whether children are visible in a View.
depth
public int depth()
- Work out the depth of the current item.
getRoot
public Tree getRoot()
- Get the root of the current item.
addChild
public void addChild(Tree child)
- Add a child.
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.
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.
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