Interface MultiSelection.Items<R>
- Type Parameters:
R- the item type
- Enclosing interface:
MultiSelection<T>
Manages the selected items.
An item may be equal to several of the items, at different indexes. Each item given to set(Collection),
add(Collection) or restore(Collection) selects an index of its own, in order of preference:
- an index holding the same instance
- an index holding an equal item
remove(Object) and contains(Object) cover every selected index holding an equal
item, and get() holds the item at each selected index, so that set(get()) and add(get())
leave the selection as is.-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.common.reactive.value.Value
Value.Builder<T,B extends Value.Builder<T, B>>, Value.BuilderFactory, Value.Locked, Value.Notify, Value.Validator<T> -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Collection<R> items) Adds the given items to the selectionvoidAdds the items passing the predicate test to the selectionvoidAdds the given item to the selectionbooleanget()voidremove(Collection<R> items) Removes the given items from the selection, at every selected index holding an equal itemvoidRemoves the given item from the selection, at every selected index holding an equal itemvoidrestore(Collection<R> items) Selects the given items without notifyingMultiSelection.changing(), the ones not found among the indexed items left out.voidset(Collection<R> items) voidSets the items passing the predicate test as the selectionMethods inherited from interface is.codion.common.reactive.observer.Observable
changed, getOrThrow, getOrThrow, is, isNot, isNull, isNullable, optionalMethods inherited from interface is.codion.common.reactive.observer.Observer
addConsumer, addListener, addWeakConsumer, addWeakListener, observer, removeConsumer, removeListener, removeWeakConsumer, removeWeakListener, when, whenMethods inherited from interface is.codion.common.reactive.value.Value
addValidator, clear, link, link, locked, observable, removeValidator, set, unlink, unlink, update, validate
-
Method Details
-
get
- Specified by:
getin interfaceObservable<R>- Returns:
- the value
-
set
- Parameters:
items- the items to select
-
set
Sets the items passing the predicate test as the selection- Parameters:
predicate- the predicate
-
restore
Selects the given items without notifying
MultiSelection.changing(), the ones not found among the indexed items left out.For a model restoring the selection after its items changed: the selected items having moved, been replaced or removed, the selection follows along, rather than being changed by request, which is what
MultiSelection.changing()is for.The current selection is not consulted, a view may have shifted or cleared it while the items changed. An item selects the index holding the same instance, which sorting and filtering keep, otherwise the first one holding an equal item, so an item replaced by an equal one, as by a refresh, or removed while an equal one remains, selects the first equal one not selected along with it.
- Parameters:
items- the items to select- See Also:
-
add
Adds the items passing the predicate test to the selection- Parameters:
predicate- the predicate
-
add
Adds the given item to the selection- Parameters:
item- the item to add to the selection
-
add
Adds the given items to the selection- Parameters:
items- the items to add to the selection
-
remove
Removes the given item from the selection, at every selected index holding an equal item- Parameters:
item- the item to remove from the selection
-
remove
Removes the given items from the selection, at every selected index holding an equal item- Parameters:
items- the items to remove from the selection
-
contains
- Parameters:
item- the item- Returns:
- true if an item equal to the given one is selected, at any index
-