T
- the type of the selected itempublic class SingleSelectionEvent<T> extends HasValue.ValueChangeEvent<T> implements SelectionEvent<T>
source
Constructor and Description |
---|
SingleSelectionEvent(AbstractSingleSelect<T> source,
T oldSelection,
boolean userOriginated)
Creates a new selection change event.
|
SingleSelectionEvent(Component component,
SingleSelect<T> source,
T oldSelection,
boolean userOriginated)
Creates a new selection change event in a component.
|
Modifier and Type | Method and Description |
---|---|
Set<T> |
getAllSelectedItems()
Gets all the currently selected items.
|
Optional<T> |
getFirstSelectedItem()
Get first selected data item.
|
Optional<T> |
getSelectedItem()
Returns an optional of the item that was selected, or an empty optional
if a previously selected item was deselected.
|
SingleSelect<T> |
getSource()
The single select on which the Event initially occurred.
|
getComponent, getOldValue, getValue, isUserOriginated
toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isUserOriginated
public SingleSelectionEvent(AbstractSingleSelect<T> source, T oldSelection, boolean userOriginated)
source
- the listing that fired the eventoldSelection
- the item that was previously selecteduserOriginated
- true
if this event originates from the client,
false
otherwise.public SingleSelectionEvent(Component component, SingleSelect<T> source, T oldSelection, boolean userOriginated)
component
- the 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.public Optional<T> getSelectedItem()
The result is the current selection of the source
AbstractSingleSelect
object. So it's always exactly the same as
optional describing AbstractSingleSelect.getValue()
.
HasValue.ValueChangeEvent.getValue()
,
SelectionModel.Single#getSelectedItem()
public SingleSelect<T> getSource()
getSource
in class HasValue.ValueChangeEvent<T>
public Optional<T> getFirstSelectedItem()
SelectionEvent
This is the same as getSelectedItem()
in
case of single selection and the first selected item from
MultiSelectionEvent.getNewSelection()
in case of multi selection.
getFirstSelectedItem
in interface SelectionEvent<T>
public Set<T> getAllSelectedItems()
SelectionEvent
This method applies more to multiselection - for single select it returns either an empty set or a set containing the only selected item.
getAllSelectedItems
in interface SelectionEvent<T>
null
Copyright © 2018 Vaadin Ltd. All rights reserved.