Package io.guise.framework.model
Class AbstractTableModel
- java.lang.Object
-
- com.globalmentor.beans.BoundPropertyObject
-
- io.guise.framework.model.AbstractModel
-
- io.guise.framework.model.AbstractTableModel
-
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,Model
,TableModel
- Direct Known Subclasses:
CalendarMonthTableModel
,DefaultTableModel
public abstract class AbstractTableModel extends AbstractModel implements TableModel
An abstract implementation of a table model. The table model is editable by default.- Author:
- Garret Wilson
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.guise.framework.model.TableModel
TableModel.Cell<C>
-
-
Constructor Summary
Constructors Constructor Description AbstractTableModel(TableColumnModel<?>... columns)
Columns constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addColumn(TableColumnModel<?> column)
Adds a column to the table.protected void
clearColumns()
Clears all columns from the table.<C> C
getCellValue(TableModel.Cell<C> cell)
Returns the cell value for the given cell.int
getColumnCount()
int
getColumnIndex(TableColumnModel<?> column)
Determines the logical index of the given table column.java.util.List<TableColumnModel<?>>
getColumns()
<C> void
setCellValue(TableModel.Cell<C> cell, C newCellValue)
Sets the cell value for the given cell.-
Methods inherited from class io.guise.framework.model.AbstractModel
getEventListenerManager, getPlainText
-
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Methods inherited from interface io.guise.framework.model.TableModel
getCellValue, getRowCount, setCellValue
-
-
-
-
Constructor Detail
-
AbstractTableModel
public AbstractTableModel(TableColumnModel<?>... columns)
Columns constructor.- Parameters:
columns
- The models representing the table columns.
-
-
Method Detail
-
getColumns
public java.util.List<TableColumnModel<?>> getColumns()
- Specified by:
getColumns
in interfaceTableModel
- Returns:
- A read-only list of table columns in physical order.
-
getColumnIndex
public int getColumnIndex(TableColumnModel<?> column)
Description copied from interface:TableModel
Determines the logical index of the given table column.- Specified by:
getColumnIndex
in interfaceTableModel
- Parameters:
column
- One of the table columns.- Returns:
- The zero-based logical index of the column within the table, or -1 if the column is not one of the model's columns.
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- The number of columns in this table.
-
addColumn
protected void addColumn(TableColumnModel<?> column)
Adds a column to the table.- Parameters:
column
- The column to add.
-
clearColumns
protected void clearColumns()
Clears all columns from the table.
-
getCellValue
public <C> C getCellValue(TableModel.Cell<C> cell)
Description copied from interface:TableModel
Returns the cell value for the given cell. This method delegates toTableModel.getCellValue(int, TableColumnModel)
.- Specified by:
getCellValue
in interfaceTableModel
- Type Parameters:
C
- The type of cell value.- Parameters:
cell
- The cell containing the row index and column information.- Returns:
- The value in the cell at the given row and column, or
null
if there is no value in that cell.
-
setCellValue
public <C> void setCellValue(TableModel.Cell<C> cell, C newCellValue)
Description copied from interface:TableModel
Sets the cell value for the given cell. This method delegates toTableModel.setCellValue(int, TableColumnModel, Object)
.- Specified by:
setCellValue
in interfaceTableModel
- Type Parameters:
C
- The type of cell value.- Parameters:
cell
- The cell containing the row index and column information.newCellValue
- The value to place in the cell at the given row and column, ornull
if there should be no value in that cell.
-
-