T
- The type of items contained in the selection's domain.public interface ISelectionModel<T> extends IEnumerable<T>
This interface extends the Iterable
interface for convenient enumeration of the selected items. Use the CollectionExtensions.getEnumerator(Iterable)
to get all selected items.
EMPTY
Modifier and Type | Method and Description |
---|---|
void |
addItemSelectionChangedListener(IEventHandler<ItemSelectionChangedEventArgs<T>> itemSelectionChangedEvent)
Adds the given listener for the
ItemSelectionChanged event that occurs when an item changed its selection state
from selected to unselected or vice versa. |
void |
clear()
Clears the selection.
|
boolean |
isSelected(T item)
Determines whether an item is currently selected.
|
void |
removeItemSelectionChangedListener(IEventHandler<ItemSelectionChangedEventArgs<T>> itemSelectionChangedEvent)
Removes the given listener for the
ItemSelectionChanged event that occurs when an item changed its selection
state from selected to unselected or vice versa. |
void |
setSelected(T item,
boolean selected)
Sets the selection state of an item.
|
int |
size()
Returns the number of selected items.
|
concat, concat, create, create, enumerator, iterator, parallelStream, stream
forEach, spliterator
void addItemSelectionChangedListener(IEventHandler<ItemSelectionChangedEventArgs<T>> itemSelectionChangedEvent)
ItemSelectionChanged
event that occurs when an item changed its selection state
from selected to unselected or vice versa.itemSelectionChangedEvent
- The listener to add.setSelected(java.lang.Object, boolean)
,
removeItemSelectionChangedListener(IEventHandler)
void clear()
This is a convenience method that will set the selection state of all elements to unselected.
boolean isSelected(T item)
item
- The item to check.void removeItemSelectionChangedListener(IEventHandler<ItemSelectionChangedEventArgs<T>> itemSelectionChangedEvent)
ItemSelectionChanged
event that occurs when an item changed its selection
state from selected to unselected or vice versa.itemSelectionChangedEvent
- The listener to remove.setSelected(java.lang.Object, boolean)
,
addItemSelectionChangedListener(IEventHandler)
void setSelected(T item, boolean selected)
If the state changes, this will trigger the ItemSelectionChanged
event.
item
- The item to set the selection state for.selected
- Whether to select the object.int size()