Interface SelectionModel.Multi<C extends Component,T>

Type Parameters:
T - the type of the items to select
C - the component type
All Superinterfaces:
SelectionModel<C,T>, Serializable
All Known Subinterfaces:
GridMultiSelectionModel<T>
All Known Implementing Classes:
AbstractGridMultiSelectionModel
Enclosing interface:
SelectionModel<C extends Component,T>

public static interface SelectionModel.Multi<C extends Component,T> extends SelectionModel<C,T>
A selection model in which multiple items can be selected at the same time. Selecting an item adds it to the selection.
  • Method Details

    • select

      default void select(T item)
      Adds the given item to the set of currently selected items.

      By default this does not clear any previous selection. To do that, use SelectionModel.deselectAll().

      If the item was already selected, this is a NO-OP.

      Specified by:
      select in interface SelectionModel<C extends Component,T>
      Parameters:
      item - the item to add to selection, not null
    • selectItems

      default void selectItems(T... items)
      Adds the given items to the set of currently selected items.

      By default this does not clear any previous selection. To do that, use SelectionModel.deselectAll().

      If the all the items were already selected, this is a NO-OP.

      This is a short-hand for updateSelection(Set, Set) with nothing to deselect.

      Parameters:
      items - to add to selection, not null
    • deselect

      default void deselect(T item)
      Description copied from interface: SelectionModel
      Deselects the given item. If the item is not currently selected, does nothing.
      Specified by:
      deselect in interface SelectionModel<C extends Component,T>
      Parameters:
      item - the item to deselect, not null
    • deselectItems

      default void deselectItems(T... items)
      Removes the given items from the set of currently selected items.

      If the none of the items were selected, this is a NO-OP.

      This is a short-hand for updateSelection(Set, Set) with nothing to select.

      Parameters:
      items - to remove from selection, not null
    • updateSelection

      void updateSelection(Set<T> addedItems, Set<T> removedItems)
      Updates the selection by adding and removing the given items from it.

      If all the added items were already selected and the removed items were not selected, this is a NO-OP.

      Duplicate items (in both add & remove sets) are ignored.

      Parameters:
      addedItems - the items to add, not null
      removedItems - the items to remove, not null
    • getFirstSelectedItem

      default Optional<T> getFirstSelectedItem()
      Description copied from interface: SelectionModel
      Get first selected data item.

      This is the same as SelectionModel.Single.getSelectedItem() in case of single selection and the first selected item from SelectionModel.getSelectedItems() in case of multiselection.

      Specified by:
      getFirstSelectedItem in interface SelectionModel<C extends Component,T>
      Returns:
      the first selected item.
    • selectAll

      void selectAll()
      Selects all available the items.