Class TableMap

All Implemented Interfaces:
Serializable, EventListener, TableModelListener, TableModel
Direct Known Subclasses:
TableSorter

public class TableMap extends AbstractTableModel implements TableModelListener
In a chain of data manipulators some behaviour is common. TableMap provides most of this behaviour and can be subclassed by filters that only need to override a handful of specific methods. TableMap implements TableModel by routing all requests to its model, and TableModelListener by routing all events to its listeners. Inserting a TableMap which has not been subclassed into a chain of table filters should have no effect.
See Also:
  • Field Details

    • model

      protected TableModel model
      The wrapped table model.
  • Constructor Details

    • TableMap

      public TableMap()
  • Method Details

    • getModel

      public TableModel getModel()
      Returns the wrapped table model.
      Returns:
      the delegate model
    • setModel

      public void setModel(TableModel model)
      Replaces the wrapped table model and starts listening for its change events.
      Parameters:
      model - the delegate model
    • getValueAt

      public Object getValueAt(int aRow, int aColumn)
      Returns the value from the wrapped model at the supplied coordinates.
      Specified by:
      getValueAt in interface TableModel
      Parameters:
      aRow - the source row index
      aColumn - the source column index
      Returns:
      the delegate value
    • setValueAt

      public void setValueAt(Object aValue, int aRow, int aColumn)
      Writes a value through to the wrapped model.
      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class AbstractTableModel
      Parameters:
      aValue - the new cell value
      aRow - the source row index
      aColumn - the source column index
    • getRowCount

      public int getRowCount()
      Returns the current row count from the wrapped model.
      Specified by:
      getRowCount in interface TableModel
      Returns:
      the delegate row count, or 0 when no model is set
    • getColumnCount

      public int getColumnCount()
      Returns the current column count from the wrapped model.
      Specified by:
      getColumnCount in interface TableModel
      Returns:
      the delegate column count, or 0 when no model is set
    • getColumnName

      public String getColumnName(int aColumn)
      Returns the delegate column name for the supplied index.
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
      Parameters:
      aColumn - the source column index
      Returns:
      the delegate column name
    • getColumnClass

      public Class getColumnClass(int aColumn)
      Returns the delegate column class for the supplied index.
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AbstractTableModel
      Parameters:
      aColumn - the source column index
      Returns:
      the delegate column type
    • isCellEditable

      public boolean isCellEditable(int row, int column)
      Indicates whether the delegate model allows editing for the supplied cell.
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class AbstractTableModel
      Parameters:
      row - the source row index
      column - the source column index
      Returns:
      true when the delegate cell is editable
    • tableChanged

      public void tableChanged(TableModelEvent e)
      Forwards model change notifications to this table model's listeners.
      Specified by:
      tableChanged in interface TableModelListener
      Parameters:
      e - the model change event