Package groovy.swing.table
Class TableMap
java.lang.Object
javax.swing.table.AbstractTableModel
groovy.swing.table.TableMap
- All Implemented Interfaces:
Serializable,EventListener,TableModelListener,TableModel
- Direct Known Subclasses:
TableSorter
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 Summary
FieldsFields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetColumnClass(int aColumn) Returns the delegate column class for the supplied index.intReturns the current column count from the wrapped model.getColumnName(int aColumn) Returns the delegate column name for the supplied index.getModel()Returns the wrapped table model.intReturns the current row count from the wrapped model.getValueAt(int aRow, int aColumn) Returns the value from the wrapped model at the supplied coordinates.booleanisCellEditable(int row, int column) Indicates whether the delegate model allows editing for the supplied cell.voidsetModel(TableModel model) Replaces the wrapped table model and starts listening for its change events.voidsetValueAt(Object aValue, int aRow, int aColumn) Writes a value through to the wrapped model.voidForwards model change notifications to this table model's listeners.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Field Details
-
model
The wrapped table model.
-
-
Constructor Details
-
TableMap
public TableMap()
-
-
Method Details
-
getModel
Returns the wrapped table model.- Returns:
- the delegate model
-
setModel
Replaces the wrapped table model and starts listening for its change events.- Parameters:
model- the delegate model
-
getValueAt
Returns the value from the wrapped model at the supplied coordinates.- Specified by:
getValueAtin interfaceTableModel- Parameters:
aRow- the source row indexaColumn- the source column index- Returns:
- the delegate value
-
setValueAt
Writes a value through to the wrapped model.- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel- Parameters:
aValue- the new cell valueaRow- the source row indexaColumn- the source column index
-
getRowCount
public int getRowCount()Returns the current row count from the wrapped model.- Specified by:
getRowCountin interfaceTableModel- Returns:
- the delegate row count, or
0when no model is set
-
getColumnCount
public int getColumnCount()Returns the current column count from the wrapped model.- Specified by:
getColumnCountin interfaceTableModel- Returns:
- the delegate column count, or
0when no model is set
-
getColumnName
Returns the delegate column name for the supplied index.- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel- Parameters:
aColumn- the source column index- Returns:
- the delegate column name
-
getColumnClass
Returns the delegate column class for the supplied index.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- 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:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel- Parameters:
row- the source row indexcolumn- the source column index- Returns:
truewhen the delegate cell is editable
-
tableChanged
Forwards model change notifications to this table model's listeners.- Specified by:
tableChangedin interfaceTableModelListener- Parameters:
e- the model change event
-