Package org.jdesktop.swingx.treetable
Interface TreeTableModel
- All Superinterfaces:
TreeModel
- All Known Implementing Classes:
AbstractTreeTableModel
,DefaultTreeTableModel
,FileSystemModel
,SimpleFileSystemModel
The model used by
JXTreeTable
.
This model is a combination of TreeModel
and
TableModel
for use with the tree table. It does not
actually extends TableModel
, but instead copies method signature as
appropriate and alters other to work with the underlying TreeModel
.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>
getColumnClass
(int columnIndex) Returns the most specific superclass for all the cell values in the column.int
Returns the number of columns in the model.getColumnName
(int column) Returns the name of the column atcolumnIndex
.int
Returns the column that is the "tree" column.getValueAt
(Object node, int column) Returns the value for thenode
atcolumnIndex
.boolean
isCellEditable
(Object node, int column) Returns true if the cell for thenode
atcolumnIndex
is editable.void
setValueAt
(Object value, Object node, int column) Sets the value for thenode
atcolumnIndex
tovalue
.Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
-
Method Details
-
getColumnClass
Returns the most specific superclass for all the cell values in the column. This is used by theJXTreeTable
to set up a default renderer and editor for the column.- Parameters:
columnIndex
- the index of the column- Returns:
- the common ancestor class of the object values in the model.
- See Also:
-
getColumnCount
int getColumnCount()Returns the number of columns in the model. AJXTreeTable
uses this method to determine how many columns it should create and display by default.- Returns:
- the number of columns in the model
- See Also:
-
getColumnName
Returns the name of the column atcolumnIndex
. 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.- Parameters:
column
- the index of the column- Returns:
- the name of the column
- See Also:
-
getHierarchicalColumn
int getHierarchicalColumn()Returns the column that is the "tree" column. While it is not required, most implementations will default the first column to be the hierarchical one.- Returns:
- the index of the hierarchical column or -1 if no column is the hierarchical column.
-
getValueAt
Returns the value for thenode
atcolumnIndex
. Thenode
must be managed by this model. Unamanaged nodes should throw anIllegalArgumentException
.- Parameters:
node
- the node whose value is to be queriedcolumn
- the column whose value is to be queried- Returns:
- the value Object at the specified cell
- Throws:
IllegalArgumentException
- ifnode
is not managed by this model.- See Also:
-
isCellEditable
Returns true if the cell for thenode
atcolumnIndex
is editable. Otherwise,setValueAt
on the cell will not change the value of that cell. Thenode
must be managed by this model. Unamanaged nodes should throw anIllegalArgumentException
.- Parameters:
node
- the node whose value to be queriedcolumn
- the column whose value to be queried- Returns:
- true if the cell is editable
- Throws:
IllegalArgumentException
- ifnode
is not managed by this model.- See Also:
-
setValueAt
Sets the value for thenode
atcolumnIndex
tovalue
. Thenode
must be managed by this model. Unamanaged nodes should throw anIllegalArgumentException
.- Parameters:
value
- the new valuenode
- the node whose value is to be changedcolumn
- the column whose value is to be changed- Throws:
IllegalArgumentException
- ifnode
is not managed by this model.- See Also:
-