Package org.zkoss.zul.ext

## Interface Selectable<E>

- All Known Subinterfaces:
    `GroupsSelectableModel<E>`
  All Known Implementing Classes:
    `AbstractGroupsModel`, `AbstractListModel`, `AbstractTreeModel`, `DefaultTreeModel`, `DefaultTristateTreeModel`, `GroupsListModel`, `GroupsModelArray`, `ListModelArray`, `ListModelArrayProxy`, `ListModelList`, `ListModelListProxy`, `ListModelMap`, `ListModelMapProxy`, `ListModelSet`, `ListModelSetProxy`, `SimpleGroupsModel`, `SimpleListModel`

      public interface Selectable<E>

  Indicate a selectable collection or component. Generally used with `ListModel` and `Listbox`.
  Author:
    henrichen, tomyeh
  See Also:
    `ListModel`, `Listbox`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `addToSelection​(E obj)` | Add the specified object into selection.
    `void` | `clearSelection()` | Change the selection to the empty set.
    `java.util.Set<E>` | `getSelection()` | Returns the current selection.
    `SelectionControl` | `getSelectionControl()` | Returns the selection control for the selection model, if any.
    `boolean` | `isMultiple()` | Returns whether the current selection mode is multiple.
    `boolean` | `isSelected​(java.lang.Object obj)` | Returns whether an object is selected.
    `boolean` | `isSelectionEmpty()` | Returns true if the selection is currently empty.
    `boolean` | `removeFromSelection​(java.lang.Object obj)` | Remove the specified object from selection.
    `void` | `setMultiple​(boolean multiple)` | Sets the selection mode to be multiple.
    `void` | `setSelection​(java.util.Collection<? extends E> selection)` | Replace the current selection with the given set.
    `void` | `setSelectionControl​(SelectionControl ctrl)` | Sets the selection control for the selection model

- - ### Method Detail

    - #### getSelection

          java.util.Set<E> getSelection()

      Returns the current selection. It is readonly. Don't modify it directly
      Returns:
        the current selection.

    - #### setSelection

          void setSelection​(java.util.Collection<? extends E> selection)

      Replace the current selection with the given set.

      If this represents a change to the current selection then notify each ListDataListener, including UI.

      Since:
        6.0.0

    - #### isSelected

          boolean isSelected​(java.lang.Object obj)

      Returns whether an object is selected.
      Since:
        6.0.0

    - #### isSelectionEmpty

          boolean isSelectionEmpty()

      Returns true if the selection is currently empty.
      Since:
        6.0.0

    - #### addToSelection

          boolean addToSelection​(E obj)

      Add the specified object into selection.

      If this represents a change to the current selection then notify each ListDataListener, including UI.

      Parameters:
        `obj` - the object to be as selection.
      Returns:
        true if it is added successfully; false if `obj` is not part of the data, or was already selected.
      Since:
        6.0.0

    - #### removeFromSelection

          boolean removeFromSelection​(java.lang.Object obj)

      Remove the specified object from selection.

      If this represents a change to the current selection then notify each ListDataListener, including UI.

      Parameters:
        `obj` - the object to be remove from selection.
      Returns:
        whether it is removed successfully
      Since:
        6.0.0

    - #### clearSelection

          void clearSelection()

      Change the selection to the empty set.

      If this represents a change to the current selection then notify each ListDataListener, including UI.

    - #### setMultiple

          void setMultiple​(boolean multiple)

      Sets the selection mode to be multiple.
      Since:
        6.0.0

    - #### isMultiple

          boolean isMultiple()

      Returns whether the current selection mode is multiple.
      Since:
        6.0.0
      See Also:
        `setMultiple(boolean)`

    - #### setSelectionControl

          void setSelectionControl​(SelectionControl ctrl)

      Sets the selection control for the selection model
      Parameters:
        `ctrl` -
      Since:
        8.0.0

    - #### getSelectionControl

          SelectionControl getSelectionControl()

      Returns the selection control for the selection model, if any.
      Since:
        8.0.0