Package io.guise.framework.model
Interface TableModel
- All Superinterfaces:
Model
,com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
- All Known Implementing Classes:
AbstractListSelectTableModel
,AbstractTableModel
,CalendarMonthTableModel
,DefaultTableModel
,Table
A model of a table. The model is thread-safe, synchronized on itself. Any iteration over values should include synchronization on the instance of this class.
- Author:
- Garret Wilson
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
A lightweight class representing a row and column in a table. -
Method Summary
Modifier and TypeMethodDescription<C> C
getCellValue
(int rowIndex, TableColumnModel<C> column) Returns the cell value at the given row and column.<C> C
getCellValue
(TableModel.Cell<C> cell) Returns the cell value for the given cell.int
int
getColumnIndex
(TableColumnModel<?> column) Determines the logical index of the given table column.List<TableColumnModel<?>>
int
<C> void
setCellValue
(int rowIndex, TableColumnModel<C> column, C newCellValue) Sets the cell value at the given row and column.<C> void
setCellValue
(TableModel.Cell<C> cell, C newCellValue) Sets the cell value for the given cell.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
-
Method Details
-
getColumnIndex
Determines the logical index of the given table column.- 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.
-
getColumns
List<TableColumnModel<?>> getColumns()- Returns:
- A read-only list of table columns in physical order.
-
getRowCount
int getRowCount()- Returns:
- The number of rows in this table.
-
getColumnCount
int getColumnCount()- Returns:
- The number of columns in this table.
-
getCellValue
Returns the cell value for the given cell. This method delegates togetCellValue(int, TableColumnModel)
.- 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. - Throws:
IndexOutOfBoundsException
- if the given row index represents an invalid location for the table.IllegalArgumentException
- if the given column is not one of this table's columns.
-
getCellValue
Returns the cell value at the given row and column.- Type Parameters:
C
- The type of cell values in the given column.- Parameters:
rowIndex
- The zero-based row index.column
- The column for which a value should be returned.- Returns:
- The value in the cell at the given row and column, or
null
if there is no value in that cell. - Throws:
IndexOutOfBoundsException
- if the given row index represents an invalid location for the table.IllegalArgumentException
- if the given column is not one of this table's columns.
-
setCellValue
Sets the cell value for the given cell. This method delegates tosetCellValue(int, TableColumnModel, Object)
.- 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.- Throws:
IndexOutOfBoundsException
- if the given row index represents an invalid location for the table.IllegalArgumentException
- if the given column is not one of this table's columns.
-
setCellValue
Sets the cell value at the given row and column.- Type Parameters:
C
- The type of cell values in the given column.- Parameters:
rowIndex
- The zero-based row index.column
- The column for which a value should be returned.newCellValue
- The value to place in the cell at the given row and column, ornull
if there should be no value in that cell.- Throws:
IndexOutOfBoundsException
- if the given row index represents an invalid location for the table.IllegalArgumentException
- if the given column is not one of this table's columns.
-