Interface MultiSelection.IndexStore

Enclosing interface:
MultiSelection<T>

public static interface MultiSelection.IndexStore

The selected indexes a MultiSelection is a view over, the one part of a selection that differs per toolkit.

A store notifies changing() before its indexes are changed by request, and changed() after they change, whoever changed them, the selection deriving its index and item values from get() on each changed().

See Also:
  • Method Details

    • get

      Set<Integer> get()
      Returns:
      an unmodifiable snapshot of the selected indexes, iterated in ascending order
    • set

      void set(Collection<Integer> indexes)

      Replaces the selected indexes. A no-op if they are unchanged, otherwise changing() is notified before and changed() after, the latter at the end of the adjustment while grouping().

      Under singleSelection() only the highest of the given indexes is selected.

      Parameters:
      indexes - the indexes to select
    • restore

      void restore(Collection<Integer> indexes)

      Replaces the selected indexes as set(Collection) does, without notifying changing().

      For a model restoring the selection after its items changed, which re-indexes the selection rather than changing it by request, see MultiSelection.Items.restore(Collection).

      Parameters:
      indexes - the indexes to select
    • size

      int size()
      Returns:
      the number of stored indexes
    • contains

      boolean contains(int index)
      Parameters:
      index - the index
      Returns:
      true if the given index is selected
    • singleSelection

      State singleSelection()
      Returns:
      the State controlling single selection mode, the selection is cleared when it changes
    • grouping

      Returns:
      the MultiSelection.Grouping instance
    • changing

      Observer<?> changing()
      Returns:
      an observer notified before the selected indexes are changed by request
      See Also:
    • changed

      Observer<?> changed()
      Returns:
      an observer notified after the selected indexes changed, by whoever changed them
    • adjusting

      Observer<?> adjusting()
      Returns:
      an observer notified on every change to the selected indexes, grouped or not, as the changes happen
      See Also: