T - the type of the items contained by this componentpublic class MultiSelectListBox<T> extends ListBoxBase<MultiSelectListBox<T>,T,Set<T>> implements MultiSelect<MultiSelectListBox<T>,T>
vaadin-list-box element with
multi-selection.ListBox,
Serialized FormAbstractField.ComponentValueChangeEvent<C extends Component,V>HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>HasItemsAndComponents.ItemComponent<T>| Constructor and Description |
|---|
MultiSelectListBox()
Creates a new list box component with multi-selection.
|
| Modifier and Type | Method and Description |
|---|---|
Registration |
addSelectionListener(MultiSelectionListener<MultiSelectListBox<T>,T> listener)
Adds a selection listener that will be called when the selection is
changed either by the user or programmatically.
|
Set<T> |
getSelectedItems()
Returns an immutable set of the currently selected items.
|
void |
setValue(Set<T> value)
Sets the value of this component.
|
void |
updateSelection(Set<T> addedItems,
Set<T> removedItems)
Updates the selection by adding and removing the given items from it.
|
getDataProvider, getItemEnabledProvider, getItemRenderer, onAttach, onDetach, onEnabledStateChanged, setDataProvider, setItemEnabledProvider, setRenderer, setRequiredIndicatorVisiblegetSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventaddValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeselect, deselect, deselectAll, getEmptyValue, getValue, isSelected, select, selectisReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisibleaddValueChangeListener, clear, getOptionalValue, isEmptyisEnabled, setEnabledgetElementaddComponents, getItemPosition, prependComponentsadd, add, addComponentAsFirst, addComponentAtIndex, remove, removeAllsetItemsgetCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFulladdAttachListeneraddDetachListenerpublic MultiSelectListBox()
public void setValue(Set<T> value)
The component doesn't accept null values. The value of multi
select list box without any selected items is an empty set. You can use
the HasValue.clear() method to set the empty value.
setValue in interface HasValue<AbstractField.ComponentValueChangeEvent<MultiSelectListBox<T>,Set<T>>,Set<T>>setValue in interface MultiSelect<MultiSelectListBox<T>,T>setValue in class AbstractField<MultiSelectListBox<T>,Set<T>>value - the new value to set, not nullNullPointerException - if value is nullpublic void updateSelection(Set<T> addedItems, Set<T> removedItems)
MultiSelectIf 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.
updateSelection in interface MultiSelect<MultiSelectListBox<T>,T>addedItems - the items to add, not nullremovedItems - the items to remove, not nullpublic Set<T> getSelectedItems()
SelectionModel methods while iterating over the set.
There are no guarantees of the iteration order of the returned set of items.
getSelectedItems in interface MultiSelect<MultiSelectListBox<T>,T>nullpublic Registration addSelectionListener(MultiSelectionListener<MultiSelectListBox<T>,T> listener)
MultiSelectaddSelectionListener in interface MultiSelect<MultiSelectListBox<T>,T>listener - the value change listener, not nullCopyright © 2025. All rights reserved.