public class CompositeTreeModel extends EntityTreeModel
The indexes of the attributes are 0 to a-1, where a is the number of attributes. The indexes of the ports are a to a+p-1, where p is the number of ports, and so on. Subclasses may return a subset of the attributes, ports, and relations by overriding the protected methods that list these contained objects.
EntityTreeModel.TreeUpdateListener
_root
Constructor and Description |
---|
CompositeTreeModel(CompositeEntity root)
Create a new tree model with the specified root.
|
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
isLeaf(java.lang.Object object)
Return true if the object is a leaf node.
|
addTreeModelListener, getRoot, removeTreeModelListener, setRoot, valueForPathChanged
public CompositeTreeModel(CompositeEntity root)
root
- The root of the tree.public java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in interface javax.swing.tree.TreeModel
getChild
in class EntityTreeModel
parent
- 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.TreeModel
getChildCount
in class EntityTreeModel
parent
- A parent node.public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
getIndexOfChild
in class EntityTreeModel
parent
- The parent, which is usually a CompositeEntity.child
- The child.public boolean isLeaf(java.lang.Object object)
isLeaf
in interface javax.swing.tree.TreeModel
isLeaf
in class EntityTreeModel
object
- The object in question.