C - the selection component typeT - the type of the selected itempublic class SingleSelectionEvent<C extends Component,T> extends AbstractField.ComponentValueChangeEvent<C,T> implements SelectionEvent<C,T>
source| Constructor and Description |
|---|
SingleSelectionEvent(C listing,
SingleSelect<C,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.
|
C |
getSource()
The listing component on which the Event initially occurred.
|
getHasValue, getOldValue, getValue, toStringisFromClient, unregisterListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisFromClientisFromClientpublic SingleSelectionEvent(C listing, SingleSelect<C,T> source, T oldSelection, boolean userOriginated)
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.public Optional<T> getSelectedItem()
AbstractField.ComponentValueChangeEvent.getValue(),
SelectionModel.Single.getSelectedItem()public C getSource()
getSource in interface SelectionEvent<C extends Component,T>getSource in class ComponentEvent<C extends Component>public Optional<T> getFirstSelectedItem()
SelectionEvent
This is the same as getSelectedItem() in
case of single selection.
getFirstSelectedItem in interface SelectionEvent<C extends Component,T>public Set<T> getAllSelectedItems()
SelectionEventThis 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<C extends Component,T>nullCopyright © 2025. All rights reserved.