|
ElegantJ Trees Java API Specification v1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.elegantj.awt.tree.AWTTreeNode
AWTTreeNode class provides the data structure of the node of the AWTTree
| Field Summary | |
protected boolean |
allowsChildren
|
protected java.util.Vector |
children
|
static java.util.Enumeration |
EMPTY_ENUMERATION
|
protected AWTTreeNode |
parent
|
protected java.lang.Object |
userObject
|
| Constructor Summary | |
AWTTreeNode()
Default constructor for the AWTTreeNode |
|
AWTTreeNode(java.lang.Object userObject)
Constructs the AWTTreeNode with the specified userObject |
|
AWTTreeNode(java.lang.Object userObject,
boolean allowsChildren)
Constructs the AWTTreeNode with the specified userObject and the wheather childrens allowed or not |
|
| Method Summary | |
void |
add(AWTTreeNode newChild)
Adds the specified newChild to the node |
java.util.Enumeration |
breadthFirstEnumeration()
Creates and returns an enumeration that traverses the subtree rooted at this node in breadth-first order. |
java.util.Enumeration |
children()
Returns the Enumeration of the childrens |
java.lang.Object |
clone()
Overridden to make clone public. |
java.util.Enumeration |
depthFirstEnumeration()
Creates and returns an enumeration that traverses the subtree rooted at this node in depth-first order. |
boolean |
getAllowsChildren()
Returns the wheather childrens are allowed or not |
AWTTreeNode |
getChildAfter(AWTTreeNode aChild)
Returns the child in this node's child array that immediately follows aChild, which must be a child of this node. |
AWTTreeNode |
getChildAt(int index)
Returns the child at the specified index |
AWTTreeNode |
getChildBefore(AWTTreeNode aChild)
Returns the child in this node's child array that immediately precedes aChild, which must be a child of this node. |
int |
getChildCount()
Returns the total child of the node |
int |
getDepth()
Returns the depth of the tree rooted at this node the longest distance from this node to a leaf, If this node has no children, returns 0 |
AWTTreeNode |
getFirstChild()
Returns this node's first child. |
AWTTreeNode |
getFirstLeaf()
Finds and returns the first leaf that is a descendant of this node either this node or its first child's first leaf. |
int |
getIndex(AWTTreeNode aChild)
Returns the index of the specified AWTTreeNode |
AWTTreeNode |
getLastChild()
Returns this node's last child. |
AWTTreeNode |
getLastLeaf()
Finds and returns the last leaf that is a descendant of this node either this node or its last child's last leaf. |
int |
getLeafCount()
Returns the total number of leaves that are descendants of this node. |
int |
getLevel()
Returns the number of levels above this node the distance from the root to this node. |
AWTTreeNode |
getNextLeaf()
Returns the leaf after this node or null if this node is the last leaf in the tree. |
AWTTreeNode |
getNextNode()
Returns the node that follows this node in a preorder traversal of this node's tree. |
AWTTreeNode |
getNextSibling()
Returns the next sibling of this node in the parent's children array. |
AWTTreeNode |
getParent()
Returns the parent of the node |
AWTTreeNode[] |
getPath()
Returns the path from the root, to get to this node. |
protected AWTTreeNode[] |
getPathToRoot(AWTTreeNode aNode,
int depth)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. |
AWTTreeNode |
getPreviousLeaf()
Returns the leaf before this node or null if this node is the first leaf in the tree. |
AWTTreeNode |
getPreviousNode()
Returns the node that precedes this node in a preorder traversal of this node's tree. |
AWTTreeNode |
getPreviousSibling()
Returns the previous sibling of this node in the parent's children array. |
AWTTreeNode |
getRoot()
Returns the root of the node |
AWTTreeNode |
getSharedAncestor(AWTTreeNode aNode)
Returns the nearest common ancestor to this node and aNode Returns null, if no such ancestor exists if this node and aNode are in different trees or if aNode is null. |
int |
getSiblingCount()
Returns the number of siblings of this node. |
java.lang.Object |
getUserObject()
Returns the user object of the node |
java.lang.Object[] |
getUserObjectPath()
Returns the user object path, from the root, to get to this node. |
void |
insert(AWTTreeNode newChild,
int childIndex)
Inserts the new child at the specified child index |
boolean |
isExpanded()
Returns the node is expanded or collapsed |
boolean |
isLeaf()
Returns true if this node has no children. |
boolean |
isNodeAncestor(AWTTreeNode anotherNode)
Returns true if anotherNode is an ancestor of this node if it is this node, this node's parent, or an ancestor of this node's parent |
boolean |
isNodeChild(AWTTreeNode aNode)
Returns true if aNode is a child of this node. |
boolean |
isNodeDescendant(AWTTreeNode anotherNode)
Returns true if anotherNode is a descendant of this node if it is this node, one of this node's children, or a descendant of one of this node's children |
boolean |
isNodeRelated(AWTTreeNode aNode)
Returns true if and only if aNode is in the same tree as this node. |
boolean |
isNodeSibling(AWTTreeNode anotherNode)
Returns true if anotherNode is a sibling of (has the same parent as) this node. |
boolean |
isRoot()
Returns true if the node is the root else returns the false |
boolean |
isSelected()
Returns the node is selected or not |
boolean |
isVisible()
Returns the node is visible or not |
java.util.Enumeration |
pathFromAncestorEnumeration(AWTTreeNode ancestor)
Creates and returns an enumeration that follows the path from ancestor to this node. |
java.util.Enumeration |
postorderEnumeration()
Creates and returns an enumeration that traverses the subtree rooted at this node in postorder. |
java.util.Enumeration |
preorderEnumeration()
Creates and returns an enumeration that traverses the subtree rooted at this node in preorder The first node returned by the enumeration's nextElement() method is this node Modifying the tree by inserting, removing, or moving a node invalidates any enumerations created before the modification. |
void |
remove(AWTTreeNode aChild)
Removes the specified node from it's |
void |
remove(int childIndex)
Removes the node at the child index |
void |
removeAllChildren()
Removes the all childrens |
void |
removeFromParent()
Removes the node from it's parent |
void |
setAllowsChildren(boolean allows)
Sets the wheather childrens are allowed or not |
void |
setParent(AWTTreeNode newParent)
Sets the patent to the new specified parent |
void |
setUserObject(java.lang.Object userObject)
Sets the user object for the node |
java.lang.String |
toString()
Returns the result of sending toString() to this node's user object, or null if this node has no user object. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.util.Enumeration EMPTY_ENUMERATION
protected AWTTreeNode parent
protected java.util.Vector children
protected transient java.lang.Object userObject
protected boolean allowsChildren
| Constructor Detail |
public AWTTreeNode()
public AWTTreeNode(java.lang.Object userObject)
userObject - The specified object
public AWTTreeNode(java.lang.Object userObject,
boolean allowsChildren)
userObject - The specified userObject
allowsChildren wheather the childrens are allowed or not| Method Detail |
public void insert(AWTTreeNode newChild,
int childIndex)
newChild - The AWTTreeNodechildIndex - The specified child indexpublic void remove(int childIndex)
childIndex - The specified child indexpublic void setParent(AWTTreeNode newParent)
newParent - The AWTTreeNode which is new parentpublic AWTTreeNode getParent()
public AWTTreeNode getChildAt(int index)
index - The specified index
public int getChildCount()
public int getIndex(AWTTreeNode aChild)
aChild - The specified nodepublic java.util.Enumeration children()
public void setAllowsChildren(boolean allows)
allows - The wheather childrens are allowed or notpublic boolean getAllowsChildren()
public void setUserObject(java.lang.Object userObject)
userObject - The user object for the nodepublic java.lang.Object getUserObject()
public boolean isExpanded()
public boolean isVisible()
public boolean isSelected()
public void removeFromParent()
public void remove(AWTTreeNode aChild)
aChild - The specified nodepublic void removeAllChildren()
public void add(AWTTreeNode newChild)
newChild - The specified child nodepublic boolean isNodeAncestor(AWTTreeNode anotherNode)
anotherNode - node to test as an ancestor of this node
public boolean isNodeDescendant(AWTTreeNode anotherNode)
anotherNode - node to test as descendant of this node
public AWTTreeNode getSharedAncestor(AWTTreeNode aNode)
aNode - node to find common ancestor with
public boolean isNodeRelated(AWTTreeNode aNode)
public int getDepth()
public int getLevel()
public AWTTreeNode[] getPath()
protected AWTTreeNode[] getPathToRoot(AWTTreeNode aNode,
int depth)
aNode - the AWTTreeNode to get the path fordepth - an int giving the number of steps already taken towards
the root (on recursive calls), used to size the returned array
public java.lang.Object[] getUserObjectPath()
public AWTTreeNode getRoot()
public boolean isRoot()
public AWTTreeNode getNextNode()
public AWTTreeNode getPreviousNode()
public java.util.Enumeration preorderEnumeration()
public java.util.Enumeration postorderEnumeration()
public java.util.Enumeration breadthFirstEnumeration()
public java.util.Enumeration depthFirstEnumeration()
public java.util.Enumeration pathFromAncestorEnumeration(AWTTreeNode ancestor)
public boolean isNodeChild(AWTTreeNode aNode)
public AWTTreeNode getFirstChild()
java.util.NoSuchElementException - if this node has no childrenpublic AWTTreeNode getLastChild()
java.util.NoSuchElementException - if this node has no childrenpublic AWTTreeNode getChildAfter(AWTTreeNode aChild)
java.lang.IllegalArgumentException - if aChild is
null or is not a child of this nodepublic AWTTreeNode getChildBefore(AWTTreeNode aChild)
java.lang.IllegalArgumentException - if aChild is null
or is not a child of this nodepublic boolean isNodeSibling(AWTTreeNode anotherNode)
anotherNode - node to test as sibling of this node
public int getSiblingCount()
public AWTTreeNode getNextSibling()
public AWTTreeNode getPreviousSibling()
public boolean isLeaf()
public AWTTreeNode getFirstLeaf()
public AWTTreeNode getLastLeaf()
public AWTTreeNode getNextLeaf()
public AWTTreeNode getPreviousLeaf()
public int getLeafCount()
public java.lang.String toString()
public java.lang.Object clone()
|
ElegantJ Trees Java API Specification v1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||