org.scopemvc.view.swing
Class SListSelectionModel

java.lang.Object
  |
  +--javax.swing.DefaultListSelectionModel
        |
        +--org.scopemvc.view.swing.SListSelectionModel
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.ListSelectionModel, ModelBindable, Refreshable, java.io.Serializable

public class SListSelectionModel
extends javax.swing.DefaultListSelectionModel
implements ModelBindable, Refreshable

A ListSelectionModel bound to a model property that will contain a reference to the current selection. This implementation allows read-only properties to disable the parent JList or JTable. SINGLE_SELECTION and SINGLE_INTERVAL_SELECTION are supported.

The bound property can be an Object of the type being selected in which case the topmost single selection is updated. If the property is a HashSet then it is updated with all selections.

Version:
$Revision: 1.6 $ $Date: 2002/09/05 15:41:49 $
Author:
Steve Meyfroidt
See Also:
SList, STable, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.DefaultListSelectionModel
leadAnchorNotificationEnabled, listenerList
 
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Constructor Summary
SListSelectionModel(ListSelectionParent inParent)
          Create for a parent SingleListSelectionParent.
 
Method Summary
protected  void fireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
          When selection changes, update the bound model.
 java.lang.Object getBoundModel()
          Gets the bound model
 Selector getSelector()
          Gets the selector
 java.lang.Object getViewValue()
          Gets the view value
 void refresh()
          TODO: document the method
 void setBoundModel(java.lang.Object inModel)
          Sets the bound model
 void setSelectionMode(int selectionMode)
          Sets the selection mode
 void setSelector(Selector inSelector)
          Sets the selector
 void setSelectorString(java.lang.String inSelectorString)
          Sets the selector string
protected  void updateFromHashSet(java.util.HashSet inValue)
          TODO: document the method
protected  void updateFromObject(java.lang.Object inValue)
          TODO: document the method
 void updateFromProperty(java.lang.Object inValue, boolean inReadOnly)
          Incoming value is null, an Object or a java.util.HashSet.
 void validationFailed(java.lang.Exception inException)
          If selection fails, make validation fail on parent.
 void validationSuccess()
          If selection fails, make validation fail on parent.
 
Methods inherited from class javax.swing.DefaultListSelectionModel
addListSelectionListener, addSelectionInterval, clearSelection, clone, fireValueChanged, fireValueChanged, getAnchorSelectionIndex, getLeadSelectionIndex, getListeners, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getSelectionMode, getValueIsAdjusting, insertIndexInterval, isLeadAnchorNotificationEnabled, isSelectedIndex, isSelectionEmpty, removeIndexInterval, removeListSelectionListener, removeSelectionInterval, setAnchorSelectionIndex, setLeadAnchorNotificationEnabled, setLeadSelectionIndex, setSelectionInterval, setValueIsAdjusting, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SListSelectionModel

public SListSelectionModel(ListSelectionParent inParent)
Create for a parent SingleListSelectionParent.

Parameters:
inParent - TODO: Describe the Parameter
Method Detail

getBoundModel

public final java.lang.Object getBoundModel()
Gets the bound model

Returns:
The boundModel value

getSelector

public final Selector getSelector()
Gets the selector

Returns:
The selector value

getViewValue

public java.lang.Object getViewValue()
Gets the view value

Specified by:
getViewValue in interface ModelBindable
Returns:
The viewValue value

setBoundModel

public final void setBoundModel(java.lang.Object inModel)
Sets the bound model

Parameters:
inModel - The new boundModel value

setSelector

public final void setSelector(Selector inSelector)
Sets the selector

Parameters:
inSelector - The new selector value

setSelectorString

public final void setSelectorString(java.lang.String inSelectorString)
Sets the selector string

Parameters:
inSelectorString - The new selectorString value

setSelectionMode

public void setSelectionMode(int selectionMode)
Sets the selection mode

Specified by:
setSelectionMode in interface javax.swing.ListSelectionModel
Overrides:
setSelectionMode in class javax.swing.DefaultListSelectionModel
Parameters:
selectionMode - The new selectionMode value

updateFromProperty

public void updateFromProperty(java.lang.Object inValue,
                               boolean inReadOnly)
Incoming value is null, an Object or a java.util.HashSet.

Specified by:
updateFromProperty in interface ModelBindable
Parameters:
inValue - TODO: Describe the Parameter
inReadOnly - TODO: Describe the Parameter

validationFailed

public void validationFailed(java.lang.Exception inException)
If selection fails, make validation fail on parent.

Specified by:
validationFailed in interface ModelBindable
Parameters:
inException - TODO: Describe the Parameter

validationSuccess

public void validationSuccess()
If selection fails, make validation fail on parent.

Specified by:
validationSuccess in interface ModelBindable
See Also:
ModelBindable.validationFailed(java.lang.Exception)

refresh

public void refresh()
TODO: document the method

Specified by:
refresh in interface Refreshable

updateFromObject

protected void updateFromObject(java.lang.Object inValue)
TODO: document the method

Parameters:
inValue - TODO: Describe the Parameter

updateFromHashSet

protected void updateFromHashSet(java.util.HashSet inValue)
TODO: document the method

Parameters:
inValue - TODO: Describe the Parameter

fireValueChanged

protected void fireValueChanged(int firstIndex,
                                int lastIndex,
                                boolean isAdjusting)
When selection changes, update the bound model.

Overrides:
fireValueChanged in class javax.swing.DefaultListSelectionModel
Parameters:
firstIndex - TODO: Describe the Parameter
lastIndex - TODO: Describe the Parameter
isAdjusting - TODO: Describe the Parameter


Copyright © 2000-2002 The Scope Team. All Rights Reserved.