T
- the type of the items to selectC
- the component typepublic interface SelectionModel<C extends Component,T> extends Serializable
Listing
component. Determines how
items can be selected and deselected.Modifier and Type | Interface and Description |
---|---|
static interface |
SelectionModel.Multi<C extends Component,T>
A selection model in which multiple items can be selected at the same
time.
|
static interface |
SelectionModel.Single<C extends Component,T>
A selection model in which at most one item can be selected at a time.
|
Modifier and Type | Method and Description |
---|---|
Registration |
addSelectionListener(SelectionListener<C,T> listener)
Adds a generic listener to this selection model, accepting both single
and multiselection events.
|
void |
deselect(T item)
Deselects the given item.
|
void |
deselectAll()
Deselects all currently selected items, if any.
|
Optional<T> |
getFirstSelectedItem()
Get first selected data item.
|
Set<T> |
getSelectedItems()
Returns an immutable set of the currently selected items.
|
default boolean |
isSelected(T item)
Returns whether the given item is currently selected.
|
void |
select(T item)
Selects the given item.
|
Set<T> getSelectedItems()
SelectionModel
methods while iterating over the set.
Implementation note: the iteration order of the items in the returned set should be well-defined and documented by the implementing class.
Optional<T> getFirstSelectedItem()
This is the same as SelectionModel.Single.getSelectedItem()
in case of single
selection and the first selected item from
getSelectedItems()
in case of multiselection.
void select(T item)
item
- the item to select, not nullvoid deselect(T item)
item
- the item to deselect, not nullvoid deselectAll()
default boolean isSelected(T item)
item
- the item to check, not nulltrue
if the item is selected, false
otherwiseRegistration addSelectionListener(SelectionListener<C,T> listener)
listener
- the listener to add, not null
Copyright © 2020. All rights reserved.