- Type Parameters:
T- the item type
- All Known Subinterfaces:
FilterListSelection<T>,MultiSelection<T>
public interface SingleSelection<T>
A selection model managing a single selected item.
-
Method Summary
Modifier and TypeMethodDescriptionObserver<?> changing()To prevent a selection change, add a listener throwing aCancelException.voidclear()Clears the selectionitem()Returns theValuecontrolling the selected item.present()static <T> SingleSelection<T>
-
Method Details
-
present
ObservableState present()- Returns:
- an
ObservableStateindicating whether a selection is present
-
changing
Observer<?> changing()To prevent a selection change, add a listener throwing aCancelException.Note that this is a best-effort warning mechanism, not a transactional revert: throwing a
CancelExceptionlets a listener react before the change (for example to save unsaved edits), but does not roll the selection or model back to a consistent state - temporary inconsistency is tolerated.- Returns:
- an observer notified when the selection is about to change
-
item
Returns the
Valuecontrolling the selected item.Notifies when the selected item changes, and when the instance the selection refers to is replaced, as happens when the items are refreshed or replaced, the replacement being the same item by
equals()but not the same object.- Returns:
- the
Valuecontrolling the selected item
-
clear
void clear()Clears the selection -
singleSelection
- Type Parameters:
T- the item type- Returns:
- a default
SingleSelectionimplementation
-