Interface ListSelectModel<V>

Type Parameters:
V - The type of values contained in the model.
All Superinterfaces:
Collection<V>, Iterable<V>, List<V>, ListListenable<V>, Model, com.globalmentor.model.MutableValued<V>, com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, SelectModel<V>, com.globalmentor.model.Valued<V>, ValueModel<V>
All Known Subinterfaces:
CardControl, ListSelectControl<V>
All Known Implementing Classes:
AbstractCardPanel, AbstractListSelectContainerControl, AbstractListSelectControl, AbstractListSelectTableModel, BooleanValueControlSelectControl, CardPanel, CardTabControl, DefaultListSelectModel, ListControl, SequenceCardPanel, TabbedPanel, TabContainerControl, TabControl

public interface ListSelectModel<V> extends SelectModel<V>, List<V>, ListListenable<V>
A model for selecting one or more values from a list. The model must be thread-safe, synchronized on itself. Any iteration over values should include synchronization on the instance of this interface. When the selection is changed, a ListSelectionEvent is fired. When the state of a value (besides its selection, such as its enabled status) changes, a GenericPropertyChangeEvent event is fired referencing the value the state of which has changed.
Author:
Garret Wilson
  • Method Details

    • getSelectionPolicy

      ListSelectionPolicy<V> getSelectionPolicy()
      Returns:
      The selection policy for this model.
    • getSelectedIndex

      int getSelectedIndex()
      Determines the selected index. If more than one index is selected, the lead selected index will be returned.
      Returns:
      The index currently selected, or -1 if no index is selected.
      See Also:
    • getSelectedIndexes

      int[] getSelectedIndexes()
      Determines the selected indices.
      Returns:
      The indices currently selected.
      See Also:
    • setSelectedIndexes

      void setSelectedIndexes(int... indexes) throws PropertyVetoException
      Sets the selected indices. Invalid and duplicate indices will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible via Throwable.getCause().
      Parameters:
      indexes - The indices to select.
      Throws:
      PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
      See Also:
    • addSelectedIndexes

      void addSelectedIndexes(int... indexes) throws PropertyVetoException
      Adds a selection at the given indices. Any invalid indices will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible via Throwable.getCause().
      Parameters:
      indexes - The indices to add to the selection.
      Throws:
      PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
      See Also:
    • removeSelectedIndexes

      void removeSelectedIndexes(int... indexes) throws PropertyVetoException
      Removes a selection at the given indices. Any invalid indices will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible via Throwable.getCause().
      Parameters:
      indexes - The indices to remove from the selection.
      Throws:
      PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
      See Also:
    • isValueDisplayed

      boolean isValueDisplayed(V value)
      Determines the displayed status of the first occurrence of a given value.
      Parameters:
      value - The value for which the displayed status is to be determined.
      Returns:
      true if the value is displayed, else false.
      Throws:
      IndexOutOfBoundsException - if the given value does not occur in the model.
    • setValueDisplayed

      void setValueDisplayed(V value, boolean newDisplayed)
      Sets the displayed status of the first occurrence of a given value. This is a bound value state property.
      Parameters:
      value - The value to display.
      newDisplayed - Whether the value should be displayed.
      See Also:
    • isIndexDisplayed

      boolean isIndexDisplayed(int index)
      Determines the displayed status of a given index.
      Parameters:
      index - The index of the value for which the displayed status is to be determined.
      Returns:
      true if the value at the given index is displayed, else false.
    • setIndexDisplayed

      void setIndexDisplayed(int index, boolean newDisplayed)
      Sets the displayed status of a given index. This is a bound value state property.
      Parameters:
      index - The index of the value to display.
      newDisplayed - Whether the value at the given index should be displayed.
      Throws:
      IndexOutOfBoundsException - if the given index is not within the range of the list.
      See Also:
    • isValueEnabled

      boolean isValueEnabled(V value)
      Determines the enabled status of the first occurrence of a given value.
      Parameters:
      value - The value for which the enabled status is to be determined.
      Returns:
      true if the value is enabled, else false.
      Throws:
      IndexOutOfBoundsException - if the given value does not occur in the model.
    • setValueEnabled

      void setValueEnabled(V value, boolean newEnabled)
      Sets the enabled status of the first occurrence of a given value. This is a bound value state property.
      Parameters:
      value - The value to enable or disable.
      newEnabled - Whether the value should be enabled.
      See Also:
    • isIndexEnabled

      boolean isIndexEnabled(int index)
      Determines the enabled status of a given index.
      Parameters:
      index - The index of the value for which the enabled status is to be determined.
      Returns:
      true if the value at the given index is enabled, else false.
    • setIndexEnabled

      void setIndexEnabled(int index, boolean newEnabled)
      Sets the enabled status of a given index. This is a bound value state property.
      Parameters:
      index - The index of the value to enable or disable.
      newEnabled - Whether the value at the given index should be enabled.
      Throws:
      IndexOutOfBoundsException - if the given index is not within the range of the list.
      See Also:
    • addListListener

      void addListListener(ListListener<V> listListener)
      Adds a list listener.
      Specified by:
      addListListener in interface ListListenable<V>
      Parameters:
      listListener - The list listener to add.
    • removeListListener

      void removeListListener(ListListener<V> listListener)
      Removes a list listener.
      Specified by:
      removeListListener in interface ListListenable<V>
      Parameters:
      listListener - The list listener to remove.
    • addListSelectionListener

      void addListSelectionListener(ListSelectionListener<V> selectionListener)
      Adds a list selection listener.
      Parameters:
      selectionListener - The selection listener to add.
    • removeListSelectionListener

      void removeListSelectionListener(ListSelectionListener<V> selectionListener)
      Removes a list selection listener.
      Parameters:
      selectionListener - The selection listener to remove.