Package 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 item
- All 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
-
Method Summary
Modifier and TypeMethodDescriptionGets the items that were added to selection.Gets all the currently selected items.Get first selected data item.Gets the old selection.Gets the items that were removed from selection.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.component.HasValue.ValueChangeEvent
isFromClient
Methods inherited from interface com.vaadin.flow.data.selection.SelectionEvent
getSource, isFromClient
-
Constructor Details
-
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 Details
-
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
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
Gets the current selection.- Specified by:
getValue
in interfaceHasValue.ValueChangeEvent<C extends Component>
- Overrides:
getValue
in classAbstractField.ComponentValueChangeEvent<C extends Component,
Set<T>> - Returns:
- an unmodifiable set of items selected after the selection was changed
-
getOldSelection
Gets the old selection.- Returns:
- an unmodifiable set of items selected before the selection was changed
-
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 ingetValue()
.- Returns:
- the items that were removed from selection
-
getAddedSelection
Gets the items that were added to selection.This is just a convenience method for checking what is new selected in
getValue()
and wasn't selected ingetOldSelection()
.- Returns:
- the items that were removed from selection
-