T
- the type of the items to selectpublic interface MultiSelect<T> extends HasValue<Set<T>>
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<V>
Modifier and Type | Method and Description |
---|---|
Registration |
addSelectionListener(MultiSelectionListener<T> listener)
Adds a selection listener that will be called when the selection is
changed either by the user or programmatically.
|
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 boolean |
isSelected(T item)
Returns whether the given item is currently selected.
|
default void |
select(T... items)
Adds the given items to the set of currently selected items.
|
void |
updateSelection(Set<T> addedItems,
Set<T> removedItems)
Updates the selection by adding and removing the given items from it.
|
addValueChangeListener, clear, getDefaultValidator, getOptionalValue, getValue, isEmpty, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible, setValue
default 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 null
default 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 null
void 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 & remove sets) are ignored.
addedItems
- the items to add, not null
removedItems
- the items to remove, not null
Set<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.
default void deselectAll()
default boolean isSelected(T item)
item
- the item to check, not nulltrue
if the item is selected, false
otherwiseRegistration addSelectionListener(MultiSelectionListener<T> listener)
listener
- the value change listener, not null
default Set<T> getEmptyValue()
null
.getEmptyValue
in interface HasValue<Set<T>>
null
Binder#bind(HasValue, ValueProvider, Setter)
Copyright © 2018 Vaadin Ltd. All rights reserved.