- Type Parameters:
T
- the type of items
- All Superinterfaces:
SingleSelection<T>
- All Known Subinterfaces:
FilterListSelection<T>
A selection model managing multiple selected items.
When multiple items are selected, the inherited SingleSelection
index()
and SingleSelection.item()
methods represent the minimum selected index
and its corresponding item. If the selection is empty, index()
returns -1
and SingleSelection.item()
returns null.
Examples:
- Selected indexes [2, 5, 8] →
index().get()
returns 2,item().get()
returns item at index 2 - Selected indexes [7] →
index().get()
returns 7,item().get()
returns item at index 7 - No selection →
index().get()
returns -1,item().get()
returns null
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Manages the selected indexes.static interface
Manages the selected items. -
Method Summary
Modifier and TypeMethodDescriptionvoid
adjusting
(boolean adjusting) Indicates whether the subsequent selection events should be grouped and not triggered individuallyint
count()
index()
Returns theValue
controlling the selected index.indexes()
items()
multiple()
void
Selects all itemssingle()
Methods inherited from interface is.codion.common.model.selection.SingleSelection
changing, clear, empty, item
-
Method Details
-
multiple
ObservableState multiple()- Returns:
- an
ObservableState
indicating whether multiple items are selected
-
single
ObservableState single()- Returns:
- an
ObservableState
indicating whether a single item is selected
-
singleSelection
State singleSelection()- Returns:
- the
State
controlling whether single selection mode is enabled
-
index
Returns theValue
controlling the selected index.In a multi-selection context, this represents the minimum selected index. When multiple items are selected, this value tracks the lowest index among the selected items. The value's
get()
method returns -1 if the selection is empty.- Returns:
- the
Value
controlling the minimum selected index, whoseget()
method returns -1 if selection is empty
-
indexes
MultiSelection.Indexes indexes()- Returns:
- the
MultiSelection.Indexes
controlling the selected indexes
-
items
MultiSelection.Items<T> items()- Returns:
- the
MultiSelection.Items
controlling the selected items
-
selectAll
void selectAll()Selects all items- See Also:
-
count
int count()- Returns:
- the number of selected items.
-
adjusting
void adjusting(boolean adjusting) Indicates whether the subsequent selection events should be grouped and not triggered individually- Parameters:
adjusting
- true if subsequent selection events should be grouped
-