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
public interface TableModel extends Model
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
Nested Classes Modifier and Type Interface Description static class
TableModel.Cell<C>
A lightweight class representing a row and column in a table.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <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
getColumnCount()
int
getColumnIndex(TableColumnModel<?> column)
Determines the logical index of the given table column.java.util.List<TableColumnModel<?>>
getColumns()
int
getRowCount()
<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.
-
-
-
Method Detail
-
getColumnIndex
int getColumnIndex(TableColumnModel<?> column)
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
java.util.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
<C> C getCellValue(TableModel.Cell<C> cell)
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:
java.lang.IndexOutOfBoundsException
- if the given row index represents an invalid location for the table.java.lang.IllegalArgumentException
- if the given column is not one of this table's columns.
-
getCellValue
<C> C getCellValue(int rowIndex, TableColumnModel<C> column)
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:
java.lang.IndexOutOfBoundsException
- if the given row index represents an invalid location for the table.java.lang.IllegalArgumentException
- if the given column is not one of this table's columns.
-
setCellValue
<C> void setCellValue(TableModel.Cell<C> cell, C newCellValue)
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:
java.lang.IndexOutOfBoundsException
- if the given row index represents an invalid location for the table.java.lang.IllegalArgumentException
- if the given column is not one of this table's columns.
-
setCellValue
<C> void setCellValue(int rowIndex, TableColumnModel<C> column, C newCellValue)
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:
java.lang.IndexOutOfBoundsException
- if the given row index represents an invalid location for the table.java.lang.IllegalArgumentException
- if the given column is not one of this table's columns.
-
-