com.guiseframework.model
Interface ListSelectModel<V>

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

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

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
 void addListListener(ListListener<V> listListener)
          Adds a list listener.
 void addListSelectionListener(ListSelectionListener<V> selectionListener)
          Adds a list selection listener.
 void addSelectedIndexes(int... indexes)
          Adds a selection at the given indices.
 int getSelectedIndex()
          Determines the selected index.
 int[] getSelectedIndexes()
          Determines the selected indices.
 ListSelectionPolicy<V> getSelectionPolicy()
           
 boolean isIndexDisplayed(int index)
          Determines the displayed status of a given index.
 boolean isIndexEnabled(int index)
          Determines the enabled status of a given index.
 boolean isValueDisplayed(V value)
          Determines the displayed status of the first occurrence of a given value.
 boolean isValueEnabled(V value)
          Determines the enabled status of the first occurrence of a given value.
 void removeListListener(ListListener<V> listListener)
          Removes a list listener.
 void removeListSelectionListener(ListSelectionListener<V> selectionListener)
          Removes a list selection listener.
 void removeSelectedIndexes(int... indexes)
          Removes a selection at the given indices.
 void setIndexDisplayed(int index, boolean newDisplayed)
          Sets the displayed status of a given index.
 void setIndexEnabled(int index, boolean newEnabled)
          Sets the enabled status of a given index.
 void setSelectedIndexes(int... indexes)
          Sets the selected indices.
 void setValueDisplayed(V value, boolean newDisplayed)
          Sets the displayed status of the first occurrence of a given value.
 void setValueEnabled(V value, boolean newEnabled)
          Sets the enabled status of the first occurrence of a given value.
 
Methods inherited from interface com.guiseframework.model.SelectModel
getSelectedValue, getSelectedValues, replace, setSelectedValues
 
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.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Method Detail

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:
SelectModel.getSelectedValue()

getSelectedIndexes

int[] getSelectedIndexes()
Determines the selected indices.

Returns:
The indices currently selected.
See Also:
SelectModel.getSelectedValues()

setSelectedIndexes

void setSelectedIndexes(int... indexes)
                        throws java.beans.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:
java.beans.PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
See Also:
ListSelectionPolicy.getSetSelectedIndices(ListSelectModel, int[]), #setSelectedValues(V[]), addSelectedIndexes(int...)

addSelectedIndexes

void addSelectedIndexes(int... indexes)
                        throws java.beans.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:
java.beans.PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
See Also:
ListSelectionPolicy.getAddSelectedIndices(ListSelectModel, int[]), setSelectedIndexes(int[])

removeSelectedIndexes

void removeSelectedIndexes(int... indexes)
                           throws java.beans.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:
java.beans.PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
See Also:
ListSelectionPolicy.getRemoveSelectedIndices(ListSelectModel, int[]), setSelectedIndexes(int[])

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:
java.lang.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:
#DISPLAYED_PROPERTY

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:
java.lang.IndexOutOfBoundsException - if the given index is not within the range of the list.
See Also:
#DISPLAYED_PROPERTY

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:
java.lang.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:
#ENABLED_PROPERTY

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:
java.lang.IndexOutOfBoundsException - if the given index is not within the range of the list.
See Also:
#ENABLED_PROPERTY

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.


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