public class EntityTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel
| Red (johnr) |
| Red (eal) |
| Modifier and Type | Class and Description |
|---|---|
class |
EntityTreeModel.TreeUpdateListener
A ChangeListener that updates the Tree.
|
| Modifier and Type | Field and Description |
|---|---|
protected NamedObj |
_root
The root of the tree.
|
| Constructor and Description |
|---|
EntityTreeModel(NamedObj root)
Create a new tree model with the specified root.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener listener)
Add a listener to this model.
|
java.lang.Object |
getChild(java.lang.Object parent,
int index)
Get the child of the given parent at the given index.
|
int |
getChildCount(java.lang.Object parent)
Return the number of children of the given parent, which in
this base class is the number of contained entities.
|
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
Return the index of the given child within the given parent.
|
java.lang.Object |
getRoot()
Get the root of this tree model.
|
boolean |
isLeaf(java.lang.Object object)
Return true if the object is a leaf node.
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener listener)
Remove the specified listener.
|
void |
setRoot(NamedObj root)
Set the object that this treemodel looks at.
|
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
Notify listeners that the object at the given path has changed.
|
protected NamedObj _root
public EntityTreeModel(NamedObj root)
root - The root of the tree.public void addTreeModelListener(javax.swing.event.TreeModelListener listener)
addTreeModelListener in interface javax.swing.tree.TreeModellistener - The listener to add.removeTreeModelListener(TreeModelListener)public java.lang.Object getChild(java.lang.Object parent,
int index)
getChild in interface javax.swing.tree.TreeModelparent - A node in the tree.index - The index of the desired child.public int getChildCount(java.lang.Object parent)
getChildCount in interface javax.swing.tree.TreeModelparent - A parent node.public int getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
getIndexOfChild in interface javax.swing.tree.TreeModelparent - The parent, which is usually a CompositeEntity.child - The child.public java.lang.Object getRoot()
getRoot in interface javax.swing.tree.TreeModelsetRoot(NamedObj)public boolean isLeaf(java.lang.Object object)
isLeaf in interface javax.swing.tree.TreeModelobject - The object in question.public void setRoot(NamedObj root)
root - The root NamedObj. BasicGraphFrame.dispose() calls
this method and passes null as the value of root.getRoot()public void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
removeTreeModelListener in interface javax.swing.tree.TreeModellistener - The listener to remove.addTreeModelListener(TreeModelListener)public void valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
valueForPathChanged in interface javax.swing.tree.TreeModelpath - The path of the node that has changed.newValue - The new value of the node.