Package gov.nasa.worldwind.util.tree
Interface TreeNode
-
- All Superinterfaces:
AVList
,java.util.EventListener
,MessageListener
,java.beans.PropertyChangeListener
,WWObject
- All Known Implementing Classes:
BasicTreeNode
,KMLContainerTreeNode
,KMLFeatureTreeNode
,KMLLayerTreeNode
,KMLNetworkLinkTreeNode
,LayerTreeNode
public interface TreeNode extends WWObject
Describes a node in aTree
. A node must have a string of text. It may also have an icon.- See Also:
TreeModel
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NOT_SELECTED
No nodes in a subtree are selected.static java.lang.String
PARTIALLY_SELECTED
Some nodes in a subtree are selected, and some are not.static java.lang.String
SELECTED
All nodes in a subtree are selected.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.java.lang.Iterable<TreeNode>
getChildren()
Get the children of this node.java.lang.String
getDescription()
Get extra text associated with this node.java.lang.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.java.lang.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?java.lang.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(java.lang.String description)
Set the node description.void
setEnabled(boolean enabled)
Set the node to enabled or not enabled.void
setImageSource(java.lang.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.-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
SELECTED
static final java.lang.String SELECTED
All nodes in a subtree are selected.- See Also:
- Constant Field Values
-
NOT_SELECTED
static final java.lang.String NOT_SELECTED
No nodes in a subtree are selected.- See Also:
- Constant Field Values
-
PARTIALLY_SELECTED
static final java.lang.String PARTIALLY_SELECTED
Some nodes in a subtree are selected, and some are not.- See Also:
- Constant Field Values
-
-
Method Detail
-
getText
java.lang.String getText()
Get the text of this node.- Returns:
- Node text.
-
getDescription
java.lang.String getDescription()
Get extra text associated with this node.- Returns:
- Description of node.
-
setDescription
void setDescription(java.lang.String description)
Set the node description. The description can hold any extra text associated with the node.- Parameters:
description
- New description.
-
getParent
TreeNode getParent()
Get the node's parent. Each node in the tree has a parent, except for the root node. The parent of the root node isnull
.- Returns:
- Parent node, or
null
if this the root node. - See Also:
setParent(TreeNode)
-
setParent
void setParent(TreeNode node)
Set the parent node.- Parameters:
node
- New parent node.- See Also:
getParent()
-
getChildren
java.lang.Iterable<TreeNode> getChildren()
Get the children of this node.- Returns:
- Child nodes, or an empty iterator if the node does not have children.
- See Also:
addChild(TreeNode)
-
isEnabled
boolean isEnabled()
Is the node enabled?- Returns:
- True if the node is enabled.
- See Also:
setEnabled(boolean)
-
setEnabled
void setEnabled(boolean enabled)
Set the node to enabled or not enabled. A node that is not enabled will not respond to user input.- Parameters:
enabled
- New enabled state.- See Also:
isEnabled()
-
isSelected
boolean isSelected()
Is the node selected?- Returns:
- True if the node is selected.
- See Also:
setSelected(boolean)
,isTreeSelected()
-
setSelected
void setSelected(boolean selected)
Set the node to selected or not selected.- Parameters:
selected
- New selection value.- See Also:
isSelected()
-
isTreeSelected
java.lang.String isTreeSelected()
Is any part of the sub-tree rooted at this node selected?- Returns:
SELECTED
,NOT_SELECTED
,PARTIALLY_SELECTED
.
-
isVisible
boolean isVisible()
Is the node visible?- Returns:
- True if the node is visible.
- See Also:
setVisible(boolean)
-
setVisible
void setVisible(boolean visible)
Set the node to visible or not visible. If the node is not visible it will not be drawn by the tree layout.- Parameters:
visible
- New visibility setting.- See Also:
isVisible()
-
isLeaf
boolean isLeaf()
Is the node a leaf node.- Returns:
- True if this is a leaf node.
-
addChild
void addChild(TreeNode child)
Add a child node.- Parameters:
child
- New child.
-
addChild
void addChild(int index, TreeNode child) throws java.lang.IndexOutOfBoundsException
Add a child node at a specified position in the list of children.- Parameters:
index
- Index at which the new child will be inserted.child
- New child.- Throws:
java.lang.IndexOutOfBoundsException
- ifindex
is less than zero or greater than the number of children already in the list.
-
removeChild
void removeChild(TreeNode child)
Remove a child node.- Parameters:
child
- Child to remove.
-
removeAllChildren
void removeAllChildren()
Remove all of the child nodes from this node.
-
getPath
TreePath getPath()
Get the path from the root node to this node.- Returns:
- Tree path to this node.
-
getImageSource
java.lang.Object getImageSource()
Get the source of the node icon.- Returns:
- Image source of the icon.
null
if the node does not have an icon.
-
setImageSource
void setImageSource(java.lang.Object imageSource)
Set the node's icon.- Parameters:
imageSource
- New icon source. May be a String, URL, or BufferedImage.
-
hasImage
boolean hasImage()
Does this node have an icon? This method returns true if an image source has been set. The method returns true even if the image has not been fully loaded.- Returns:
- True if the node has an image.
-
getTexture
WWTexture getTexture()
Get the texture loaded for the node's icon.- Returns:
- Icon texture, or null if the texture has not been loaded yet.
-
-