public abstract class AbstractTreeTableModel extends Object implements TreeTableModel
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);
| Modifier and Type | Field and Description |
|---|---|
protected TreeModelSupport |
modelSupport
Provides support for event dispatching.
|
protected Object |
root
Root node of the model
|
| Constructor and Description |
|---|
AbstractTreeTableModel()
Constructs an
AbstractTreeTableModel with a null root
node. |
AbstractTreeTableModel(Object root)
Constructs an
AbstractTreeTableModel with the specified root
node. |
| Modifier and Type | Method and Description |
|---|---|
void |
addTreeModelListener(TreeModelListener l) |
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() |
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) |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetColumnCount, getValueAtgetChild, getChildCount, getIndexOfChildprotected Object root
protected TreeModelSupport modelSupport
public AbstractTreeTableModel()
AbstractTreeTableModel with a null root
node.public AbstractTreeTableModel(Object root)
AbstractTreeTableModel with the specified root
node.root - root nodepublic Class<?> getColumnClass(int column)
JXTreeTable to set up a default
renderer and editor for the column.getColumnClass in interface TreeTableModelcolumn - the index of the columnTableModel.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 columnTableModel.getColumnName(int)public int getHierarchicalColumn()
getHierarchicalColumn in interface TreeTableModelpublic 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 queriedTreeTableModel.setValueAt(java.lang.Object, java.lang.Object, int),
TableModel.isCellEditable(int, int)public boolean isLeaf(Object node)
true if node is a leaf.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)
addTreeModelListener in interface TreeModelpublic void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener in interface TreeModelpublic TreeModelListener[] getTreeModelListeners()
TreeModelListeners added
to this JXTreeTable with addTreeModelListener().TreeModelListeners added or an empty
array if no listeners have been addedCopyright © 2017. All Rights Reserved.