Interface Selectable<E>

All Known Subinterfaces:
GroupsSelectableModel<E>
All Known Implementing Classes:
AbstractGroupsModel, AbstractListModel, AbstractTreeModel, DefaultTreeModel, GroupsListModel, GroupsModelArray, ListModelArray, ListModelList, ListModelMap, ListModelSet, SimpleGroupsModel, SimpleListModel

public interface Selectable<E>
Indicate a selectable collection or component. Generally used with ListModel and Listbox.
Author:
henrichen, tomyeh
See Also:
  • Method Details

    • getSelection

      Set<E> getSelection()
      Returns the current selection. It is readonly. Don't modify it directly
      Returns:
      the current selection.
    • setSelection

      void setSelection(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(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(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:
    • 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