Package org.jppf.ui.treetable
Class TreeTableModelAdapter
java.lang.Object
javax.swing.table.AbstractTableModel
org.jppf.ui.treetable.TreeTableModelAdapter
- All Implemented Interfaces:
Serializable,TableModel
This is a wrapper class takes a TreeTableModel and implements the table model interface. The implementation is
trivial, with all of the event dispatching support provided by the superclass: the AbstractTableModel.
- Version:
- 1.2 10/27/98
- Author:
- Philip Milne, Scott Violet
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
ConstructorsConstructorDescriptionTreeTableModelAdapter(TreeTableModel treeTableModel, JTree tree) Initialize this model adapter with the specified tree table model and JTree. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidInvokes fireTableDataChanged after all the pending events have been processed.dumpTreePaths(TreePath[] paths) Dump the specified tree paths to a string.Class<?>getColumnClass(int column) ReturnsObject.classregardless ofcolumnIndex.intGet the number of columns in the model.getColumnName(int column) Get the name of the column at the specified index.intGet the number of rows in the model.TreePath[]Get the currently selected paths in the tree.Get the tree table model wrapped by this class.getValueAt(int row, int column) Get the value of the cell at the specified coordinates.booleanisCellEditable(int row, int column) Determine whether the cell at the specified coordinates is editable.protected ObjectnodeForRow(int row) Get the node for the specified row.voidsetSelectedPaths(TreePath[] paths) Set the currently selected paths in the tree.voidsetValueAt(Object value, int row, int column) Set the value of the cell at the specified coordinates.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Constructor Details
-
TreeTableModelAdapter
Initialize this model adapter with the specified tree table model and JTree.- Parameters:
treeTableModel- the tree table model.tree- the underlying JTree.
-
-
Method Details
-
getColumnCount
public int getColumnCount()Get the number of columns in the model.- Returns:
- the number of columns in the model.
-
getColumnName
Get the name of the column at the specified index.- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel- Parameters:
column- the index of the column.- Returns:
- the default name of the column as a string.
-
getColumnClass
ReturnsObject.classregardless ofcolumnIndex.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- Parameters:
column- the column being queried.- Returns:
- the
Object.classobject.
-
getRowCount
public int getRowCount()Get the number of rows in the model.- Returns:
- the number of rows in the model.
- See Also:
-
nodeForRow
Get the node for the specified row.- Parameters:
row- the row index.- Returns:
- the corresponding node object, or null if this row doesn't exist in the tree.
-
getValueAt
Get the value of the cell at the specified coordinates.- Parameters:
row- the row coordinate.column- the column coordinate.- Returns:
- the value of the specified cell.
-
isCellEditable
public boolean isCellEditable(int row, int column) Determine whether the cell at the specified coordinates is editable.- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel- Parameters:
row- the row coordinate.column- the column coordinate.- Returns:
- true if the cell is editable, false otherwise.
-
setValueAt
Set the value of the cell at the specified coordinates.- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel- Parameters:
value- the value to set on the specified cell.row- the row coordinate.column- the column coordinate.
-
delayedFireTableDataChanged
protected void delayedFireTableDataChanged()Invokes fireTableDataChanged after all the pending events have been processed. SwingUtilities.invokeLater is used to handle this. -
getSelectedPaths
Get the currently selected paths in the tree.- Returns:
- an array of
TreePathobjects.
-
setSelectedPaths
Set the currently selected paths in the tree.- Parameters:
paths- an array ofTreePathobjects.
-
dumpTreePaths
Dump the specified tree paths to a string.- Parameters:
paths- the paths to dump.- Returns:
- a string representation of the array of
TreePathobjects.
-
getTreeTableModel
Get the tree table model wrapped by this class.- Returns:
- a
TreeTableModelinstance.
-