Interface SelectModel<V>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      V getSelectedValue()
      Determines the selected value.
      V[] getSelectedValues()
      Determines the selected values.
      boolean replace​(V oldValue, V newValue)
      Replaces the first occurrence in the of the given value with its replacement.
      void setSelectedValues​(V... values)
      Sets the selected values.
      • Methods inherited from interface java.util.Collection

        add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface com.globalmentor.beans.PropertyBindable

        addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
      • Methods inherited from interface com.globalmentor.beans.PropertyConstrainable

        addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
    • Method Detail

      • 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 java.beans.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:
        java.beans.PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.