uic.widgets
Class TableMap

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--uic.widgets.TableMap
All Implemented Interfaces:
EventListener, Serializable, TableModel, TableModelListener, TableViewInterface
Direct Known Subclasses:
TableSorter

public class TableMap
extends AbstractTableModel
implements TableModelListener, TableViewInterface

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)
           
 int getColumnCount()
           
 String getColumnName(int aColumn)
           
 TableModel getModel()
          Return the child model.
 int getRowCount()
           
 Object getValueAt(int aRow, int aColumn)
           
 boolean isCellEditable(int row, int column)
           
 void setModel(TableModel model)
           
 void setValueAt(Object aValue, int aRow, int aColumn)
           
 void tableChanged(TableModelEvent e)
           
 
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()
Description copied from interface: TableViewInterface
Return the child model.

In the default swing JTable and its models you can nest models and these models can be either view or data. The data model is always the last in the chain of models.

The problem with the Swing implementation is that the programmer needs a link to the datamodel since its impossible to get that from the JTable if at least one view model has been added. This method allows the recursive retrieval of models, and thus restoration of piece between the MVC and JTable groups :)

Specified by:
getModel in interface TableViewInterface
Returns:
the child model, or null if none.

setModel

public void setModel(TableModel model)

getValueAt

public Object getValueAt(int aRow,
                         int aColumn)
Specified by:
getValueAt in interface TableModel

setValueAt

public void setValueAt(Object aValue,
                       int aRow,
                       int aColumn)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getColumnName

public String getColumnName(int aColumn)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getColumnClass

public Class getColumnClass(int aColumn)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

tableChanged

public void tableChanged(TableModelEvent e)
Specified by:
tableChanged in interface TableModelListener


Copyright © 2002,2003 Thomas Zander