org.jppf.ui.treetable
Class TreeTableModelAdapter

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.jppf.ui.treetable.TreeTableModelAdapter
All Implemented Interfaces:
Serializable, TableModel

public class TreeTableModelAdapter
extends AbstractTableModel

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:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TreeTableModelAdapter(TreeTableModel treeTableModel, JTree tree)
          Initialize this model adapter with the specified tree table model and JTree.
 
Method Summary
protected  void delayedFireTableDataChanged()
          Invokes fireTableDataChanged after all the pending events have been processed.
 String dumpTreePaths(TreePath[] paths)
          Dump the specified tree paths to a string.
 Class getColumnClass(int column)
          Returns Object.class regardless of columnIndex.
 int getColumnCount()
          Get the number of columns in the model.
 String getColumnName(int column)
          Get the name of the column at the specified index.
 int getRowCount()
          Get the number of rows in the model.
 TreePath[] getSelectedPaths()
          Get the currently selected paths in the tree.
 TreeTableModel getTreeTableModel()
          Get the tree table model wrapped by this class.
 Object getValueAt(int row, int column)
          Get the value of the cell at the specified coordinates.
 boolean isCellEditable(int row, int column)
          Determine whether the cell at the specified coordinates is editable.
protected  Object nodeForRow(int row)
          Get the node for the specified row.
 void setSelectedPaths(TreePath[] paths)
          Set the currently selected paths in the tree.
 void setValueAt(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeTableModelAdapter

public TreeTableModelAdapter(TreeTableModel treeTableModel,
                             JTree tree)
Initialize this model adapter with the specified tree table model and JTree.

Parameters:
treeTableModel - the tree table model.
tree - the underlying JTree.
Method Detail

getColumnCount

public int getColumnCount()
Get the number of columns in the model.

Returns:
the number of columns in the model.
See Also:
TableModel.getColumnCount()

getColumnName

public String getColumnName(int column)
Get the name of the column at the specified index.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
column - the index of the column.
Returns:
the default name of the column as a string.
See Also:
AbstractTableModel.getColumnName(int)

getColumnClass

public Class getColumnClass(int column)
Returns Object.class regardless of columnIndex.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
column - the column being queried.
Returns:
the Object.class object.
See Also:
AbstractTableModel.getColumnClass(int)

getRowCount

public int getRowCount()
Get the number of rows in the model.

Returns:
the number of rows in the model.
See Also:
TableModel.getRowCount()

nodeForRow

protected Object nodeForRow(int row)
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

public Object getValueAt(int row,
                         int column)
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.
See Also:
TableModel.getValueAt(int, int)

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Determine whether the cell at the specified coordinates is editable.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - the row coordinate.
column - the column coordinate.
Returns:
true if the cell is editable, false otherwise.
See Also:
AbstractTableModel.isCellEditable(int, int)

setValueAt

public void setValueAt(Object value,
                       int row,
                       int column)
Set the value of the cell at the specified coordinates.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
value - the value to set on the specified cell.
row - the row coordinate.
column - the column coordinate.
See Also:
AbstractTableModel.setValueAt(java.lang.Object, int, int)

delayedFireTableDataChanged

protected void delayedFireTableDataChanged()
Invokes fireTableDataChanged after all the pending events have been processed. SwingUtilities.invokeLater is used to handle this.


getSelectedPaths

public TreePath[] getSelectedPaths()
Get the currently selected paths in the tree.

Returns:
an array of TreePath objects.

setSelectedPaths

public void setSelectedPaths(TreePath[] paths)
Set the currently selected paths in the tree.

Parameters:
paths - an array of TreePath objects.

dumpTreePaths

public String dumpTreePaths(TreePath[] paths)
Dump the specified tree paths to a string.

Parameters:
paths - the paths to dump.
Returns:
a string representation of the array of TreePath objects.

getTreeTableModel

public TreeTableModel getTreeTableModel()
Get the tree table model wrapped by this class.

Returns:
a TreeTableModel instance.


Copyright © 2005-2010 JPPF Team.