jbcl.model Package
java.lang.Object +----com.borland.jbcl.model.LinkedTreeNode
Variables Constructors Properties Methods
Implements GraphLocation, Serializable
A LinkedTreeNode
object is the item container for use with LinkedTreeContainer
. It contains the properties and methods needed to function as a node on a tree.
Use the firstChild
property to find the first child node of this node and use nextSibling
to find the next node at the same level in the tree as this node. The children
property returns an array of all GraphLocations
that are children of the node.
protected int childCountA variable that holds the number of children this node has.
protected LinkedTreeNode firstChildThe
LinkedTreeNode
object that is the immediate descendant of this node.
protected LinkedTreeNode nextSiblingThe
LinkedTreeNode
object that is the next sibling of this node in the tree hierarchy.
protected LinkedTreeNode parentThe
LinkedTreeNode
object that is the parent of this node.
public LinkedTreeNode()Constructs a
LinkedTreeNode
object with default property values, and with the current object as its parent
.
public LinkedTreeNode(LinkedTreeNode parent)Constructs a
LinkedTreeNode
object as a child of the node passed as the parent
argument. If parent
is null, the new node is the root of the tree.
Parameters:
parent
public Enumeration getChildIterator()Returns an iterator over the children of this node.
public GraphLocation[] getChildren()Returns the children of this node.
public LinkedTreeNode getFirstChild()Returns the first child of this node.
public LinkedTreeNode getNextSibling()Returns the next sibling of this node.
public GraphLocation getParent()Returns the parent of this node.
public void appendChild(LinkedTreeNode newChild)Adds a node at the end of the chain of children of this node.
Parameters:
newChild
public void check()A method that checks the validity of the position of the node in the tree. If the node is not the parent of its designated children, an
IllegalStateException
is thrown. Also, if the first child node is equal to that node's next sibling, an IllegalStateException
is thrown. This method is intended as a debugging aid.
protected void doAddChild(LinkedTreeNode newChild, LinkedTreeNode aheadOf)Adds a new node to the node chain.
doAddChild()
is called by the appendChild()
and the insertChild()
methods.
Parameters:
newChild
aheadOf
aheadOf
is null if the node is being appended to the end of the node chain.
public void insertChild(LinkedTreeNode newChild)Adds a node chain in front of the first child of this node. The inserted node becomes the first child.
Parameters:
newChild
public void insertChild(LinkedTreeNode newChild, LinkedTreeNode aheadOf)Inserts a node in this node's child chain. The node is added in front of the specified child of this node.
Parameters:
newChild
aheadOf
public void insertSibling(LinkedTreeNode newSibling)Inserts a node chain in front of the first sibling of this node.
Parameters:
newSibling
public void print()Prints the node chain beginning at the root. This method is intended as a debugging aid.
public void print(int level)Prints all nodes at the specified level and all their children. This method is intended as a debugging aid.
public void removeChild(LinkedTreeNode unwantedChild)Removes a single child from this node's chain of children.
Parameters:
unwantedChild
public LinkedTreeNode removeNode(LinkedTreeNode root)Removes this node from its tree, returning the root node. The root node is passed to this method as removing this node from the tree might require an adjustment to the root node. So the root node returned might differ from the one passed to the method.
Parameters:
root
protected void setParent(LinkedTreeNode parent)Sets this node's parent node.
Parameters:
parent