com.holonplatform.vaadin.components

## Interface Selectable<T>

- Type Parameters:
    `T` - Selection item type
  All Known Subinterfaces:
    BeanListing<T>, ItemListing<T,P>, MultiSelect<T>, PropertyListing, SingleSelect<T>

      public interface Selectable<T>

  Represents a component which supports items selection.
  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `Selectable.SelectionEvent<T>` Selection event.
    `static interface` | `Selectable.SelectionListener<T>` A listener for listening for selection changes from a `Selectable`.
    `static class` | `Selectable.SelectionMode` Selection modes enumeration.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.vaadin.shared.Registration` | `addSelectionListener(Selectable.SelectionListener<T> selectionListener)` Adds a `Selectable.SelectionListener` to listener to selection changes.
    `void` | `deselect(T item)` Deselects the given item.
    `void` | `deselectAll()` Deselects all currently selected items, if any.
    `Optional<T>` | `getFirstSelectedItem()` Get the first selected item.
    `Set<T>` | `getSelectedItems()` Get an immutable set of the currently selected items.
    `Selectable.SelectionMode` | `getSelectionMode()` Get the selection mode
    `default boolean` | `isSelected(T item)` Returns whether the given `item` is selected.
    `void` | `select(T item)` Selects the given item.

- - ### Method Detail

    - #### getSelectionMode

          Selectable.SelectionMode getSelectionMode()

      Get the selection mode
      Returns:
        the selection mode

    - #### isSelected

          default boolean isSelected(T item)

      Returns whether the given `item` is selected.
      Parameters:
        `item` - Item to check (not null)
      Returns:
        `true` if the given item is selected, `false` otherwise

    - #### getSelectedItems

          Set<T> getSelectedItems()

      Get an immutable set of the currently selected items.

      The iteration order of the items in the returned set is implementation dependent.

      Returns:
        Selected items set, empty if none

    - #### getFirstSelectedItem

          Optional<T> getFirstSelectedItem()

      Get the first selected item.
      Returns:
        the first selected item, empty if none

    - #### select

          void select(T item)

      Selects the given item. If the item is already selected, does nothing.

      When in `Selectable.SelectionMode.SINGLE`, any previously selected item is deselected.

      Parameters:
        `item` - the item to select (not null)

    - #### deselect

          void deselect(T item)

      Deselects the given item. If the item is not currently selected, does nothing.
      Parameters:
        `item` - the item to deselect (not null)

    - #### deselectAll

          void deselectAll()

      Deselects all currently selected items, if any.

    - #### addSelectionListener

          com.vaadin.shared.Registration addSelectionListener(Selectable.SelectionListener<T> selectionListener)

      Adds a `Selectable.SelectionListener` to listener to selection changes.
      Parameters:
        `selectionListener` - The listener to add
      Returns:
        the listener `Registration`

Copyright © 2019 The Holon Platform. All rights reserved.