Package org.eclipse.jface.viewers
Class TreeNode
java.lang.Object
org.eclipse.jface.viewers.TreeNode
A simple data structure that is useful for implemented tree models. This can
be returned by
IStructuredContentProvider.getElements(Object)
.
It allows simple delegation of methods from
ITreeContentProvider
such as
ITreeContentProvider.getChildren(Object)
,
ITreeContentProvider.getParent(Object)
and
ITreeContentProvider.hasChildren(Object)
- Since:
- 3.2
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
TreeNode[]
Returns the child nodes.Returns the parent node.getValue()
Returns the value held by this node.boolean
Returns whether the tree has any children.int
hashCode()
void
setChildren
(TreeNode[] children) Sets the children for this node.void
Sets the parent for this node.
-
Field Details
-
value
The value contained in this node. This value may be anything.
-
-
Constructor Details
-
TreeNode
Constructs a new instance ofTreeNode
.- Parameters:
value
- The value held by this node; may be anything.
-
-
Method Details
-
equals
-
getChildren
Returns the child nodes. Empty arrays are converted tonull
before being returned.- Returns:
- The child nodes; may be
null
, but never empty. There should be nonull
children in the array.
-
getParent
Returns the parent node.- Returns:
- The parent node; may be
null
if there are no parent nodes.
-
getValue
Returns the value held by this node.- Returns:
- The value; may be anything.
-
hasChildren
public boolean hasChildren()Returns whether the tree has any children.- Returns:
true
if its array of children is notnull
and is non-empty;false
otherwise.
-
hashCode
public int hashCode() -
setChildren
Sets the children for this node.- Parameters:
children
- The child nodes; may benull
or empty. There should be nonull
children in the array.
-
setParent
Sets the parent for this node.- Parameters:
parent
- The parent node; may benull
.
-