Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table
Class TableMap

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.sciapp.table.TableMap
All Implemented Interfaces:
ReorderListener, ReorderModel, Serializable, EventListener, TableModelListener, TableModel
Direct Known Subclasses:
CachedTableModel, DefaultRemoteTableModel, ListTableModelWrapper

public class TableMap
extends AbstractTableModel
implements TableModelListener, ReorderModel, ReorderListener

TableMap is a wrapper around a given TableModel instance, just as ListTableMap is for ListTableModel. The methods of TableModel that are implemented are nothing more than calls to the respective methods of the underlying TableModel.

See Also:
Serialized Form

Field Summary
protected  TableModel tableModel
          The underlying ListTableModel
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableMap(TableModel tableModel)
          Constructs a TableMap having tableModel as the underlying TableModel
 
Method Summary
 void addReorderListener(ReorderListener l)
          Adds a ReorderListener that is notified each time a change to the data model occurs so that the table updates the selected rows accordingly.
 void fireRowsMapped(int[] changedIndices)
          Notifies listeners that the rows of the table have been reordered according to the changedIndices map.
 void fireRowsReordered(ReorderEvent event)
          Notifies listeners that the rows of the table have been reordered in some way.
 Class getColumnClass(int c)
          Returns tableModel.getColumnClass
 int getColumnCount()
          Returns tableModel.getColumnCount
 String getColumnName(int columnIndex)
          Returns tableModel.getColumnName
 TableModel getModel()
          Returns the underlying TableModel instance.
 int getRowCount()
          Returns tableModel.getRowCount
 Object getValueAt(int row, int column)
          Returns tableModel.getValueAt
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns tableModel.isCellEditable
 void removeReorderListener(ReorderListener l)
          Removes a listener from the list that is notified each time a reorder event is generated.
 void rowsReordered(ReorderEvent e)
          Called whenever the rows of a JTable have been restructured.
 void setModel(TableModel newModel)
          Sets the underlying TableModel to newModel.
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
          Returns tableModel.setValueAt
 void tableChanged(TableModelEvent e)
          Fires the event to its TableModelListeners.
 
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

tableModel

protected TableModel tableModel
The underlying ListTableModel

Constructor Detail

TableMap

public TableMap(TableModel tableModel)
Constructs a TableMap having tableModel as the underlying TableModel

Method Detail

addReorderListener

public void addReorderListener(ReorderListener l)
Adds a ReorderListener that is notified each time a change to the data model occurs so that the table updates the selected rows accordingly.

Specified by:
addReorderListener in interface ReorderModel
Parameters:
l - the ReorderListener

fireRowsMapped

public void fireRowsMapped(int[] changedIndices)
Notifies listeners that the rows of the table have been reordered according to the changedIndices map.

Specified by:
fireRowsMapped in interface ReorderModel
Parameters:
changedIndices - int array indicating how the rows have been reordered.
See Also:
ReorderEvent

fireRowsReordered

public void fireRowsReordered(ReorderEvent event)
Notifies listeners that the rows of the table have been reordered in some way.

Specified by:
fireRowsReordered in interface ReorderModel
Parameters:
event - the reorder event.
See Also:
ReorderEvent

getColumnClass

public Class getColumnClass(int c)
Returns tableModel.getColumnClass

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
c - the column being queried
Returns:
the Object.class

getColumnCount

public int getColumnCount()
Returns tableModel.getColumnCount

Specified by:
getColumnCount in interface TableModel
Returns:
the number of columns in the model
See Also:
TableModel.getRowCount()

getColumnName

public String getColumnName(int columnIndex)
Returns tableModel.getColumnName

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
columnIndex - the column being queried
Returns:
a string containing the default name of column

getModel

public TableModel getModel()
Returns the underlying TableModel instance.

Returns:
the underlying TableModel instance.

getRowCount

public int getRowCount()
Returns tableModel.getRowCount

Specified by:
getRowCount in interface TableModel
Returns:
the number of rows in the model
See Also:
TableModel.getColumnCount()

getValueAt

public Object getValueAt(int row,
                         int column)
Returns tableModel.getValueAt

Specified by:
getValueAt in interface TableModel
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
the value Object at the specified cell

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Returns tableModel.isCellEditable

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
rowIndex - the row being queried
columnIndex - the column being queried
Returns:
false
See Also:
TableModel.setValueAt(java.lang.Object, int, int)

removeReorderListener

public void removeReorderListener(ReorderListener l)
Removes a listener from the list that is notified each time a reorder event is generated.

Specified by:
removeReorderListener in interface ReorderModel
Parameters:
l - the RearrangeListener

rowsReordered

public void rowsReordered(ReorderEvent e)
Called whenever the rows of a JTable have been restructured.

Specified by:
rowsReordered in interface ReorderListener
Parameters:
e - the ReorderEvent object

setModel

public void setModel(TableModel newModel)
Sets the underlying TableModel to newModel.

Parameters:
newModel - the new TableModel to assign.

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Returns tableModel.setValueAt

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
aValue - value to assign to cell
rowIndex - row of cell
columnIndex - column of cell
See Also:
TableModel.getValueAt(int, int), TableModel.isCellEditable(int, int)

tableChanged

public void tableChanged(TableModelEvent e)
Fires the event to its TableModelListeners.

Specified by:
tableChanged in interface TableModelListener

Copyright © 2005 Scientific Applications. All Rights Reserved.