TreeNode Class

TreeNode Class

This Package | All Packages

public class TreeNode

Encapsulates a node in a TreeView control.

Methods
Name Description
addAfter(Object obj) Inserts the specified object after the current node.
addBefore(Object obj) Inserts the specified object above the current node.
addChild(Object obj) Inserts the specified object as a child of the current node.
collapse(boolean recursive) Collapses the current node.
expand(boolean recursive) Expands the current node to display its child nodes.
getChild(int ix) Retrieves the child node that corresponds to the specified index.
getChildCount() Retrieves the number of the current node's children.
getChildren() Retrieves the children of the current node in an array of TreeNode objects.
getExpanded() Retrieves a boolean value that indicates whether the current node is expanded.
getFirstChild() Retrieves the first child node of the current node.
getHandle() Retrieves the HTREEITEM for this TreeView node.
getLastChild() Retrieves the last child node of the current node.
getLevel() Retrieves the level of the current node in the TreeView heirarchy.
getNext() Retrieves the next node in the current node heirarchy.
getObject() Retrieves an object for the current node.
getParent() Retrieves the parent of the current node.
getPrev() Retrieves the previous node in the current node heirarchy.
getSelected() Retrieves a boolean value that indicates whether the current node is selected.
getSorted() Retrieves a boolean value that indicates whether the children of the current node are sorted.
getTreeView() Retrieves the TreeView control to which this node belongs.
getVisible() Retrieves a boolean value that indicates whether the current node is visible.
remove() Removes the current node.
select() Selects the current node.
setObject(Object value) Topic under construction.
setParent(TreeNode value) Sets the current node's parent.
setSorted(boolean value) Specifies whether the children of the current tree node should be sorted.
setVisible() Makes the current node visible.
toString() Topic under construction.

Methods

TreeNode.addAfter

Syntax
public TreeNode addAfter( Object obj );
Parameters
obj
The object to insert after the current node.
Return Value

Returns a TreeNode for the newly inserted node.

Description

Inserts the specified object after the current node. If the current node is null, the object is inserted as the first child.

TreeNode.addBefore

Syntax
public TreeNode addBefore( Object obj );
Parameters
obj
The object to insert before the current node.
Return Value

Returns a TreeNode object for the newly inserted node.

Description

Inserts the specified object above the current node.

TreeNode.addChild

Syntax
public TreeNode addChild( Object obj );
Parameters
obj
The object to insert as a child of the current node.
Return Value

Returns a TreeNode object for the newly inserted node.

Description

Inserts the specified object as a child of the current node.

TreeNode.collapse

Syntax
public void collapse( boolean recursive );
Parameters
recursive.
If true, all of the subtrees of the current node are collapsed. Otherwise, only the first level in the heirarchy is collapsed.
Description

Collapses the current node.

TreeNode.expand

Syntax
public void expand( boolean recursive );
Parameters
recursive
If true, the TreeNode object displays all the children of the current node, and their children, and their children, and so on. Otherwise, only the first level of the child heirarchy is displayed.
Description

Expands the current node to display its child nodes.

TreeNode.getChild

Syntax
public TreeNode getChild( int ix );
Parameters
ix
The zero-based index of the child to return.
Return Value

Returns the TreeNode at the specified index.

Description

Retrieves the child node that corresponds to the specified index.

TreeNode.getChildCount

Syntax
public int getChildCount();
Return Value

Returns an integer that identifies the number of child nodes.

Description

Retrieves the number of the current node's children.

TreeNode.getChildren

Syntax
public TreeNode[] getChildren();
Return Value

Returns an array of TreeNode objects that contains the children of the current node.

Description

Retrieves the children of the current node in an array of TreeNode objects.

TreeNode.getExpanded

Syntax
public boolean getExpanded();
Return Value

Returns true if the current node is expanded; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the current node is expanded.

TreeNode.getFirstChild

Syntax
public TreeNode getFirstChild();
Return Value

Returns the TreeNode for the first child node.

Description

Retrieves the first child node of the current node.

TreeNode.getHandle

Syntax
public int getHandle();
Return Value

Returns an integer that represents the HTREEITEM.

Description

Retrieves the HTREEITEM for this TreeView node.

TreeNode.getLastChild

Syntax
public TreeNode getLastChild();
Return Value

Returns the TreeNode for the last child node.

Description

Retrieves the last child node of the current node.

TreeNode.getLevel

Syntax
public int getLevel();
Return Value

Returns an integer that identifies the current node's level.

Description

Retrieves the level of the current node in the TreeView heirarchy.

TreeNode.getNext

Syntax
public TreeNode getNext();
Return Value

Returns the next TreeNode in the heirarchy.

Description

Retrieves the next node in the current node heirarchy.

TreeNode.getObject

Syntax
public Object getObject();
Return Value

Returns the object.

Description

Retrieves an object for the current node.

TreeNode.getParent

Syntax
public TreeNode getParent();
Return Value

Returns the TreeNode for the parent of the current node.

Description

Retrieves the parent of the current node.

TreeNode.getPrev

Syntax
public TreeNode getPrev();
Return Value

Returns the previous TreeNode in the heirarchy.

Description

Retrieves the previous node in the current node heirarchy.

TreeNode.getSelected

Syntax
public boolean getSelected();
Return Value

Returns true if the current node is selected; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the current node is selected.

TreeNode.getSorted

Syntax
public boolean getSorted();
Return Value

Returns true if the children are sorted; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the children of the current node are sorted.

TreeNode.getTreeView

Syntax
public TreeView getTreeView();
Return Value

Returns the TreeView control.

Description

Retrieves the TreeView control to which this node belongs.

TreeNode.getVisible

Syntax
public boolean getVisible();
Return Value

Returns true if the current node is visible; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the current node is visible.

TreeNode.remove

Syntax
public void remove();
Description

Removes the current node.

TreeNode.select

Syntax
public void select();
Description

Selects the current node.

TreeNode.setObject

Syntax
public void setObject( Object value );
Description

Topic under construction.

TreeNode.setParent

Syntax
public void setParent( TreeNode value );
Parameters
value
the TreeNode to set as the current node's parent.
Description

Sets the current node's parent.

TreeNode.setSorted

Syntax
public void setSorted( boolean value );
Parameters
value
A boolean value that indicates whether the tree node's children should be sorted.
Description

Specifies whether the children of the current tree node should be sorted.

TreeNode.setVisible

Syntax
public void setVisible();
Description

Makes the current node visible.

TreeNode.toString

Syntax
public String toString();
Description

Topic under construction.