Package io.guise.framework.model
Class AbstractListSelectTableModel<V>
java.lang.Object
com.globalmentor.beans.BoundPropertyObject
io.guise.framework.model.AbstractModel
io.guise.framework.model.AbstractValueModel<V>
io.guise.framework.model.DefaultListSelectModel<V>
io.guise.framework.model.AbstractListSelectTableModel<V>
- Type Parameters:
V
- The type of values representing table rows.
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,com.globalmentor.model.MutableValued<V>
,com.globalmentor.model.Valued<V>
,ListListenable<V>
,ListSelectModel<V>
,Model
,SelectModel<V>
,TableModel
,ValueModel<V>
,Iterable<V>
,Collection<V>
,List<V>
public abstract class AbstractListSelectTableModel<V>
extends DefaultListSelectModel<V>
implements TableModel
An abstract implementation of a table model representing selectable list values. 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/interfaces inherited from class io.guise.framework.model.DefaultListSelectModel
DefaultListSelectModel.ValueState
Nested classes/interfaces inherited from interface io.guise.framework.model.TableModel
TableModel.Cell<C>
-
Field Summary
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
Fields inherited from interface io.guise.framework.model.ValueModel
VALIDATOR_PROPERTY, VALUE_PROPERTY
-
Constructor Summary
ConstructorDescriptionAbstractListSelectTableModel
(Class<V> valueClass, ListSelectionPolicy<V> listSelectionStrategy, TableColumnModel<?>... columns) Constructs a list select table model indicating the type of values it can hold.AbstractListSelectTableModel
(Class<V> valueClass, TableColumnModel<?>... columns) Constructs a list select table model indicating the type of values it can hold, using a default multiple selection strategy. -
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.protected abstract <C> C
getCellValue
(V value, int rowIndex, TableColumnModel<C> column) Returns the value's property for the given column.getCellValueModel
(int rowIndex, int colIndex) Returns the model representing the cell value at the given row and column.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.protected abstract <C> void
setCellValue
(V value, int rowIndex, TableColumnModel<C> column, C newCellValue) Sets the value's property for the given column.Methods inherited from class io.guise.framework.model.DefaultListSelectModel
add, add, addAll, addAll, addListListener, addListSelectionListener, addSelectedIndexes, clear, clearValue, contains, containsAll, fireListModified, fireSelectionChanged, get, getDefaultValue, getSelectedIndex, getSelectedIndexes, getSelectedValue, getSelectedValues, getSelectionPolicy, getValue, indexOf, isEmpty, isIndexDisplayed, isIndexEnabled, isValueDisplayed, isValueEnabled, iterator, lastIndexOf, listIterator, listIterator, listModified, remove, remove, removeAll, removeListListener, removeListSelectionListener, removeSelectedIndexes, replace, resetValue, retainAll, set, setIndexDisplayed, setIndexEnabled, setSelectedIndexes, setSelectedValues, setValue, setValueDisplayed, setValueEnabled, size, subList, toArray, toArray
Methods inherited from class io.guise.framework.model.AbstractValueModel
createPropertyVetoException, getValidator, getValueClass, isValidValue, setValidator, validateValue
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 java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
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.ValueModel
getValidator, getValueClass, isValidValue, setValidator, validateValue
-
Constructor Details
-
AbstractListSelectTableModel
Constructs a list select table model indicating the type of values it can hold, using a default multiple selection strategy.- Parameters:
valueClass
- The class indicating the type of values held in the model.columns
- The models representing the table columns.- Throws:
NullPointerException
- if the given value class isnull
.
-
AbstractListSelectTableModel
public AbstractListSelectTableModel(Class<V> valueClass, ListSelectionPolicy<V> listSelectionStrategy, TableColumnModel<?>... columns) Constructs a list select table model indicating the type of values it can hold. The selection strategy is not added as a listener to this model but is rather notified manually so that the event won't be delayed and/or sent out of order- Parameters:
valueClass
- The class indicating the type of values held in the model.listSelectionStrategy
- The strategy for selecting values in the model.columns
- The models representing the table columns.- Throws:
NullPointerException
- if the given value class and/or selection strategy isnull
.
-
-
Method Details
-
getColumnIndex
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.
-
getColumns
- Specified by:
getColumns
in interfaceTableModel
- Returns:
- A read-only list of table columns in physical order.
-
getRowCount
public int getRowCount()- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- The number of rows in this table.
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- The number of columns in this table.
-
getCellValueModel
Returns the model representing the cell value at the given row and column.- Parameters:
rowIndex
- The zero-based row index.colIndex
- The zero-based column index.- Returns:
- The value model representing the value in the cell at the given row and column.
- Throws:
IndexOutOfBoundsException
- if the given row index and/or column index represents an invalid location for the table.
-
getCellValue
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.
-
getCellValue
Description copied from interface:TableModel
Returns the cell value at the given row and column.- Specified by:
getCellValue
in interfaceTableModel
- 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.
-
setCellValue
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.
-
setCellValue
Description copied from interface:TableModel
Sets the cell value at the given row and column.- Specified by:
setCellValue
in interfaceTableModel
- 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.
-
getCellValue
Returns the value's property for the given column.- Type Parameters:
C
- The type of cell values in the given column.- Parameters:
value
- The value in this list select model.rowIndex
- The zero-based row index of the value.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
protected abstract <C> void setCellValue(V value, int rowIndex, TableColumnModel<C> column, C newCellValue) Sets the value's property for the given column.- Type Parameters:
C
- The type of cell values in the given column.- Parameters:
value
- The value in this list select model.rowIndex
- The zero-based row index of the value.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.
-