|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
org.afcs.warts.gui.TableMap
The TableMap class is an identity transformation for TableModels, and can be used as the basis for classes that wish to perform more complex transformations or mappings on TableModels.
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.
This implementation is based on version 1.5 of Philip Milne's code (I can't find the original implementation, but google finds lots of other people using it), but has some minor major API changes.
LICENSE: This code is released to the public domain and may be used for any purpose whatsoever without permission or acknowledgment.
Field Summary |
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary | |
TableMap(javax.swing.table.TableModel model)
Constructs a new map with the specified base model, which will provide all information in methods that are not overridden by subclasses. |
Method Summary | |
java.lang.Class |
getColumnClass(int columnIndex)
Returns the class of the specified column from the base model. |
int |
getColumnCount()
Returns the number of columns in the base model. |
java.lang.String |
getColumnName(int columnIndex)
Returns the name of the specified column from the base model. |
javax.swing.table.TableModel |
getModel()
Returns the base model specified at initialisation. |
int |
getRowCount()
Returns the number of rows in the base model. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value in the base model at the specified row and column. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell in the specified row and column in the base model is editable. |
void |
setValueAt(java.lang.Object newValue,
int rowIndex,
int columnIndex)
Sets the value at the specified row and column in the base model to the specified new value. |
void |
tableChanged(javax.swing.event.TableModelEvent event)
When the table is changed, this method makes sure that all listeners get the event. |
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 |
Constructor Detail |
public TableMap(javax.swing.table.TableModel model)
model
- The base model to use.Method Detail |
public javax.swing.table.TableModel getModel()
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
rowIndex
- The row to fetch data from.columnIndex
- The column to fetch data from.
public void setValueAt(java.lang.Object newValue, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
newValue
- The new value to set.rowIndex
- The row to set the new value in.columnIndex
- The column to set the new value in.public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
columnIndex
- The column to return data for.
public java.lang.Class getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
columnIndex
- The column to return data for.
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
rowIndex
- The row the cell is in.columnIndex
- The column the cell is in.
public void tableChanged(javax.swing.event.TableModelEvent event)
tableChanged
in interface javax.swing.event.TableModelListener
event
- The event to send out.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |