Class TreeTableModelAdapter

java.lang.Object
javax.swing.table.AbstractTableModel
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:
  • Constructor Details

    • 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 Details

    • getColumnCount

      public int getColumnCount()
      Get the number of columns in the model.
      Returns:
      the number of columns in the model.
    • 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.
    • 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.
    • getRowCount

      public int getRowCount()
      Get the number of rows in the model.
      Returns:
      the number of rows in the model.
      See Also:
    • 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.
    • 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.
    • 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.
    • 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.