public class TreeModel<T extends Treeable> extends AbstractTreeModel
© Copyright 2009 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected Root<T> |
root
The root model object for this tree.
|
static String |
ROOT_NAME
The default text to use as the name of
Root object. |
protected List<T> |
roots
The list of root level nodes in the tree.
|
listenerList| Constructor and Description |
|---|
TreeModel(List<T> roots)
Create a new tree model with the list of root level model objects.
|
TreeModel(List<T> roots,
String rootName)
Create a new tree model with the list of root level model objects and
with a root node with the specified name.
|
TreeModel(Root<T> root)
Create a new tree model with the specified root node.
|
| Modifier and Type | Method and Description |
|---|---|
T |
getChild(Object parent,
int index)
Return the child at the specified index under the parent node in the
tree.
|
int |
getChildCount(Object parent)
Return the number of children under the specified parent object.
|
int |
getColumnCount()
Return the number of columns displayed in the tree table.
|
int |
getIndexOfChild(Object parent,
Object child)
Return the index for the specified child under the specified parent
node in the tree.
|
Object |
getRoot()
Return the object that represents the root of the tree.
|
Object |
getValueAt(Object node,
int index)
Return the value to display in the tree for the specified object at the
specified column index.
|
boolean |
isLeaf(Object object)
Return
true if the object (node) does not contain children. |
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getColumnClass, getColumnName, removeTreeModelListenerpublic static final String ROOT_NAME
Root object.
""public TreeModel(List<T> roots)
getRoot().roots - The list of root level objects.public TreeModel(List<T> roots, String rootName)
roots - The list of root level objects.rootName - The name to use for the dummy root node.public Object getRoot()
root if not null or the first element in the roots list.public T getChild(Object parent, int index)
parent - The parent node in the tree.index - The index at which the child resides.public int getChildCount(Object parent)
parent - The parent node in the tree.public boolean isLeaf(Object object)
true if the object (node) does not contain children.object - The object that represents the tree node.true if the node has children.public int getIndexOfChild(Object parent, Object child)
parent - The parent node in the tree.child - The child node in the tree.public int getColumnCount()
1.1.public Object getValueAt(Object node, int index)
node - The node whose display value is to be returned.index - The column index in the tree table.