All Known Subinterfaces:
ListSelectionHandler<E>, SelectableList<E>

public interface Selectable
Interface to describe selection related actions of objects containing a list of selectable items.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Enum to describe selection related actions.
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    getSourceIndex(int index)
    Returns the source index of an index transformation for the given index.
    default void
    Invert the selection status of all items.
    boolean
    isSelected(int index)
    Returns true, iff the item at the given index is selected.
    default void
    select(int index, Selectable.Action action)
    Set the selection status of item at index according to the given action.
    default void
    Set all items selected.
    default void
    Set the selection status of all list items according to the given action.
    default void
    Set all items unselected.
    void
    selectRange(int from, int to, Selectable.Action action)
    Select the list items in the range [from, to[ according to the given action.
    default void
    selectRangeBidirectional(int from, int to, boolean value)
    Select the list items in the closed range between from and to with possibly to < from.
    default void
    selectRangeBidirectional(int from, int to, Selectable.Action action)
    Select the list items in the closed range between from and to with possibly to < from.
    default void
    setSelected(int index, boolean value)
    Set the selection status of item at index to value.
    int
    Return the number of list items.
  • Method Details

    • size

      int size()
      Return the number of list items.
      Returns:
      the number of list items
    • getSourceIndex

      default int getSourceIndex(int index)
      Returns the source index of an index transformation for the given index.
      Parameters:
      index - the given index
      Returns:
      the source index of an index transformation for the given index. The default implementation assumes the identity transformation, that is it returns the given index.
    • isSelected

      boolean isSelected(int index)
      Returns true, iff the item at the given index is selected.
      Parameters:
      index - the given index
      Returns:
      true, iff the item at the given index is selected
    • selectRange

      void selectRange(int from, int to, Selectable.Action action)
      Select the list items in the range [from, to[ according to the given action. The indices work like:
      for (int i = from; i < to; i++)
      Parameters:
      from - the beginning of the index range (including)
      to - the end of the index range (excluding)
      action - the selection action to apply, null is a no-op
    • selectRangeBidirectional

      default void selectRangeBidirectional(int from, int to, Selectable.Action action)
      Select the list items in the closed range between from and to with possibly to < from. The indices work like:
      for (int i = min(from, to); i ≤ max(from, to); i++)
      Parameters:
      from - the beginning of the index range (including)
      to - the end of the index range (including)
      action - the selection action to apply
    • selectRangeBidirectional

      default void selectRangeBidirectional(int from, int to, boolean value)
      Select the list items in the closed range between from and to with possibly to < from. The indices work like:
      for (int i = min(from, to); i ≤ max(from, to); i++)
      Parameters:
      from - the beginning of the index range (including)
      to - the end of the index range (including)
      value - the given value
    • setSelected

      default void setSelected(int index, boolean value)
      Set the selection status of item at index to value.
      Parameters:
      index - the given index
      value - the given value
    • select

      default void select(int index, Selectable.Action action)
      Set the selection status of item at index according to the given action.
      Parameters:
      index - the given index
      action - the given action
    • selectAll

      default void selectAll(Selectable.Action action)
      Set the selection status of all list items according to the given action.
      Parameters:
      action - the given action
    • selectAll

      default void selectAll()
      Set all items selected.
    • selectNone

      default void selectNone()
      Set all items unselected.
    • invertSelection

      default void invertSelection()
      Invert the selection status of all items.