|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.console.ui.treetable.AbstractTreeTableModel com.metamatrix.console.ui.treetable.DynamicTreeTableModel
public class DynamicTreeTableModel
An implementation of TreeTableModel that uses reflection to answer TableModel methods. This works off a handful of values. A TreeNode is used to answer all the TreeModel related methods (similiar to AbstractTreeTableModel and DefaultTreeModel). The column names are specified in the constructor. The values for the columns are dynamically obtained via reflection, you simply provide the method names. The methods used to set a particular value are also specified as an array of method names, a null method name, or null array indicates the column isn't editable. And the class types, used for the TableModel method getColumnClass are specified in the constructor.
Field Summary |
---|
Fields inherited from class com.metamatrix.console.ui.treetable.AbstractTreeTableModel |
---|
listenerList, root |
Constructor Summary | |
---|---|
DynamicTreeTableModel(javax.swing.tree.TreeNode root,
java.lang.String[] columnNames,
java.lang.String[] getterMethodNames,
java.lang.String[] setterMethodNames,
java.lang.Class[] cTypes)
Constructor for creating a DynamicTreeTableModel. |
Method Summary | |
---|---|
java.lang.Object |
getChild(java.lang.Object node,
int i)
TreeModel method to locate a particular child of the specified node. |
int |
getChildCount(java.lang.Object node)
TreeModel method to return the number of children of a particular node. |
java.lang.Class |
getColumnClass(int column)
Returns the column class for column column . |
int |
getColumnCount()
Returns the number of column names passed into the constructor. |
java.lang.String |
getColumnName(int column)
Returns the column name passed into the constructor. |
javax.swing.tree.TreeNode[] |
getPathToRoot(javax.swing.tree.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. |
java.lang.Object |
getValueAt(java.lang.Object node,
int column)
Returns the value for the column column and object
node . |
boolean |
isCellEditable(java.lang.Object node,
int column)
Returns true if there is a setter method name for column column . |
boolean |
isLeaf(java.lang.Object node)
TreeModel method to determine if a node is a leaf. |
void |
setValueAt(java.lang.Object aValue,
java.lang.Object node,
int column)
Sets the value to aValue for the object
node in column column . |
Methods inherited from class com.metamatrix.console.ui.treetable.AbstractTreeTableModel |
---|
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getIndexOfChild, getRoot, removeTreeModelListener, valueForPathChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DynamicTreeTableModel(javax.swing.tree.TreeNode root, java.lang.String[] columnNames, java.lang.String[] getterMethodNames, java.lang.String[] setterMethodNames, java.lang.Class[] cTypes)
Method Detail |
---|
public int getChildCount(java.lang.Object node)
node
is a TreeNode, this can be answered
via the TreeNode method getChildCount
.
public java.lang.Object getChild(java.lang.Object node, int i)
node
is a TreeNode, this can be answered
via the TreeNode method getChild
.
public boolean isLeaf(java.lang.Object node)
node
is a TreeNode, this can be answered
via the TreeNode method isLeaf
.
isLeaf
in interface javax.swing.tree.TreeModel
isLeaf
in class AbstractTreeTableModel
public int getColumnCount()
public java.lang.String getColumnName(int column)
public java.lang.Class getColumnClass(int column)
column
. This
is set in the constructor.
getColumnClass
in interface TreeTableModel
getColumnClass
in class AbstractTreeTableModel
public java.lang.Object getValueAt(java.lang.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(java.lang.Object node, int column)
column
. This is set in the constructor.
isCellEditable
in interface TreeTableModel
isCellEditable
in class AbstractTreeTableModel
public void setValueAt(java.lang.Object aValue, java.lang.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.
setValueAt
in interface TreeTableModel
setValueAt
in class AbstractTreeTableModel
public javax.swing.tree.TreeNode[] getPathToRoot(javax.swing.tree.TreeNode aNode)
aNode
- the TreeNode to get the path foran
- array of TreeNodes giving the path from the root to the
specified node.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |