Package org.jdesktop.swingx.treetable
Interface TreeTableModel
-
- All Superinterfaces:
javax.swing.tree.TreeModel
- All Known Implementing Classes:
AbstractTreeTableModel,DefaultTreeTableModel,FileSystemModel,SimpleFileSystemModel
public interface TreeTableModel extends javax.swing.tree.TreeModelThe model used byJXTreeTable.This model is a combination of
TreeModelandTableModelfor use with the tree table. It does not actually extendsTableModel, but instead copies method signature as appropriate and alters other to work with the underlyingTreeModel.- See Also:
TreeModel,TableModel
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Class<?>getColumnClass(int columnIndex)Returns the most specific superclass for all the cell values in the column.intgetColumnCount()Returns the number of columns in the model.java.lang.StringgetColumnName(int column)Returns the name of the column atcolumnIndex.intgetHierarchicalColumn()Returns the column that is the "tree" column.java.lang.ObjectgetValueAt(java.lang.Object node, int column)Returns the value for thenodeatcolumnIndex.booleanisCellEditable(java.lang.Object node, int column)Returns true if the cell for thenodeatcolumnIndexis editable.voidsetValueAt(java.lang.Object value, java.lang.Object node, int column)Sets the value for thenodeatcolumnIndextovalue.
-
-
-
Method Detail
-
getColumnClass
java.lang.Class<?> getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column. This is used by theJXTreeTableto 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:
TableModel.getColumnClass(int)
-
getColumnCount
int getColumnCount()
Returns the number of columns in the model. AJXTreeTableuses this method to determine how many columns it should create and display by default.- Returns:
- the number of columns in the model
- See Also:
TableModel.getColumnCount()
-
getColumnName
java.lang.String getColumnName(int column)
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:
TableModel.getColumnName(int)
-
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
java.lang.Object getValueAt(java.lang.Object node, int column)Returns the value for thenodeatcolumnIndex. Thenodemust 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:
java.lang.IllegalArgumentException- ifnodeis not managed by this model.- See Also:
setValueAt(java.lang.Object, java.lang.Object, int),TableModel.getValueAt(int, int)
-
isCellEditable
boolean isCellEditable(java.lang.Object node, int column)Returns true if the cell for thenodeatcolumnIndexis editable. Otherwise,setValueAton the cell will not change the value of that cell. Thenodemust 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:
java.lang.IllegalArgumentException- ifnodeis not managed by this model.- See Also:
setValueAt(java.lang.Object, java.lang.Object, int),TableModel.isCellEditable(int, int)
-
setValueAt
void setValueAt(java.lang.Object value, java.lang.Object node, int column)Sets the value for thenodeatcolumnIndextovalue. Thenodemust 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:
java.lang.IllegalArgumentException- ifnodeis not managed by this model.- See Also:
getValueAt(java.lang.Object, int),isCellEditable(java.lang.Object, int),TableModel.setValueAt(Object, int, int)
-
-