Class SelectionProperty<I,S>

Type Parameters:
I - The type of selectable items.
S - The type of the selection.
Direct Known Subclasses:
SingleSelectionProperty

public abstract class SelectionProperty<I,S> extends ObservableProperty<S>
Represents a selection of items from a list.
  • Field Details

    • items

      protected final List<I> items
    • wrapMode

      protected WrapMode wrapMode
  • Constructor Details

    • SelectionProperty

      public SelectionProperty(List<I> items)
  • Method Details

    • getItems

      public List<I> getItems()
      Returns an unmodifiable clone of the list of items.
      Returns:
      A clone of the list of items.
    • getItemCount

      public int getItemCount()
    • addItem

      public boolean addItem(I item)
    • removeItem

      public boolean removeItem(I item)
    • selectItem

      public boolean selectItem(I item) throws IllegalArgumentException
      Selects an item from the list of items.
      Parameters:
      item - The item to select
      Returns:
      false if the item was already selected.
      Throws:
      IllegalArgumentException - If the item is not in the list of items.
    • selectIndex

      public abstract boolean selectIndex(int index)
      Selects an item from the list of items at a given index.
      Parameters:
      index - The index of the item to select
      Returns:
      false if the item was already selected.
    • selectFirst

      public void selectFirst()
      Selects the first item.
    • selectLast

      public void selectLast()
      Selects the last item.
    • selectPrevious

      public abstract void selectPrevious()
      Selects the previous item.
    • selectNext

      public abstract void selectNext()
      Selects the next item.
    • getItem

      public I getItem(int index)
      Returns the item at the given index based on the wrap mode.
      Parameters:
      index - The index of the item
      Returns:
      The item at the given index or null if there is no corresponding item.
    • transformIndex

      public int transformIndex(int index)
      Transforms an index based on the wrap mode.
      Parameters:
      index - The index to transform
      Returns:
      The transformed index.
    • setWrapMode

      public void setWrapMode(WrapMode wrapMode)