SalesPoint v3.3 API

util.swing
Class TableMap

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by util.swing.AbstractTableModel
          extended by util.swing.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 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, Thomas Medack
See Also:
Serialized Form

Field Summary
protected  AbstractTableModel model
          The original TableModel
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
TableMap()
          Constructor
 
Method Summary
 Class<?> getColumnClass(int aColumn)
          Get the class of the given column in this TableModel.
 int getColumnCount()
          Returns the number of columns.
 String getColumnName(int aColumn)
          Returns the column's names.
 AbstractTableModel getModel()
          Returns the TableModel.
 Object getRecord(int row)
          Gets the record.
 int getRowCount()
          Returns the number of rows.
 Object getValueAt(int aRow, int aColumn)
          Gets the value of a table cell.
 boolean isCellEditable(int row, int column)
          Returns if cell is editable or not.
 void setData(Object n_lModel)
          Set the table's data.
 void setModel(AbstractTableModel model)
          Sets the TableModel.
 void setValueAt(Object aValue, int aRow, int aColumn)
          Changes the value of a table cell.
 void tableChanged(TableModelEvent e)
          Reacts on TableChangeEvents.
 
Methods inherited from class util.swing.AbstractTableModel
getEntryDescriptor, orderByColumn, reOrderBy
 
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 AbstractTableModel model
The original TableModel

Constructor Detail

TableMap

public TableMap()
Constructor

Method Detail

setData

public void setData(Object n_lModel)
Set the table's data. This actually has no effect here.

Specified by:
setData in class AbstractTableModel
Parameters:
n_lModel - the new data

getModel

public AbstractTableModel getModel()
Returns the TableModel.

Returns:
the TableModel.

setModel

public void setModel(AbstractTableModel model)
Sets the TableModel.

Parameters:
model - the TableModel.

getValueAt

public Object getValueAt(int aRow,
                         int aColumn)
Gets the value of a table cell.

Specified by:
getValueAt in interface TableModel
Overrides:
getValueAt in class AbstractTableModel
Parameters:
aRow - row to get the value from.
aColumn - column to get the value from.
Returns:
the value at (aRow, aColumn).

setValueAt

public void setValueAt(Object aValue,
                       int aRow,
                       int aColumn)
Changes the value of a table cell.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
aValue - the value to set.
aRow - the row of the TableCell to be changed.
aColumn - the column of the table cell to be changed.

getRowCount

public int getRowCount()
Returns the number of rows.

Specified by:
getRowCount in interface TableModel
Returns:
the number of rows.

getColumnCount

public int getColumnCount()
Returns the number of columns.

Specified by:
getColumnCount in interface TableModel
Overrides:
getColumnCount in class AbstractTableModel
Returns:
the number of columns.
See Also:
TableEntryDescriptor.getColumnCount()

getColumnName

public String getColumnName(int aColumn)
Returns the column's names.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
aColumn - the affected column.
Returns:
columns' names.
See Also:
TableEntryDescriptor.getColumnName(int)

getColumnClass

public Class<?> getColumnClass(int aColumn)
Description copied from class: AbstractTableModel
Get the class of the given column in this TableModel.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
aColumn - the affected column.
Returns:
columns' classes. They indicate how column's values should be aligned.
See Also:
TableEntryDescriptor.getColumnClass(int)

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns if cell is editable or not.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - the affected table row.
column - the affected column.
Returns:
  • true: cell is editable
  • false: cell is not editable

getRecord

public Object getRecord(int row)
Gets the record.

Specified by:
getRecord in class AbstractTableModel
Parameters:
row - the affected table row.
Returns:
the appropriate record.

tableChanged

public void tableChanged(TableModelEvent e)
Reacts on TableChangeEvents.

Specified by:
tableChanged in interface TableModelListener
Parameters:
e - the event.

SalesPoint v3.3 API