Interface SelectionModel.Multi<C extends Component,T>
-
- Type Parameters:
T- the type of the items to selectC- the component type
- All Superinterfaces:
SelectionModel<C,T>,Serializable
- All Known Subinterfaces:
GridMultiSelectionModel<T>
- All Known Implementing Classes:
AbstractGridMultiSelectionModel
- Enclosing interface:
- SelectionModel<C extends Component,T>
public static interface SelectionModel.Multi<C extends Component,T> extends SelectionModel<C,T>
A selection model in which multiple items can be selected at the same time. Selecting an item adds it to the selection.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.flow.data.selection.SelectionModel
SelectionModel.Multi<C extends Component,T>, SelectionModel.Single<C extends Component,T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voiddeselect(T item)Deselects the given item.default voiddeselectItems(T... items)Removes the given items from the set of currently selected items.default Optional<T>getFirstSelectedItem()Get first selected data item.default voidselect(T item)Adds the given item to the set of currently selected items.voidselectAll()Selects all available the items.default voidselectItems(T... items)Adds the given items to the set of currently selected items.voidupdateSelection(Set<T> addedItems, Set<T> removedItems)Updates the selection by adding and removing the given items from it.-
Methods inherited from interface com.vaadin.flow.data.selection.SelectionModel
addSelectionListener, deselectAll, getSelectedItems, isSelected
-
-
-
-
Method Detail
-
select
default void select(T item)
Adds the given item to the set of currently selected items.By default this does not clear any previous selection. To do that, use
SelectionModel.deselectAll().If the item was already selected, this is a NO-OP.
- Specified by:
selectin interfaceSelectionModel<C extends Component,T>- Parameters:
item- the item to add to selection, notnull
-
selectItems
default void selectItems(T... items)
Adds the given items to the set of currently selected items.By default this does not clear any previous selection. To do that, use
SelectionModel.deselectAll().If the all the items were already selected, this is a NO-OP.
This is a short-hand for
updateSelection(Set, Set)with nothing to deselect.- Parameters:
items- to add to selection, notnull
-
deselect
default void deselect(T item)
Description copied from interface:SelectionModelDeselects the given item. If the item is not currently selected, does nothing.- Specified by:
deselectin interfaceSelectionModel<C extends Component,T>- Parameters:
item- the item to deselect, not null
-
deselectItems
default void deselectItems(T... items)
Removes the given items from the set of currently selected items.If the none of the items were selected, this is a NO-OP.
This is a short-hand for
updateSelection(Set, Set)with nothing to select.- Parameters:
items- to remove from selection, notnull
-
updateSelection
void updateSelection(Set<T> addedItems, Set<T> removedItems)
Updates the selection by adding and removing the given items from it.If all the added items were already selected and the removed items were not selected, this is a NO-OP.
Duplicate items (in both add & remove sets) are ignored.
- Parameters:
addedItems- the items to add, notnullremovedItems- the items to remove, notnull
-
getFirstSelectedItem
default Optional<T> getFirstSelectedItem()
Description copied from interface:SelectionModelGet first selected data item.This is the same as
SelectionModel.Single.getSelectedItem()in case of single selection and the first selected item fromSelectionModel.getSelectedItems()in case of multiselection.- Specified by:
getFirstSelectedItemin interfaceSelectionModel<C extends Component,T>- Returns:
- the first selected item.
-
selectAll
void selectAll()
Selects all available the items.
-
-