Klasse SwingTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
net.sf.jguiraffe.gui.platform.swing.builder.components.table.SwingTableModel
- Alle implementierten Schnittstellen:
Serializable
,TableModel
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.
- Version:
- $Id: SwingTableModel.java 205 2012-01-29 18:29:57Z oheger $
- Autor:
- Oliver Heger
- Siehe auch:
-
Feldübersicht
Von Klasse geerbte Felder javax.swing.table.AbstractTableModel
listenerList
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungSwingTableModel
(TableTag tt, JTable tab) Creates a new instance ofSwingTableModel
and initializes it. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
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
Returns the number of columns of the represented table.getColumnName
(int col) Returns the name for the specified column.Returns the cell editor associated with this model.Returns the list with the data of this model.Returns the cell renderer associated with this model.int
Returns the number of rows of the represented table.getTable()
Returns a reference to the associated table.Returns the table tag this model is based onto.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.Von Klasse geerbte Methoden javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Konstruktordetails
-
SwingTableModel
Creates a new instance ofSwingTableModel
and initializes it.- Parameter:
tt
- the tag defining the underlying tabletab
- the associated table
-
-
Methodendetails
-
getModelData
Returns the list with the data of this model. The list contains beans that define the values of the single columns.- Gibt zurück:
- the data list of this model
-
getTableTag
Returns the table tag this model is based onto.- Gibt zurück:
- the table tag
-
getTable
Returns a reference to the associated table.- Gibt zurück:
- the table
-
getColumnCount
public int getColumnCount()Returns the number of columns of the represented table.- Gibt zurück:
- the number of columns of this table
-
getRowCount
public int getRowCount()Returns the number of rows of the represented table.- Gibt zurück:
- the number of rows of this table
-
getValueAt
Returns the value at the specified cell.- Parameter:
row
- the row indexcol
- the column index- Gibt zurück:
- the value of this cell
-
getColumnClass
Returns the data class of the specified column. This implementation checks whether a logic column class was specified. If this is the case, it is mapped to the corresponding Java class. Otherwise, the Java class is directly obtained from the column definition.- Angegeben von:
getColumnClass
in SchnittstelleTableModel
- Setzt außer Kraft:
getColumnClass
in KlasseAbstractTableModel
- Parameter:
col
- the column index- Gibt zurück:
- the data class for the specified column
-
getColumnName
Returns the name for the specified column.- Angegeben von:
getColumnName
in SchnittstelleTableModel
- Setzt außer Kraft:
getColumnName
in KlasseAbstractTableModel
- Parameter:
col
- the column index- Gibt zurück:
- the title for this column
-
isCellEditable
public boolean isCellEditable(int row, int col) Returns a flag whether the specified cell can be modified.- Angegeben von:
isCellEditable
in SchnittstelleTableModel
- Setzt außer Kraft:
isCellEditable
in KlasseAbstractTableModel
- Parameter:
row
- the row indexcol
- the column index- Gibt zurück:
- a flag whether this cell can be edited
-
setValueAt
Sets the value for the specified cell.- Angegeben von:
setValueAt
in SchnittstelleTableModel
- Setzt außer Kraft:
setValueAt
in KlasseAbstractTableModel
- Parameter:
value
- the value to setrow
- the row indexcol
- the column index
-
fireTableChanged
Notifies listeners about a change in the data of this model. This implementation also notifies theTableFormController
about this change.- Setzt außer Kraft:
fireTableChanged
in KlasseAbstractTableModel
- Parameter:
event
- the event
-
hasEditor
public boolean hasEditor(int col) Checks whether for the specified column a custom editor is specified.- Parameter:
col
- the column index- Gibt zurück:
- a flag if this column has its own editor
-
getEditor
Returns the cell editor associated with this model. There is exactly one editor that is capable to serve all columns of this table (that define a custom editor).- Gibt zurück:
- the cell editor used for the represented table
-
hasRenderer
public boolean hasRenderer(int col) Tests whether for the specified column a custom renderer is specified.- Parameter:
col
- the column index- Gibt zurück:
- a flag whether this column has a custom renderer
-
getRenderer
Returns the cell renderer associated with this model. There is exactly one renderer that is capable of rendering all columns of this table that define a custom renderer.- Gibt zurück:
- the cell renderer used for the represented table
-
validateColumn
protected boolean validateColumn(int col) Validates the column with the specified index. This method is always called when the user has entered data into a cell of the table. It delegates to the editor form to validate the input fields used in this column. It will also notify theTableEditorValidationHandler
set for this table. If validation is successful, the value(s) will be written into the model.- Parameter:
col
- the column to be validated- Gibt zurück:
- a flag whether the data is valid
-