Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.view.swing
Class SListSelectionModel  view SListSelectionModel download SListSelectionModel.java

java.lang.Object
  extended byjavax.swing.DefaultListSelectionModel
      extended byorg.scopemvc.view.swing.SListSelectionModel
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.ListSelectionModel, org.scopemvc.view.util.ModelBindable, Refreshable, java.io.Serializable

public class SListSelectionModel
extends javax.swing.DefaultListSelectionModel
implements org.scopemvc.view.util.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.4 $ $Date: 2002/01/26 09:46:20 $

Field Summary
private  SwingBoundModel boundModel
          Helper to manage model to view binding.
private  boolean disabled
          Is selection disabled?
private static org.apache.commons.logging.Log LOG
           
private  ListSelectionParent parent
          Parent so we can find the currently selected object and pass on validation failures.
 
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()
           
 org.scopemvc.core.Selector getSelector()
           
 java.lang.Object getViewValue()
          Get the current value (what would be set as a property of the bound model object) being presented on the View.
 void refresh()
          Update the widget with the current state of the bound model.
 void setBoundModel(java.lang.Object inModel)
           
 void setSelectionMode(int selectionMode)
          Sets the value of the DefaultListSelectionModel.selectionMode>DefaultListSelectionModel.selectionMode 55 property.
 void setSelector(org.scopemvc.core.Selector inSelector)
           
 void setSelectorString(java.lang.String inSelectorString)
           
protected  void updateFromHashSet(java.util.HashSet inValue)
           
protected  void updateFromObject(java.lang.Object inValue)
           
 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, moveLeadSelectionIndex, removeIndexInterval, removeListSelectionListener, removeSelectionInterval, setAnchorSelectionIndex, setLeadAnchorNotificationEnabled, setLeadSelectionIndex, setSelectionInterval, setValueIsAdjusting
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG

boundModel

private SwingBoundModel boundModel
Helper to manage model to view binding.


parent

private ListSelectionParent parent
Parent so we can find the currently selected object and pass on validation failures.


disabled

private boolean disabled
Is selection disabled?

Constructor Detail

SListSelectionModel

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

Method Detail

setSelectionMode

public void setSelectionMode(int selectionMode)
Description copied from class: javax.swing.DefaultListSelectionModel
Sets the value of the DefaultListSelectionModel.selectionMode>DefaultListSelectionModel.selectionMode 55 property.

Specified by:
setSelectionMode in interface javax.swing.ListSelectionModel

getBoundModel

public final java.lang.Object getBoundModel()

setBoundModel

public final void setBoundModel(java.lang.Object inModel)

getSelector

public final org.scopemvc.core.Selector getSelector()

setSelector

public final void setSelector(org.scopemvc.core.Selector inSelector)

setSelectorString

public final void setSelectorString(java.lang.String inSelectorString)

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 org.scopemvc.view.util.ModelBindable

updateFromObject

protected void updateFromObject(java.lang.Object inValue)

updateFromHashSet

protected void updateFromHashSet(java.util.HashSet inValue)

getViewValue

public java.lang.Object getViewValue()
Description copied from interface: org.scopemvc.view.util.ModelBindable
Get the current value (what would be set as a property of the bound model object) being presented on the View.

Specified by:
getViewValue in interface org.scopemvc.view.util.ModelBindable

validationFailed

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

Specified by:
validationFailed in interface org.scopemvc.view.util.ModelBindable

validationSuccess

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

Specified by:
validationSuccess in interface org.scopemvc.view.util.ModelBindable

fireValueChanged

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


refresh

public void refresh()
Description copied from interface: Refreshable
Update the widget with the current state of the bound model. Probably something like this:
     Object propertyValue = boundModel.getPropertyValue();
     boolean propertyReadOnly = boundModel.getPropertyReadOnly();
     updateFromProperty(propertyValue, propertyReadOnly);
 

Specified by:
refresh in interface Refreshable