Package com.vaadin.event.selection
Interface SelectionEvent<T>
-
- Type Parameters:
T- the data type of the selection model
- All Superinterfaces:
HasUserOriginated,java.io.Serializable
- All Known Implementing Classes:
MultiSelectionEvent,SingleSelectionEvent
public interface SelectionEvent<T> extends HasUserOriginated
A selection event that unifies the way to access to selection event for multi selection and single selection components (in case when only one selected item is required).- Since:
- 8.0
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Set<T>getAllSelectedItems()Gets all the currently selected items.java.util.Optional<T>getFirstSelectedItem()Get first selected data item.-
Methods inherited from interface com.vaadin.event.HasUserOriginated
isUserOriginated
-
-
-
-
Method Detail
-
getFirstSelectedItem
java.util.Optional<T> getFirstSelectedItem()
Get first selected data item.This is the same as
SingleSelectionEvent.getSelectedItem()in case of single selection and the first selected item fromMultiSelectionEvent.getNewSelection()in case of multi selection.- Returns:
- the first selected item.
-
getAllSelectedItems
java.util.Set<T> getAllSelectedItems()
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.
- Returns:
- return all the selected items, if any, never
null
-
-