Interface MultiSelect<C extends com.vaadin.flow.component.Component,T>
- Type Parameters:
C- the selection component typeT- the type of the items to select
- All Superinterfaces:
com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,,Set<T>>, Set<T>> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,,Set<T>>, Set<T>> Serializable
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddSelectionListener(MultiSelectionListener<C, T> listener) Adds a selection listener that will be called when the selection is changed either by the user or programmatically.default voidRemoves the given items from the set of currently selected items.default voidRemoves the given items from the set of currently selected items.default voidDeselects all currently selected items.MultiSelect empty value should always be an empty set by default and notnull.Returns an immutable set of the currently selected items.getValue()default booleanisSelected(T item) Returns whether the given item is currently selected.default voidAdds the given items to the set of currently selected items.default voidAdds the given items to the set of currently selected items.default voidvoidupdateSelection(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.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, bindValue, clear, getOptionalValue, isEmptyMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
Method Details
-
select
Adds the given items to the set of currently selected items.By default this does not clear any previous selection. To do that, use
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
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
-
select
Adds the given items to the set of currently selected items.By default this does not clear any previous selection. To do that, use
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
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
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 and remove sets) are ignored.
- Parameters:
addedItems- the items to add, notnullremovedItems- the items to remove, notnull
-
getSelectedItems
Returns an immutable set of the currently selected items. It is safe to invoke otherSelectionModelmethods while iterating over the set.Implementation note: the iteration order of the items in the returned set should be well-defined and documented by the implementing class.
- Returns:
- the items in the current selection, not
null
-
deselectAll
default void deselectAll()Deselects all currently selected items. -
isSelected
Returns whether the given item is currently selected.- Parameters:
item- the item to check, notnull- Returns:
trueif the item is selected,falseotherwise
-
addSelectionListener
Adds a selection listener that will be called when the selection is changed either by the user or programmatically.- Parameters:
listener- the value change listener, notnull- Returns:
- a registration for the listener
-
getEmptyValue
MultiSelect empty value should always be an empty set by default and notnull. -
getValue
-
setValue
-