|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.swingx.treetable.AbstractTreeTableModel
public abstract class AbstractTreeTableModel
AbstractTreeTableModel provides an implementation of
TreeTableModel as a convenient starting
point in defining custom data models for
JXTreeTable. It takes care of listener
management and contains convenience methods for creating and dispatching
TreeModelEvents. To create a concreate instance of
TreeTableModel you need only to provide implementations for the
following methods:
public int getColumnCount(); public Object getValueAt(Object node, int column); public Object getChild(Object parent, int index); public int getChildCount(Object parent); public int getIndexOfChild(Object parent, Object child); public boolean isLeaf(Object node);
| Field Summary | |
|---|---|
protected TreeModelSupport |
modelSupport
Provides support for event dispatching. |
protected Object |
root
Root node of the model |
| Constructor Summary | |
|---|---|
AbstractTreeTableModel()
Constructs an AbstractTreeTableModel with a null root
node. |
|
AbstractTreeTableModel(Object root)
Constructs an AbstractTreeTableModel with the specified root
node. |
|
| Method Summary | |
|---|---|
void |
addTreeModelListener(TreeModelListener l)
Adds a listener for the TreeModelEvent
posted after the tree changes. |
Class<?> |
getColumnClass(int column)
Returns the most specific superclass for all the cell values in the column. |
String |
getColumnName(int column)
Returns the name of the column at columnIndex. |
int |
getHierarchicalColumn()
Returns the column that is the "tree" column. |
Object |
getRoot()
Returns the root of the tree. |
TreeModelListener[] |
getTreeModelListeners()
Returns an array of all the TreeModelListeners added
to this JXTreeTable with addTreeModelListener(). |
boolean |
isCellEditable(Object node,
int column)
Returns true if the cell for the node at columnIndex is
editable. |
boolean |
isLeaf(Object node)
Returns true if node is a leaf. |
void |
removeTreeModelListener(TreeModelListener l)
Removes a listener previously added with addTreeModelListener. |
void |
setValueAt(Object value,
Object node,
int column)
Sets the value for the node at columnIndex to
value. |
void |
valueForPathChanged(TreePath path,
Object newValue)
Called when value for the item identified by path has been changed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jdesktop.swingx.treetable.TreeTableModel |
|---|
getColumnCount, getValueAt |
| Methods inherited from interface javax.swing.tree.TreeModel |
|---|
getChild, getChildCount, getIndexOfChild |
| Field Detail |
|---|
protected Object root
protected TreeModelSupport modelSupport
| Constructor Detail |
|---|
public AbstractTreeTableModel()
AbstractTreeTableModel with a null root
node.
public AbstractTreeTableModel(Object root)
AbstractTreeTableModel with the specified root
node.
root - root node| Method Detail |
|---|
public Class<?> getColumnClass(int column)
JXTreeTable to set up a default
renderer and editor for the column.
getColumnClass in interface TreeTableModelcolumn - the index of the column
TableModel.getColumnClass(int)public String getColumnName(int column)
columnIndex. This is used to
initialize the table's column header name. Note: this name does not need
to be unique; two columns in a table can have the same name.
getColumnName in interface TreeTableModelcolumn - the index of the column
TableModel.getColumnName(int)public int getHierarchicalColumn()
getHierarchicalColumn in interface TreeTableModelpublic Object getRoot()
null
only if the tree has no nodes.
getRoot in interface TreeModel
public boolean isCellEditable(Object node,
int column)
node at columnIndex is
editable. Otherwise, setValueAt on the cell will not change the
value of that cell. The node must be managed by this model.
Unamanaged nodes should throw an IllegalArgumentException.
isCellEditable in interface TreeTableModelnode - the node whose value to be queriedcolumn - the column whose value to be queried
TreeTableModel.setValueAt(java.lang.Object, java.lang.Object, int),
TableModel.isCellEditable(int, int)public boolean isLeaf(Object node)
true if node is a leaf.
isLeaf in interface TreeModelnode - a node in the tree, obtained from this data source
node is a leaftrue if getChildCount(node) == 0
public void setValueAt(Object value,
Object node,
int column)
node at columnIndex to
value.
setValueAt in interface TreeTableModelvalue - the new valuenode - the node whose value is to be changedcolumn - the column whose value is to be changedTreeTableModel.getValueAt(java.lang.Object, int),
isCellEditable(java.lang.Object, int),
TableModel.setValueAt(Object, int, int)
public void valueForPathChanged(TreePath path,
Object newValue)
treeNodesChanged event.
valueForPathChanged in interface TreeModelpath - path to the node that has changednewValue - the new value from the TreeCellEditorJXTreeTable does not usually edit the node directly.public void addTreeModelListener(TreeModelListener l)
TreeModelEvent
posted after the tree changes.
addTreeModelListener in interface TreeModell - the listener to addTreeModel.removeTreeModelListener(javax.swing.event.TreeModelListener)public void removeTreeModelListener(TreeModelListener l)
addTreeModelListener.
removeTreeModelListener in interface TreeModell - the listener to removeTreeModel.addTreeModelListener(javax.swing.event.TreeModelListener)public TreeModelListener[] getTreeModelListeners()
TreeModelListeners added
to this JXTreeTable with addTreeModelListener().
TreeModelListeners added or an empty
array if no listeners have been added
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||