Interface SelectionModel<T>
-
- Type Parameters:
T- the type of the items in the Grid
- All Known Implementing Classes:
MultiSelectionModelConnector.MultiSelectionModel,SelectionModel.NoSelectionModel,SingleSelectionModelConnector.SingleSelectionModel
public interface SelectionModel<T>Models the selection logic of aGridcomponent. Determines how items can be selected and deselected.- Since:
- 8.0
- Author:
- Vaadin Ltd.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSelectionModel.NoSelectionModel<T>Selection model that does not allow any selection.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddeselect(T item)Deselects the given item.voiddeselectAll()Deselects all currently selected items.static booleanisItemSelected(elemental.json.JsonObject item)Gets the selected state from a given grid row json object.booleanisMultiSelectionAllowed()Checks if the user is allowed to have more than on item selected.booleanisSelected(T item)Returns whether the given item is currently selected.booleanisSelectionAllowed()Checks if the user is allowed to change the selection.voidselect(T item)Selects the given item.voidsetSelectionAllowed(boolean selectionAllowed)Sets whether the user is allowed to change the selection.
-
-
-
Method Detail
-
select
void select(T item)
Selects the given item. If another item was already selected, that item is deselected.- Parameters:
item- the item to select, not null
-
deselect
void deselect(T item)
Deselects the given item. If the item is not currently selected, does nothing.- Parameters:
item- the item to deselect, not null
-
isSelected
boolean isSelected(T item)
Returns whether the given item is currently selected.- Parameters:
item- the item to check, not null- Returns:
trueif the item is selected,falseotherwise
-
deselectAll
void deselectAll()
Deselects all currently selected items.
-
setSelectionAllowed
void setSelectionAllowed(boolean selectionAllowed)
Sets whether the user is allowed to change the selection.The check is done only for the client side actions. It doesn't affect selection requests sent from the server side.
- Parameters:
selectionAllowed-trueif the user is allowed to change the selection,falseotherwise
-
isSelectionAllowed
boolean isSelectionAllowed()
Checks if the user is allowed to change the selection.The check is done only for the client side actions. It doesn't affect selection requests sent from the server side.
- Returns:
trueif the user is allowed to change the selection,falseotherwise
-
isMultiSelectionAllowed
boolean isMultiSelectionAllowed()
Checks if the user is allowed to have more than on item selected.- Returns:
trueif the user is allowed to select multiple items,falseotherwise- Since:
- 8.2
-
isItemSelected
static boolean isItemSelected(elemental.json.JsonObject item)
Gets the selected state from a given grid row json object. This is a helper method for grid selection models.- Parameters:
item- a json object- Returns:
trueif the json object is marked as selected;falseif not
-
-