public class SwingTableModel extends AbstractTableModel
A table model implementation for tables defined by the TableTag
tag
handler class.
This class implements the typical table model functionality based on an
TableFormController
object
provided by a TableTag
instance. Many methods can directly delegate
to the controller object.
listenerList
Constructor and Description |
---|
SwingTableModel(TableTag tt,
JTable tab)
Creates a new instance of
SwingTableModel and initializes it. |
Modifier and Type | Method and Description |
---|---|
void |
fireTableChanged(TableModelEvent event)
Notifies listeners about a change in the data of this model.
|
Class<?> |
getColumnClass(int col)
Returns the data class of the specified column.
|
int |
getColumnCount()
Returns the number of columns of the represented table.
|
String |
getColumnName(int col)
Returns the name for the specified column.
|
TableCellEditor |
getEditor()
Returns the cell editor associated with this model.
|
List<Object> |
getModelData()
Returns the list with the data of this model.
|
TableCellRenderer |
getRenderer()
Returns the cell renderer associated with this model.
|
int |
getRowCount()
Returns the number of rows of the represented table.
|
JTable |
getTable()
Returns a reference to the associated table.
|
TableTag |
getTableTag()
Returns the table tag this model is based onto.
|
Object |
getValueAt(int row,
int col)
Returns the value at the specified cell.
|
boolean |
hasEditor(int col)
Checks whether for the specified column a custom editor is specified.
|
boolean |
hasRenderer(int col)
Tests whether for the specified column a custom renderer is specified.
|
boolean |
isCellEditable(int row,
int col)
Returns a flag whether the specified cell can be modified.
|
void |
setValueAt(Object value,
int row,
int col)
Sets the value for the specified cell.
|
protected boolean |
validateColumn(int col)
Validates the column with the specified index.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
public List<Object> getModelData()
public TableTag getTableTag()
public JTable getTable()
public int getColumnCount()
public int getRowCount()
public Object getValueAt(int row, int col)
row
- the row indexcol
- the column indexpublic Class<?> getColumnClass(int col)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
col
- the column indexpublic String getColumnName(int col)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
col
- the column indexpublic boolean isCellEditable(int row, int col)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
row
- the row indexcol
- the column indexpublic void setValueAt(Object value, int row, int col)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
value
- the value to setrow
- the row indexcol
- the column indexpublic void fireTableChanged(TableModelEvent event)
TableFormController
about this
change.fireTableChanged
in class AbstractTableModel
event
- the eventpublic boolean hasEditor(int col)
col
- the column indexpublic TableCellEditor getEditor()
public boolean hasRenderer(int col)
col
- the column indexpublic TableCellRenderer getRenderer()
protected boolean validateColumn(int col)
TableEditorValidationHandler
set for this table. If validation is successful, the value(s) will be
written into the model.col
- the column to be validatedCopyright © 2016 The JGUIraffe Team. All rights reserved.