public class DynamicTreeTableModel extends AbstractTreeTableModel
listenerList, root
Constructor and Description |
---|
DynamicTreeTableModel(TreeNode root,
String[] columnNames,
String[] getterMethodNames,
String[] setterMethodNames,
Class[] cTypes)
Constructor for creating a DynamicTreeTableModel.
|
Modifier and Type | Method and Description |
---|---|
Object |
getChild(Object node,
int i)
TreeModel method to locate a particular child of the specified
node.
|
int |
getChildCount(Object node)
TreeModel method to return the number of children of a particular
node.
|
Class |
getColumnClass(int column)
Returns the column class for column
column . |
int |
getColumnCount()
Returns the number of column names passed into the constructor.
|
String |
getColumnName(int column)
Returns the column name passed into the constructor.
|
TreeNode[] |
getPathToRoot(TreeNode aNode)
Builds the parents of the node up to and including the root node,
where the original node is the last element in the returned array.
|
Object |
getValueAt(Object node,
int column)
Returns the value for the column
column and object
node . |
boolean |
isCellEditable(Object node,
int column)
Returns true if there is a setter method name for column
column . |
boolean |
isLeaf(Object node)
TreeModel method to determine if a node is a leaf.
|
void |
setValueAt(Object aValue,
Object node,
int column)
Sets the value to
aValue for the object
node in column column . |
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getIndexOfChild, getRoot, removeTreeModelListener, setValueAt, valueForPathChanged
public int getChildCount(Object node)
node
is a TreeNode, this can be answered
via the TreeNode method getChildCount
.public Object getChild(Object node, int i)
node
is a TreeNode, this can be answered
via the TreeNode method getChild
.public boolean isLeaf(Object node)
node
is a TreeNode, this can be answered
via the TreeNode method isLeaf
.isLeaf
in interface TreeModel
isLeaf
in class AbstractTreeTableModel
public int getColumnCount()
public String getColumnName(int column)
public Class getColumnClass(int column)
column
. This
is set in the constructor.getColumnClass
in interface TreeTableModel
getColumnClass
in class AbstractTreeTableModel
public Object getValueAt(Object node, int column)
column
and object
node
. The return value is determined by invoking
the method specified in constructor for the passed in column.public boolean isCellEditable(Object node, int column)
column
. This is set in the constructor.isCellEditable
in interface TreeTableModel
isCellEditable
in class AbstractTreeTableModel
public void setValueAt(Object aValue, Object node, int column)
aValue
for the object
node
in column column
. This is done
by using the setter method name, and coercing the passed in
value to the specified type.public TreeNode[] getPathToRoot(TreeNode aNode)
aNode
- the TreeNode to get the path foran
- array of TreeNodes giving the path from the root to the
specified node.Copyright © 2003, 2023, Oracle and/or its affiliates.