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.StringNOT_SELECTEDNo nodes in a subtree are selected.static java.lang.StringPARTIALLY_SELECTEDSome nodes in a subtree are selected, and some are not.static java.lang.StringSELECTEDAll nodes in a subtree are selected.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddChild(int index, TreeNode child)Add a child node at a specified position in the list of children.voidaddChild(TreeNode child)Add a child node.java.lang.Iterable<TreeNode>getChildren()Get the children of this node.java.lang.StringgetDescription()Get extra text associated with this node.java.lang.ObjectgetImageSource()Get the source of the node icon.TreeNodegetParent()Get the node's parent.TreePathgetPath()Get the path from the root node to this node.java.lang.StringgetText()Get the text of this node.WWTexturegetTexture()Get the texture loaded for the node's icon.booleanhasImage()Does this node have an icon? This method returns true if an image source has been set.booleanisEnabled()Is the node enabled?booleanisLeaf()Is the node a leaf node.booleanisSelected()Is the node selected?java.lang.StringisTreeSelected()Is any part of the sub-tree rooted at this node selected?booleanisVisible()Is the node visible?voidremoveAllChildren()Remove all of the child nodes from this node.voidremoveChild(TreeNode child)Remove a child node.voidsetDescription(java.lang.String description)Set the node description.voidsetEnabled(boolean enabled)Set the node to enabled or not enabled.voidsetImageSource(java.lang.Object imageSource)Set the node's icon.voidsetParent(TreeNode node)Set the parent node.voidsetSelected(boolean selected)Set the node to selected or not selected.voidsetVisible(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
nullif 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.IndexOutOfBoundsExceptionAdd 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- ifindexis 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.
nullif 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.
-
-