NASA World Wind

gov.nasa.worldwind.util.tree
Interface TreeNode

All Superinterfaces:
AVList, EventListener, MessageListener, PropertyChangeListener, WWObject
All Known Implementing Classes:
BasicTreeNode, KMLContainerTreeNode, KMLFeatureTreeNode, KMLLayerTreeNode, KMLNetworkLinkTreeNode, LayerTreeNode

public interface TreeNode
extends WWObject

Describes a node in a Tree. A node must have a string of text. It may also have an icon.

See Also:
TreeModel

Field Summary
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.
 
Method Summary
 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.
 
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 java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
 

Field Detail

NOT_SELECTED

static final String NOT_SELECTED
No nodes in a subtree are selected.

See Also:
Constant Field Values

PARTIALLY_SELECTED

static final String PARTIALLY_SELECTED
Some nodes in a subtree are selected, and some are not.

See Also:
Constant Field Values

SELECTED

static final String SELECTED
All nodes in a subtree are selected.

See Also:
Constant Field Values
Method Detail

addChild

void addChild(int index,
              TreeNode child)
              throws 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:
IndexOutOfBoundsException - if index is less than zero or greater than the number of children already in the list.

addChild

void addChild(TreeNode child)
Add a child node.

Parameters:
child - New child.

getChildren

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)

getDescription

String getDescription()
Get extra text associated with this node.

Returns:
Description of node.

getImageSource

Object getImageSource()
Get the source of the node icon.

Returns:
Image source of the icon. null if the node does not have an icon.

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 is null.

Returns:
Parent node, or null if this the root node.
See Also:
setParent(TreeNode)

getPath

TreePath getPath()
Get the path from the root node to this node.

Returns:
Tree path to this node.

getText

String getText()
Get the text of this node.

Returns:
Node text.

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.

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.

isEnabled

boolean isEnabled()
Is the node enabled?

Returns:
True if the node is enabled.
See Also:
setEnabled(boolean)

isLeaf

boolean isLeaf()
Is the node a leaf node.

Returns:
True if this is a leaf node.

isSelected

boolean isSelected()
Is the node selected?

Returns:
True if the node is selected.
See Also:
setSelected(boolean), isTreeSelected()

isTreeSelected

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)

removeAllChildren

void removeAllChildren()
Remove all of the child nodes from this node.


removeChild

void removeChild(TreeNode child)
Remove a child node.

Parameters:
child - Child to remove.

setDescription

void setDescription(String description)
Set the node description. The description can hold any extra text associated with the node.

Parameters:
description - New description.

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()

setImageSource

void setImageSource(Object imageSource)
Set the node's icon.

Parameters:
imageSource - New icon source. May be a String, URL, or BufferedImage.

setParent

void setParent(TreeNode node)
Set the parent node.

Parameters:
node - New parent node.
See Also:
getParent()

setSelected

void setSelected(boolean selected)
Set the node to selected or not selected.

Parameters:
selected - New selection value.
See Also:
isSelected()

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()

NASA World Wind