Interface SelectModel<V>

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

public interface SelectModel<V> extends ValueModel<V>, Collection<V>
A model for selecting one or more values from a collection. The model must be thread-safe, synchronized on itself. Any iteration over values should include synchronization on the instance of this interface.
Author:
Garret Wilson
  • Method Details

    • replace

      boolean replace(V oldValue, V newValue)
      Replaces the first occurrence in the of the given value with its replacement. This method ensures that another thread does not change the model while the search and replace operation occurs.
      Parameters:
      oldValue - The value for which to search.
      newValue - The replacement value.
      Returns:
      Whether the operation resulted in a modification of the model.
    • getSelectedValue

      V getSelectedValue()
      Determines the selected value. This method delegates to the selection strategy. If more than one value is selected, the lead selected value will be returned.
      Returns:
      The value currently selected, or null if no value is currently selected.
    • getSelectedValues

      V[] getSelectedValues()
      Determines the selected values. This method delegates to the selection strategy.
      Returns:
      The values currently selected.
    • setSelectedValues

      void setSelectedValues(V... values) throws PropertyVetoException
      Sets the selected values. If a value occurs more than one time in the model, all occurrences of the value will be selected. Values that do not occur in the select model will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible via Throwable.getCause(). This method delegates to the selection strategy.
      Parameters:
      values - The values to select.
      Throws:
      PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.