com.vaadin.client.widget.grid.selection.
Interface SelectionModel<T>
-
Type Parameters:
T
- the type of the items in the GridAll Known Implementing Classes:
MultiSelectionModelConnector.MultiSelectionModel
,SelectionModel.NoSelectionModel
,SingleSelectionModelConnector.SingleSelectionModel
public interface SelectionModel<T>
Models the selection logic of a
Grid
component. 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 class
SelectionModel.NoSelectionModel<T>
Selection model that does not allow any selection.
-
Method Summary
All Methods Modifier and Type Method Description void
deselect(T item)
Deselects the given item.
void
deselectAll()
Deselects all currently selected items.
static boolean
isItemSelected(elemental.json.JsonObject item)
Gets the selected state from a given grid row json object.
boolean
isMultiSelectionAllowed()
Checks if the user is allowed to have more than on item selected.
boolean
isSelected(T item)
Returns whether the given item is currently selected.
boolean
isSelectionAllowed()
Checks if the user is allowed to change the selection.
void
select(T item)
Selects the given item.
void
setSelectionAllowed(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 nullReturns:
true
if the item is selected,false
otherwise
-
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
-true
if the user is allowed to change the selection,false
otherwise
-
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:
true
if the user is allowed to change the selection,false
otherwise
-
isMultiSelectionAllowed
boolean isMultiSelectionAllowed()
Checks if the user is allowed to have more than on item selected.
Returns:
true
if the user is allowed to select multiple items,false
otherwiseSince:
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 objectReturns:
true
if the json object is marked as selected;false
if not
-
-