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

Quick Search    Search Deep

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

java.lang.Object
  extended byjavax.swing.AbstractListModel
      extended byorg.scopemvc.view.swing.SAbstractListModel
          extended byorg.scopemvc.view.swing.SComboBoxModel
All Implemented Interfaces:
javax.swing.ComboBoxModel, javax.swing.ListModel, org.scopemvc.view.util.ModelBindable, org.scopemvc.core.ModelChangeListener, Refreshable, java.io.Serializable

public final class SComboBoxModel
extends SAbstractListModel
implements javax.swing.ComboBoxModel

Version:
$Revision: 1.7 $ $Date: 2002/01/26 09:46:20 $

Nested Class Summary
(package private)  class SComboBoxModel.SelectionBoundModel
           
 
Field Summary
private  boolean _jdk1_3fixIgnoreSetSelectedItem
           
private  javax.swing.JComboBox combo
          Owning combo.
private static org.apache.commons.logging.Log LOG
           
private  java.lang.Object selectedItem
          Need to hold this here in case the model decides to veto some values: UI can hold invalid values whereas model can't.
private  SwingBoundModel selectionBoundModel
           
private  SComboBoxModel.SelectionBoundModel selectionDelegate
           
 
Fields inherited from class org.scopemvc.view.swing.SAbstractListModel
listModel, sizeSelector
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
SComboBoxModel(javax.swing.JComboBox inCombo)
           
 
Method Summary
(package private)  void fireContentsChanged()
           
 java.lang.Object getBoundSelectionModel()
           
 java.lang.Object getSelectedItem()
          Returns the currently selected item in the combo box.
 org.scopemvc.core.Selector getSelectionSelector()
           
(package private)  void jdk1_3fixIgnoreSetSelectedItem(boolean inIgnore)
          This method is bug fix for JDK 1.2.x,1.3.x bug: after setting model combobox sets element 0 as selected.
 void refresh()
          Update the widget with the current state of the bound model.
 void setBoundModel(java.lang.Object inModel)
           
 void setBoundSelectionModel(java.lang.Object inModel)
           
 void setSelectedItem(java.lang.Object inItem)
          Sets the selected item in the combo box.
 void setSelectionSelector(org.scopemvc.core.Selector inSelector)
           
 void setSelectionSelectorString(java.lang.String inSelectorString)
           
 
Methods inherited from class org.scopemvc.view.swing.SAbstractListModel
getBoundModel, getElementAt, getManager, getSelector, getShownModel, getSize, getSizeSelector, getViewValue, isSorted, modelChanged, setComparator, setListModel, setSelector, setSelectorString, setShownModel, setSizeSelector, setSizeSelectorString, setSorted, setSorted, updateFromProperty, validationFailed, validationSuccess
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
 

Field Detail

LOG

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

_jdk1_3fixIgnoreSetSelectedItem

private boolean _jdk1_3fixIgnoreSetSelectedItem

selectionDelegate

private SComboBoxModel.SelectionBoundModel selectionDelegate

selectionBoundModel

private SwingBoundModel selectionBoundModel

combo

private javax.swing.JComboBox combo
Owning combo.


selectedItem

private java.lang.Object selectedItem
Need to hold this here in case the model decides to veto some values: UI can hold invalid values whereas model can't.

Constructor Detail

SComboBoxModel

public SComboBoxModel(javax.swing.JComboBox inCombo)
Method Detail

setSelectedItem

public void setSelectedItem(java.lang.Object inItem)
Description copied from interface: javax.swing.ComboBoxModel
Sets the selected item in the combo box. Classes implementing this interface should fire a javax.swing.event.ListDataEvent to all registered javax.swing.event.ListDataListeners to indicate that the selection has changed.

Specified by:
setSelectedItem in interface javax.swing.ComboBoxModel

getSelectedItem

public java.lang.Object getSelectedItem()
Description copied from interface: javax.swing.ComboBoxModel
Returns the currently selected item in the combo box.

Specified by:
getSelectedItem in interface javax.swing.ComboBoxModel

jdk1_3fixIgnoreSetSelectedItem

void jdk1_3fixIgnoreSetSelectedItem(boolean inIgnore)
This method is bug fix for JDK 1.2.x,1.3.x bug: after setting model combobox sets element 0 as selected. This is violation of MVC paradigm - model describes some state and should not be modified by view. JDK 1.4 beta has this bug fixed.

Model should be instance of SComboBoxModel to fix take effect

.


setBoundModel

public void setBoundModel(java.lang.Object inModel)
Overrides:
setBoundModel in class SAbstractListModel

getBoundSelectionModel

public final java.lang.Object getBoundSelectionModel()

setBoundSelectionModel

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

getSelectionSelector

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

setSelectionSelector

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

setSelectionSelectorString

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

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
Overrides:
refresh in class SAbstractListModel

fireContentsChanged

void fireContentsChanged()