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.
|
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 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 TreeNode
TreeNode.addChild(TreeNode)
public String getDescription()
TreeNode
getDescription
in interface TreeNode
public 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 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 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(PropertyChangeEvent propertyChangeEvent)
propertyChange
in interface 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(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(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()