C - the selection component typeT - the type of the items to selectpublic interface MultiSelect<C extends Component,T> extends HasValueAndElement<AbstractField.ComponentValueChangeEvent<C,Set<T>>,Set<T>>
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>| Modifier and Type | Method and Description |
|---|---|
Registration |
addSelectionListener(MultiSelectionListener<C,T> listener)
Adds a selection listener that will be called when the selection is
changed either by the user or programmatically.
|
default void |
deselect(Iterable<T> items)
Removes the given items from the set of currently selected items.
|
default void |
deselect(T... items)
Removes the given items from the set of currently selected items.
|
default void |
deselectAll()
Deselects all currently selected items.
|
default Set<T> |
getEmptyValue()
MultiSelect empty value should always be an empty set by default and not
null. |
Set<T> |
getSelectedItems()
Returns an immutable set of the currently selected items.
|
default Set<T> |
getValue()
Returns the current value of this object.
|
default boolean |
isSelected(T item)
Returns whether the given item is currently selected.
|
default void |
select(Iterable<T> items)
Adds the given items to the set of currently selected items.
|
default void |
select(T... items)
Adds the given items to the set of currently selected items.
|
default void |
setValue(Set<T> value)
Sets the value of this object.
|
void |
updateSelection(Set<T> addedItems,
Set<T> removedItems)
Updates the selection by adding and removing the given items from it.
|
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisibleaddValueChangeListener, clear, getOptionalValue, isEmptyisEnabled, setEnabledgetElementdefault void select(T... 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.
items - to add to selection, not nulldefault void deselect(T... 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.
items - to remove from selection, not nulldefault void select(Iterable<T> 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.
items - to add to selection, not nulldefault void deselect(Iterable<T> 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.
items - to remove from selection, not nullvoid updateSelection(Set<T> addedItems, Set<T> removedItems)
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.
addedItems - the items to add, not nullremovedItems - the items to remove, not nullSet<T> getSelectedItems()
SelectionModel methods 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.
nulldefault void deselectAll()
default boolean isSelected(T item)
item - the item to check, not nulltrue if the item is selected, false otherwiseRegistration addSelectionListener(MultiSelectionListener<C,T> listener)
listener - the value change listener, not nulldefault Set<T> getEmptyValue()
null.getEmptyValue in interface HasValue<AbstractField.ComponentValueChangeEvent<C extends Component,Set<T>>,Set<T>>nulldefault Set<T> getValue()
HasValue
Implementation note: the implementing class should document
whether null values may be returned or not, and override
HasValue.getEmptyValue() if the empty value is not null.
default void setValue(Set<T> value)
HasValuegetValue(), fires a value change event. May throw
IllegalArgumentException if the value is not acceptable.
Implementation note: the implementing class should document
whether null values are accepted or not, and override
HasValue.getEmptyValue() if the empty value is not null.
Copyright © 2025. All rights reserved.