Class CustomMultipleSelectionModel<T>

java.lang.Object
javafx.scene.control.SelectionModel<T>
javafx.scene.control.MultipleSelectionModel<T>
com.dlsc.gemsfx.util.CustomMultipleSelectionModel<T>
Type Parameters:
T - the type of the items contained in the selection model.

public class CustomMultipleSelectionModel<T> extends javafx.scene.control.MultipleSelectionModel<T>
CustomMultipleSelectionModel allows for managing the selection state of items in an ObservableList. It extends from MultipleSelectionModel and adds functionality to maintain a weak reference to the items list, facilitating the handling of list changes and ensuring selection consistency.
  • Property Summary

    Properties
    Type
    Property
    Description
    final javafx.beans.property.ListProperty<T>
    The items available for selection.

    Properties inherited from class javafx.scene.control.MultipleSelectionModel

    selectionMode

    Properties inherited from class javafx.scene.control.SelectionModel

    selectedIndex, selectedItem
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new selection model.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clearAndSelect(int index)
    Clears the current selection and selects the item at the given index.
    void
    Clears the current selection.
    void
    clearSelection(int index)
    Clears the selection for the given index.
    final javafx.collections.ObservableList<T>
    Gets the value of the items property.
    javafx.collections.ObservableList<Integer>
    Returns the selected indices.
    javafx.collections.ObservableList<T>
    Returns the selected items.
    boolean
    Checks whether no items are currently selected.
    boolean
    isSelected(int index)
    Checks whether the given index is selected.
    final javafx.beans.property.ListProperty<T>
    The items available for selection.
    void
    select(int index)
    Selects the item at the given index.
    void
    select(T obj)
    Selects the given item.
    void
    Selects all items.
    void
    Selects the first item.
    void
    selectIndices(int index, int... indices)
    Selects the given indices.
    void
    Selects the last item.
    void
    Selects the next item.
    void
    Selects the previous item.
    final void
    setItems(javafx.collections.ObservableList<T> value)
    Sets the value of the items property.

    Methods inherited from class javafx.scene.control.MultipleSelectionModel

    getSelectionMode, selectionModeProperty, selectRange, setSelectionMode

    Methods inherited from class javafx.scene.control.SelectionModel

    getSelectedIndex, getSelectedItem, selectedIndexProperty, selectedItemProperty, setSelectedIndex, setSelectedItem

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

  • Constructor Details

    • CustomMultipleSelectionModel

      public CustomMultipleSelectionModel()
      Creates a new selection model.
  • Method Details

    • getItems

      public final javafx.collections.ObservableList<T> getItems()
      Gets the value of the items property.
      Property description:
      The items available for selection.
      Returns:
      the value of the items property
      See Also:
    • setItems

      public final void setItems(javafx.collections.ObservableList<T> value)
      Sets the value of the items property.
      Property description:
      The items available for selection.
      Parameters:
      value - the value for the items property
      See Also:
    • itemsProperty

      public final javafx.beans.property.ListProperty<T> itemsProperty()
      The items available for selection.
      Returns:
      the items property
      See Also:
    • getSelectedIndices

      public javafx.collections.ObservableList<Integer> getSelectedIndices()
      Returns the selected indices.
      Specified by:
      getSelectedIndices in class javafx.scene.control.MultipleSelectionModel<T>
      Returns:
      the selected indices
    • getSelectedItems

      public javafx.collections.ObservableList<T> getSelectedItems()
      Returns the selected items.
      Specified by:
      getSelectedItems in class javafx.scene.control.MultipleSelectionModel<T>
      Returns:
      the selected items
    • selectIndices

      public void selectIndices(int index, int... indices)
      Selects the given indices.
      Specified by:
      selectIndices in class javafx.scene.control.MultipleSelectionModel<T>
      Parameters:
      index - the first index to select
      indices - the additional indices to select
    • selectAll

      public void selectAll()
      Selects all items.
      Specified by:
      selectAll in class javafx.scene.control.MultipleSelectionModel<T>
    • clearAndSelect

      public void clearAndSelect(int index)
      Clears the current selection and selects the item at the given index.
      Specified by:
      clearAndSelect in class javafx.scene.control.SelectionModel<T>
      Parameters:
      index - the index to select
    • select

      public void select(int index)
      Selects the item at the given index.
      Specified by:
      select in class javafx.scene.control.SelectionModel<T>
      Parameters:
      index - the index to select
    • select

      public void select(T obj)
      Selects the given item.
      Specified by:
      select in class javafx.scene.control.SelectionModel<T>
      Parameters:
      obj - the item to select
    • clearSelection

      public void clearSelection(int index)
      Clears the selection for the given index.
      Specified by:
      clearSelection in class javafx.scene.control.SelectionModel<T>
      Parameters:
      index - the index to clear
    • clearSelection

      public void clearSelection()
      Clears the current selection.
      Specified by:
      clearSelection in class javafx.scene.control.SelectionModel<T>
    • isSelected

      public boolean isSelected(int index)
      Checks whether the given index is selected.
      Specified by:
      isSelected in class javafx.scene.control.SelectionModel<T>
      Parameters:
      index - the index to check
      Returns:
      true if the index is selected
    • isEmpty

      public boolean isEmpty()
      Checks whether no items are currently selected.
      Specified by:
      isEmpty in class javafx.scene.control.SelectionModel<T>
      Returns:
      true if no items are selected
    • selectPrevious

      public void selectPrevious()
      Selects the previous item.
      Specified by:
      selectPrevious in class javafx.scene.control.SelectionModel<T>
    • selectNext

      public void selectNext()
      Selects the next item.
      Specified by:
      selectNext in class javafx.scene.control.SelectionModel<T>
    • selectFirst

      public void selectFirst()
      Selects the first item.
      Specified by:
      selectFirst in class javafx.scene.control.MultipleSelectionModel<T>
    • selectLast

      public void selectLast()
      Selects the last item.
      Specified by:
      selectLast in class javafx.scene.control.MultipleSelectionModel<T>