Interface TableSelectionModel<R>

Type Parameters:
R - the type of rows in the table model
All Known Subinterfaces:
FilteredTableSelectionModel<R>

public interface TableSelectionModel<R>
A table selection model
  • Method Details

    • selectionEmpty

      StateObserver selectionEmpty()
      Returns:
      a StateObserver indicating whether the selection is empty
    • selectionNotEmpty

      StateObserver selectionNotEmpty()
      Returns:
      a StateObserver indicating whether one or more items are selected
    • multipleSelection

      StateObserver multipleSelection()
      Returns:
      a StateObserver indicating whether multiple rows are selected
    • singleSelection

      StateObserver singleSelection()
      Returns:
      a StateObserver indicating whether a single row is selected
    • singleSelectionMode

      State singleSelectionMode()
      Returns:
      a State controlling the single selection mode of this selection model
    • beforeSelectionChangeEvent

      EventObserver<?> beforeSelectionChangeEvent()
      To prevent a selection change, add a listener throwing a CancelException.
      Returns:
      an observer notified before the selection changes
    • selectionEvent

      EventObserver<?> selectionEvent()
      Returns:
      an observer notified each time the selection changes
    • selectedIndexEvent

      EventObserver<Integer> selectedIndexEvent()
      Returns:
      an observer notified each time the selected index changes
    • selectedIndexesEvent

      EventObserver<List<Integer>> selectedIndexesEvent()
      Returns:
      an observer notified each time the selected indexes change
    • selectedItemEvent

      EventObserver<R> selectedItemEvent()
      Returns:
      an observer notified each time the selected item changes
    • selectedItemsEvent

      EventObserver<List<R>> selectedItemsEvent()
      Returns:
      an observer notified each time the selected items change
    • moveSelectionDown

      void moveSelectionDown()
      Moves all selected indexes down one index, wraps around. If the selection is empty the first item in this model is selected.
      See Also:
    • moveSelectionUp

      void moveSelectionUp()
      Moves all selected indexes up one index, wraps around. If the selection is empty the last item in this model is selected.
      See Also:
    • getSelectedIndex

      int getSelectedIndex()
      Returns:
      the index of the selected row, -1 if none is selected and the lowest index if more than one row is selected
    • addSelectedIndex

      void addSelectedIndex(int index)
      Selects the item at index
      Parameters:
      index - the index
    • removeSelectedIndex

      void removeSelectedIndex(int index)
      Removes the item at index from the selection
      Parameters:
      index - the index
    • removeSelectedIndexes

      void removeSelectedIndexes(Collection<Integer> indexes)
      Removes the given indexes from the selection
      Parameters:
      indexes - the indexes
    • setSelectedIndex

      void setSelectedIndex(int index)
      Clears the selection and selects the item at index
      Parameters:
      index - the index
    • setSelectedIndexes

      void setSelectedIndexes(Collection<Integer> indexes)
      Selects the given indexes
      Parameters:
      indexes - the indexes to select
    • getSelectedIndexes

      List<Integer> getSelectedIndexes()
      Returns:
      the selected indexes, an empty list if selection is empty
    • selectAll

      void selectAll()
      Selects all visible rows
      See Also:
    • setSelectedItems

      void setSelectedItems(Predicate<R> predicate)
      Sets the items passing the predicate test as the selection
      Parameters:
      predicate - the predicate
    • addSelectedItems

      void addSelectedItems(Predicate<R> predicate)
      Adds the items passing the predicate test to the selection
      Parameters:
      predicate - the predicate
    • addSelectedIndexes

      void addSelectedIndexes(Collection<Integer> indexes)
      Adds these indexes to the selection
      Parameters:
      indexes - the indexes to add to the selection
    • selectionCount

      int selectionCount()
      Returns:
      the number of selected indexes in the underlying selection model.
    • setSelectedItems

      void setSelectedItems(Collection<R> items)
      Selects the given items
      Parameters:
      items - the items to select
    • getSelectedItems

      List<R> getSelectedItems()
      Returns:
      a list containing the selected items
    • getSelectedItem

      R getSelectedItem()
      Returns:
      the item at the lowest selected index, null if none is selected
    • isSelected

      boolean isSelected(R item)
      Parameters:
      item - the item
      Returns:
      true if the item is selected
    • setSelectedItem

      void setSelectedItem(R item)
      Sets the selected item
      Parameters:
      item - the item to select
    • addSelectedItem

      void addSelectedItem(R item)
      Adds the given item to the selection
      Parameters:
      item - the item to add to the selection
    • addSelectedItems

      void addSelectedItems(Collection<R> items)
      Adds the given items to the selection
      Parameters:
      items - the items to add to the selection
    • removeSelectedItem

      void removeSelectedItem(R item)
      Remove the given item from the selection
      Parameters:
      item - the item to remove from the selection
    • removeSelectedItems

      void removeSelectedItems(Collection<R> items)
      Remove the given items from the selection
      Parameters:
      items - the items to remove from the selection
    • selectedItem

      Optional<R> selectedItem()
      Returns:
      the selected item, or an empty Optional in case the selection is empty
    • clearSelection

      void clearSelection()
      Clears the selection