Interface SingleSelection<T>

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 Details

    • present

      ObservableState present()
      Returns:
      an ObservableState indicating whether a selection is present
    • changing

      Observer<?> changing()
      To prevent a selection change, add a listener throwing a CancelException.

      Note that this is a best-effort warning mechanism, not a transactional revert: throwing a CancelException lets 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

      Value<T> item()

      Returns the Value controlling 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 Value controlling the selected item
    • clear

      void clear()
      Clears the selection
    • singleSelection

      static <T> SingleSelection<T> singleSelection()
      Type Parameters:
      T - the item type
      Returns:
      a default SingleSelection implementation