public class BasicTreeNode extends WWObjectImpl implements TreeNode
TreeNode.| Modifier and Type | Field and Description |
|---|---|
protected List<TreeNode> |
children |
protected String |
description |
protected boolean |
enabled |
protected Object |
imageSource |
protected TreeNode |
parent |
protected boolean |
selected |
protected String |
text |
protected BasicWWTexture |
texture |
protected 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(String text)
Create a node with text.
|
BasicTreeNode(String text,
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 String |
computeTreeSelected()
Determine if any part of the sub-tree rooted at this node is selected.
|
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.
|
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?
|
String |
isTreeSelected()
Is any part of the sub-tree rooted at this node selected?
|
boolean |
isVisible()
Is the node visible?
|
void |
propertyChange(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(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.
|
onMessageaddPropertyChangeListener, 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, setValuesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValuesonMessageprotected String description
protected boolean enabled
protected Object imageSource
protected TreeNode parent
protected boolean selected
protected String text
protected BasicWWTexture texture
protected String treeSelected
protected boolean visible
public BasicTreeNode(String text)
text - Node text.public void addChild(int index,
TreeNode child)
public void addChild(TreeNode child)
protected String computeTreeSelected()
public Iterable<TreeNode> getChildren()
getChildren in interface TreeNodeTreeNode.addChild(TreeNode)public String getDescription()
TreeNodegetDescription in interface TreeNodepublic Object getImageSource()
getImageSource in interface TreeNodenull if the node does not have an icon.public TreeNode getParent()
null.getParent in interface TreeNodenull if this the root node.TreeNode.setParent(TreeNode)public TreePath getPath()
public String getText()
public BasicWWTexture getTexture()
getTexture in interface TreeNodepublic boolean hasImage()
protected void initializeTexture()
public boolean isEnabled()
isEnabled in interface TreeNodeTreeNode.setEnabled(boolean)public boolean isLeaf()
public boolean isSelected()
isSelected in interface TreeNodeTreeNode.setSelected(boolean),
TreeNode.isTreeSelected()public String isTreeSelected()
isTreeSelected in interface TreeNodeTreeNode.SELECTED, TreeNode.NOT_SELECTED, TreeNode.PARTIALLY_SELECTED.public boolean isVisible()
isVisible in interface TreeNodeTreeNode.setVisible(boolean)public void propertyChange(PropertyChangeEvent propertyChangeEvent)
propertyChange in interface PropertyChangeListenerpropertyChange in class WWObjectImplpropertyChangeEvent - the eventpublic void removeAllChildren()
removeAllChildren in interface TreeNodepublic void removeChild(TreeNode child)
removeChild in interface TreeNodechild - Child to remove.public void setDescription(String description)
TreeNodesetDescription in interface TreeNodedescription - New description.public void setEnabled(boolean enabled)
setEnabled in interface TreeNodeenabled - New enabled state.TreeNode.isEnabled()public void setImageSource(Object imageSource)
setImageSource in interface TreeNodeimageSource - New icon source. May be a String, URL, or BufferedImage.public void setParent(TreeNode node)
setParent in interface TreeNodenode - New parent node.TreeNode.getParent()public void setSelected(boolean selected)
setSelected in interface TreeNodeselected - New selection value.TreeNode.isSelected()public void setVisible(boolean visible)
setVisible in interface TreeNodevisible - New visibility setting.TreeNode.isVisible()