public class BasicTreeNode extends WWObjectImpl implements TreeNode
TreeNode
.Modifier and Type | Field and Description |
---|---|
protected java.util.List<TreeNode> |
children |
protected java.lang.String |
description |
protected boolean |
enabled |
protected java.lang.Object |
imageSource |
protected TreeNode |
parent |
protected boolean |
selected |
protected java.lang.String |
text |
protected BasicWWTexture |
texture |
protected java.lang.String |
treeSelected
Flag to indicate that any part of the sub-tree rooted at this node is selected.
|
protected boolean |
visible |
NOT_SELECTED, PARTIALLY_SELECTED, SELECTED
Constructor and Description |
---|
BasicTreeNode(java.lang.String text)
Create a node with text.
|
BasicTreeNode(java.lang.String text,
java.lang.Object imageSource)
Create a node with text and an icon.
|
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.
|
protected java.lang.String |
computeTreeSelected()
Determine if any part of the sub-tree rooted at this node is selected.
|
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.
|
BasicWWTexture |
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.
|
protected void |
initializeTexture()
Create and initialize the texture from the image source.
|
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 |
propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
The property change listener for this instance.
|
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.
|
onMessage
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
protected java.util.List<TreeNode> children
protected java.lang.String description
protected boolean enabled
protected java.lang.Object imageSource
protected TreeNode parent
protected boolean selected
protected java.lang.String text
protected BasicWWTexture texture
protected java.lang.String treeSelected
protected boolean visible
public BasicTreeNode(java.lang.String text)
text
- Node text.public BasicTreeNode(java.lang.String text, java.lang.Object imageSource)
text
- Node text.imageSource
- Image source for the node icon. May be a String, URL, or BufferedImage.public void addChild(int index, TreeNode child)
public void addChild(TreeNode child)
protected java.lang.String computeTreeSelected()
public java.lang.Iterable<TreeNode> getChildren()
getChildren
in interface TreeNode
TreeNode.addChild(TreeNode)
public java.lang.String getDescription()
TreeNode
getDescription
in interface TreeNode
public java.lang.Object getImageSource()
getImageSource
in interface TreeNode
null
if the node does not have an icon.public TreeNode getParent()
null
.getParent
in interface TreeNode
null
if this the root node.TreeNode.setParent(TreeNode)
public TreePath getPath()
public java.lang.String getText()
public BasicWWTexture getTexture()
getTexture
in interface TreeNode
public boolean hasImage()
protected void initializeTexture()
public boolean isEnabled()
isEnabled
in interface TreeNode
TreeNode.setEnabled(boolean)
public boolean isLeaf()
public boolean isSelected()
isSelected
in interface TreeNode
TreeNode.setSelected(boolean)
,
TreeNode.isTreeSelected()
public java.lang.String isTreeSelected()
isTreeSelected
in interface TreeNode
TreeNode.SELECTED
, TreeNode.NOT_SELECTED
, TreeNode.PARTIALLY_SELECTED
.public boolean isVisible()
isVisible
in interface TreeNode
TreeNode.setVisible(boolean)
public void propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class WWObjectImpl
propertyChangeEvent
- the eventpublic void removeAllChildren()
removeAllChildren
in interface TreeNode
public void removeChild(TreeNode child)
removeChild
in interface TreeNode
child
- Child to remove.public void setDescription(java.lang.String description)
TreeNode
setDescription
in interface TreeNode
description
- New description.public void setEnabled(boolean enabled)
setEnabled
in interface TreeNode
enabled
- New enabled state.TreeNode.isEnabled()
public void setImageSource(java.lang.Object imageSource)
setImageSource
in interface TreeNode
imageSource
- New icon source. May be a String, URL, or BufferedImage.public void setParent(TreeNode node)
setParent
in interface TreeNode
node
- New parent node.TreeNode.getParent()
public void setSelected(boolean selected)
setSelected
in interface TreeNode
selected
- New selection value.TreeNode.isSelected()
public void setVisible(boolean visible)
setVisible
in interface TreeNode
visible
- New visibility setting.TreeNode.isVisible()