com.vaadin.flow.data.selection.
Class MultiSelectionEvent<C extends Component,T>
- java.lang.Object
-
- java.util.EventObject
-
- com.vaadin.flow.component.ComponentEvent<C>
-
- com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,Set<T>>
-
- com.vaadin.flow.data.selection.MultiSelectionEvent<C,T>
-
Type Parameters:
C
- the selection component typeT
- the type of the selected itemAll Implemented Interfaces:
HasValue.ValueChangeEvent<Set<T>>, SelectionEvent<C,T>, Serializable
public class MultiSelectionEvent<C extends Component,T> extends AbstractField.ComponentValueChangeEvent<C,Set<T>> implements SelectionEvent<C,T>
Fired when the selection changes in a listing component that supports multiple item selection.
Since:
1.0.
Author:
Vaadin Ltd
See Also:
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor and Description MultiSelectionEvent(C listing, HasValue<AbstractField.ComponentValueChangeEvent<C,Set<T>>,Set<T>> source, Set<T> oldSelection, boolean userOriginated)
Creates a new multi selection change event in a component.
-
Method Summary
All Methods 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.
Set<T>
getValue()
Gets the current selection.
-
Methods inherited from class com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent
getHasValue, getOldValue, toString
-
Methods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.data.selection.SelectionEvent
getSource, isFromClient
-
Methods inherited from interface com.vaadin.flow.component.HasValue.ValueChangeEvent
isFromClient
-
-
-
-
Constructor Detail
-
MultiSelectionEvent
public MultiSelectionEvent(C listing, HasValue<AbstractField.ComponentValueChangeEvent<C,Set<T>>,Set<T>> source, Set<T> oldSelection, boolean userOriginated)
Creates a new multi selection change event in a component.
Parameters:
listing
- the listing component where the event originatedsource
- the single select sourceoldSelection
- the item that was previously selecteduserOriginated
-true
if this event originates from the client,false
otherwise.
-
-
Method Detail
-
getFirstSelectedItem
public Optional<T> getFirstSelectedItem()
Description copied from interface:
SelectionEvent
Get first selected data item.
This is the same as
SingleSelectionEvent.getSelectedItem()
in case of single selection.Specified by:
getFirstSelectedItem
in interfaceSelectionEvent<C extends Component,T>
Returns:
the first selected item.
-
getAllSelectedItems
public Set<T> getAllSelectedItems()
Description copied from interface:
SelectionEvent
Gets all the currently selected items.
This method applies more to multiselection - for single select it returns either an empty set or a set containing the only selected item.
Specified by:
getAllSelectedItems
in interfaceSelectionEvent<C extends Component,T>
Returns:
return all the selected items, if any, never
null
-
getValue
public Set<T> getValue()
Gets the current selection.
Specified by:
getValue
in interfaceHasValue.ValueChangeEvent<Set<T>>
Overrides:
getValue
in classAbstractField.ComponentValueChangeEvent<C extends Component,Set<T>>
Returns:
an unmodifiable set of items selected after the selection was changed
-
getNewSelection
public Set<T> getNewSelection()
Gets the new selection.
The result is the current selection of the source listing. So it's always exactly the same as
getValue()
.Returns:
an unmodifiable set of items selected after the selection was changed
See Also:
-
getOldSelection
public Set<T> getOldSelection()
Gets the old selection.
Returns:
an unmodifiable set of items selected before the selection was changed
-
getRemovedSelection
public Set<T> getRemovedSelection()
Gets the items that were removed from selection.
This is just a convenience method for checking what was previously selected in
getOldSelection()
but not selected anymore ingetNewSelection()
.Returns:
the items that were removed from selection
-
getAddedSelection
public Set<T> getAddedSelection()
Gets the items that were added to selection.
This is just a convenience method for checking what is new selected in
getNewSelection()
and wasn't selected ingetOldSelection()
.Returns:
the items that were removed from selection
-
-