com.guiseframework.model
Interface SelectModel<V>

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

public interface SelectModel<V>
extends ValueModel<V>, java.util.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

Field Summary
 
Fields inherited from interface com.guiseframework.model.ValueModel
VALIDATOR_PROPERTY, VALUE_PROPERTY
 
Fields inherited from interface com.guiseframework.model.Model
PLAIN_TEXT_CONTENT_TYPE, XHTML_CONTENT_TYPE, XHTML_FRAGMENT_CONTENT_TYPE
 
Method Summary
 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 com.guiseframework.model.ValueModel
clearValue, getDefaultValue, getValidator, getValue, getValueClass, isValidValue, resetValue, setValidator, setValue, validateValue
 
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
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

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.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.