T - the data type of the selection modelpublic class MultiSelectionEvent<T> extends HasValue.ValueChangeEvent<Set<T>> implements SelectionEvent<T>
SelectionModel.Multi.source| Constructor and Description |
|---|
MultiSelectionEvent(AbstractMultiSelect<T> source,
Set<T> oldSelection,
boolean userOriginated)
Creates a new event.
|
MultiSelectionEvent(Component component,
MultiSelect<T> source,
Set<T> oldSelection,
boolean userOriginated)
Creates a new selection change event in a multiselect component.
|
| Modifier and Type | Method and Description |
|---|---|
Set<T> |
getAddedSelection()
Gets the items that were added to selection.
|
Set<T> |
getAllSelectedItems()
Gets all the currently selected items.
|
Optional<T> |
getFirstSelectedItem()
Get first selected data item.
|
Set<T> |
getNewSelection()
Gets the new selection.
|
Set<T> |
getOldSelection()
Gets the old selection.
|
Set<T> |
getRemovedSelection()
Gets the items that were removed from selection.
|
MultiSelect<T> |
getSource()
The multiselect on which the Event initially occurred.
|
getComponent, getOldValue, getValue, isUserOriginatedtoStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisUserOriginatedpublic MultiSelectionEvent(AbstractMultiSelect<T> source, Set<T> oldSelection, boolean userOriginated)
source - the listing component in which the selection changedoldSelection - the old set of selected itemsuserOriginated - true if this event originates from the client,
false otherwise.public MultiSelectionEvent(Component component, MultiSelect<T> source, Set<T> oldSelection, boolean userOriginated)
component - the componentsource - the multiselect sourceoldSelection - the old set of selected itemsuserOriginated - true if this event originates from the client,
false otherwise.public Set<T> getNewSelection()
The result is the current selection of the source
AbstractMultiSelect object. So it's always exactly the same as
AbstractMultiSelect.getValue()
HasValue.ValueChangeEvent.getValue()public Set<T> getOldSelection()
public Set<T> getRemovedSelection()
This is just a convenience method for checking what was previously
selected in getOldSelection() but not selected anymore in
getNewSelection().
public Set<T> getAddedSelection()
This is just a convenience method for checking what is new selected in
getNewSelection() and wasn't selected in
getOldSelection().
public Optional<T> getFirstSelectedItem()
SelectionEvent
This is the same as SingleSelectionEvent.getSelectedItem() in
case of single selection and the first selected item from
getNewSelection() in case of multi selection.
getFirstSelectedItem in interface SelectionEvent<T>public MultiSelect<T> getSource()
getSource in class HasValue.ValueChangeEvent<Set<T>>public Set<T> getAllSelectedItems()
This method applies more to multiselection - for single select it returns either an empty set or a set containing the only selected item.
This is the same as HasValue.ValueChangeEvent.getValue().
getAllSelectedItems in interface SelectionEvent<T>nullCopyright © 2017 Vaadin Ltd. All rights reserved.