gov.nih.nlm.swing
Class TableMap

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bygov.nih.nlm.swing.TableMap
All Implemented Interfaces:
EventListener, Serializable, TableModel, TableModelListener
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 behavour 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.

Author:
Philip Milne
See Also:
Serialized Form

Field Summary
protected  TableModel model
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableMap()
           
 
Method Summary
 Class getColumnClass(int aColumn)
          Returns the column class from the underlying model.
 int getColumnCount()
          Returns the column count from the underlying model.
 String getColumnName(int c)
          Returns the column name from the underlying model.
 TableModel getModel()
          Returns the model underlying the map.
 int getRowCount()
          Returns the row count from the underlying model.
 Object getValueAt(int r, int c)
          Returns the value for the specified cell from the underlying model.
 boolean isCellEditable(int r, int c)
          Returns a flag from the underlying model indicating whether or not the cell is editable.
 void setModel(TableModel model)
          Sets the model underlying the map.
 void setValueAt(Object value, int r, int c)
          Sets the value for a cell in the underlying mode.
 void tableChanged(TableModelEvent e)
          Forwards a table changed event to the table.
 
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
 

Field Detail

model

protected TableModel model
Constructor Detail

TableMap

public TableMap()
Method Detail

getModel

public TableModel getModel()
Returns the model underlying the map.

Returns:
the model underlying the map

setModel

public void setModel(TableModel model)
Sets the model underlying the map.

Parameters:
model - the TableModel

getValueAt

public Object getValueAt(int r,
                         int c)
Returns the value for the specified cell from the underlying model.

Specified by:
getValueAt in interface TableModel
Parameters:
r - A row index
c - A colum index
Returns:
a value for cell from underlying model

setValueAt

public void setValueAt(Object value,
                       int r,
                       int c)
Sets the value for a cell in the underlying mode.

Specified by:
setValueAt in interface TableModel
Parameters:
value - An Object value
r - A row index
c - A colum index

getRowCount

public int getRowCount()
Returns the row count from the underlying model.

Specified by:
getRowCount in interface TableModel
Returns:
the row count from the underlying model

getColumnCount

public int getColumnCount()
Returns the column count from the underlying model.

Specified by:
getColumnCount in interface TableModel
Returns:
the column count from the underlying model

getColumnName

public String getColumnName(int c)
Returns the column name from the underlying model.

Specified by:
getColumnName in interface TableModel
Parameters:
c - A column index
Returns:
the column name from the underlying model

getColumnClass

public Class getColumnClass(int aColumn)
Returns the column class from the underlying model.

Specified by:
getColumnClass in interface TableModel
Parameters:
aColumn - A column index
Returns:
the column class from the underlying model

isCellEditable

public boolean isCellEditable(int r,
                              int c)
Returns a flag from the underlying model indicating whether or not the cell is editable.

Specified by:
isCellEditable in interface TableModel
Parameters:
r - A row index
c - A column index
Returns:
a flag from the underlying model indicating whether or not the cell is editable

tableChanged

public void tableChanged(TableModelEvent e)
Forwards a table changed event to the table.

Specified by:
tableChanged in interface TableModelListener
Parameters:
e - a TableModelEvent


Copyright ©2005