public interface TreeNode extends WWObject
Tree
. A node must have a string of text. It may also have an icon.TreeModel
Modifier and Type | Field and Description |
---|---|
static String |
NOT_SELECTED
No nodes in a subtree are selected.
|
static String |
PARTIALLY_SELECTED
Some nodes in a subtree are selected, and some are not.
|
static String |
SELECTED
All nodes in a subtree are selected.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(int index,
TreeNode child)
Add a child node at a specified position in the list of children.
|
void |
addChild(TreeNode child)
Add a child node.
|
Iterable<TreeNode> |
getChildren()
Get the children of this node.
|
String |
getDescription()
Get extra text associated with this node.
|
Object |
getImageSource()
Get the source of the node icon.
|
TreeNode |
getParent()
Get the node's parent.
|
TreePath |
getPath()
Get the path from the root node to this node.
|
String |
getText()
Get the text of this node.
|
WWTexture |
getTexture()
Get the texture loaded for the node's icon.
|
boolean |
hasImage()
Does this node have an icon? This method returns true if an image source has been set.
|
boolean |
isEnabled()
Is the node enabled?
|
boolean |
isLeaf()
Is the node a leaf node.
|
boolean |
isSelected()
Is the node selected?
|
String |
isTreeSelected()
Is any part of the sub-tree rooted at this node selected?
|
boolean |
isVisible()
Is the node visible?
|
void |
removeAllChildren()
Remove all of the child nodes from this node.
|
void |
removeChild(TreeNode child)
Remove a child node.
|
void |
setDescription(String description)
Set the node description.
|
void |
setEnabled(boolean enabled)
Set the node to enabled or not enabled.
|
void |
setImageSource(Object imageSource)
Set the node's icon.
|
void |
setParent(TreeNode node)
Set the parent node.
|
void |
setSelected(boolean selected)
Set the node to selected or not selected.
|
void |
setVisible(boolean visible)
Set the node to visible or not visible.
|
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
propertyChange
onMessage
static final String NOT_SELECTED
static final String PARTIALLY_SELECTED
static final String SELECTED
void addChild(int index, TreeNode child) throws IndexOutOfBoundsException
index
- Index at which the new child will be inserted.child
- New child.IndexOutOfBoundsException
- if index
is less than zero or greater than the number of children
already in the list.void addChild(TreeNode child)
child
- New child.Iterable<TreeNode> getChildren()
addChild(TreeNode)
String getDescription()
Object getImageSource()
null
if the node does not have an icon.TreeNode getParent()
null
.null
if this the root node.setParent(TreeNode)
TreePath getPath()
String getText()
WWTexture getTexture()
boolean hasImage()
boolean isEnabled()
setEnabled(boolean)
boolean isLeaf()
boolean isSelected()
setSelected(boolean)
,
isTreeSelected()
String isTreeSelected()
SELECTED
, NOT_SELECTED
, PARTIALLY_SELECTED
.boolean isVisible()
setVisible(boolean)
void removeAllChildren()
void removeChild(TreeNode child)
child
- Child to remove.void setDescription(String description)
description
- New description.void setEnabled(boolean enabled)
enabled
- New enabled state.isEnabled()
void setImageSource(Object imageSource)
imageSource
- New icon source. May be a String, URL, or BufferedImage.void setParent(TreeNode node)
node
- New parent node.getParent()
void setSelected(boolean selected)
selected
- New selection value.isSelected()
void setVisible(boolean visible)
visible
- New visibility setting.isVisible()