Interface SelectionModel<T>
-
- Type Parameters:
T
- Grid's row type
- All Known Subinterfaces:
HasUserSelectionAllowed<T>
,SelectionModel.Multi<T>
,SelectionModel.Multi.Batched<T>
,SelectionModel.None<T>
,SelectionModel.Single<T>
- All Known Implementing Classes:
AbstractRowHandleSelectionModel
,AbstractSelectionModelConnector.AbstractSelectionModel
,MultiSelectionModelConnector.MultiSelectionModel
,SelectionModelMulti
,SelectionModelNone
,SelectionModelSingle
,SingleSelectionModelConnector.SingleSelectionModel
public interface SelectionModel<T>
Common interface for all selection models.Selection models perform tracking of selected rows in the Grid, as well as dispatching events when the selection state changes.
- Since:
- 7.4
- Author:
- Vaadin Ltd
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SelectionModel.Multi<T>
Selection model that allows for several rows to be selected at once.static interface
SelectionModel.None<T>
Interface for a selection model that does not allow anything to be selected.static interface
SelectionModel.Single<T>
Selection model that allows a maximum of one row to be selected at any one time.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<T>
getSelectedRows()
Returns a Collection containing all selected rows.Renderer<Boolean>
getSelectionColumnRenderer()
Return theRenderer
responsible for rendering the selection column.boolean
isSelected(T row)
Return true if the provided row is considered selected under the implementing selection model.void
reset()
Resets the SelectionModel to the initial state.void
setGrid(Grid<T> grid)
Tells this SelectionModel which Grid it belongs to.
-
-
-
Method Detail
-
isSelected
boolean isSelected(T row)
Return true if the provided row is considered selected under the implementing selection model.- Parameters:
row
- row object instance- Returns:
true
, if the row given as argument is considered selected.
-
getSelectionColumnRenderer
Renderer<Boolean> getSelectionColumnRenderer()
Return theRenderer
responsible for rendering the selection column.- Returns:
- a renderer instance. If null is returned, a selection column will not be drawn.
-
setGrid
void setGrid(Grid<T> grid)
Tells this SelectionModel which Grid it belongs to.Implementations are free to have this be a no-op. This method is called internally by Grid.
- Parameters:
grid
- aGrid
instance;null
when removing from Grid
-
reset
void reset()
Resets the SelectionModel to the initial state.This method can be called internally, for example, when the attached Grid's data source changes.
-
getSelectedRows
Collection<T> getSelectedRows()
Returns a Collection containing all selected rows.- Returns:
- a non-null collection.
-
-