|
|||||||||
| Home >> All >> org >> scopemvc >> view >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.scopemvc.view.swing
Class SAbstractListModel

java.lang.Objectjavax.swing.AbstractListModel
org.scopemvc.view.swing.SAbstractListModel
- All Implemented Interfaces:
- javax.swing.ListModel, org.scopemvc.view.util.ModelBindable, org.scopemvc.core.ModelChangeListener, Refreshable, java.io.Serializable
- Direct Known Subclasses:
- SComboBoxModel, SListModel, STableModel
- public abstract class SAbstractListModel
- extends javax.swing.AbstractListModel
- implements org.scopemvc.view.util.ModelBindable, Refreshable, org.scopemvc.core.ModelChangeListener
- extends javax.swing.AbstractListModel
A javax.swing.AbstractListModel bound to a property of a model used by SList, SComboBox, STable. The property should have elements accessible using IntIndexedSelectors and needs to fulfill one of the following criteria:
- be a java.util.List
- be an Object[]
- optional: have an accessible 'size' property in the parent view model (see below)
setSizeSelector(org.scopemvc.core.Selector) 55
or setSizeSelectorString(java.lang.String) 55 .
If required, the model for items can be specified as a static ListModelAdapter when it is more convenient to specify the list model at initialisation of (for example) an SComboBox rather than include it in the view model for active binding.
The list can present its elements as a sorted list
if a Comparator is passed to setSorted(java.util.Comparator) 55
or all list elements implement Comparable and
setSorted(boolean) 55 is called.
***** This implementation makes no provisions for thread-safety.
- Version:
- $Revision: 1.11 $ $Date: 2002/01/26 09:46:20 $
| Field Summary | |
private SwingBoundModel |
boundModel
Helper to manage model to view binding. |
private java.util.Comparator |
comparator
|
private static org.scopemvc.core.IntIndexSelector |
index
Share this instance for all fetches from the list. |
protected java.lang.Object |
listModel
|
private static org.apache.commons.logging.Log |
LOG
|
private org.scopemvc.core.PropertyManager |
manager
The property manager for the bound (list) model. |
private java.lang.Object |
shownModel
The (list) model object that the SListModel presents, which may be a property of the bound model if a Selector is specified. |
protected org.scopemvc.core.Selector |
sizeSelector
|
private boolean |
sorted
|
| Fields inherited from class javax.swing.AbstractListModel |
listenerList |
| Constructor Summary | |
SAbstractListModel()
|
|
| Method Summary | |
java.lang.Object |
getBoundModel()
|
java.lang.Object |
getElementAt(int inIndex)
Note that if the get() fails for any reason, a null is returned. |
(package private) org.scopemvc.core.PropertyManager |
getManager()
|
org.scopemvc.core.Selector |
getSelector()
|
java.lang.Object |
getShownModel()
Get the (list) model object that the SListModel presents, which may be a property of the bound model if a Selector is specified. |
int |
getSize()
Return the number of data elements in the list. |
org.scopemvc.core.Selector |
getSizeSelector()
|
java.lang.Object |
getViewValue()
Makes no sense: can't change the property using an SAbstractListModel! |
boolean |
isSorted()
|
void |
modelChanged(org.scopemvc.core.ModelChangeEvent inEvent)
Invoked to notify listeners of a change in the state of a org.scopemvc.core.ModelChangeEventSource. |
void |
refresh()
Update the widget with the current state of the bound model. |
void |
setBoundModel(java.lang.Object inModel)
|
void |
setComparator(java.util.Comparator inComparator)
Deprecated. see setSorted(Comparator) |
void |
setListModel(java.lang.Object inModel)
Can use this to specify a static list model for the contents of the list rather than binding to a dynamic property of some view model. |
void |
setSelector(org.scopemvc.core.Selector inSelector)
|
void |
setSelectorString(java.lang.String inSelectorString)
|
protected void |
setShownModel(java.lang.Object inModel)
Called internally from updateFromProperty(). |
void |
setSizeSelector(org.scopemvc.core.Selector inSelector)
|
void |
setSizeSelectorString(java.lang.String inSelectorString)
|
void |
setSorted(boolean inSorted)
|
void |
setSorted(java.util.Comparator inComparator)
|
void |
updateFromProperty(java.lang.Object inValue,
boolean inReadOnly)
Ignores inReadOnly because makes no sense here. |
void |
validationFailed(java.lang.Exception inException)
Makes no sense: can't change the property using an SAbstractListModel! |
void |
validationSuccess()
Makes no sense: can't change the property using an SAbstractListModel! |
| 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 |
| Field Detail |
LOG
private static final org.apache.commons.logging.Log LOG
sorted
private boolean sorted
comparator
private java.util.Comparator comparator
sizeSelector
protected org.scopemvc.core.Selector sizeSelector
listModel
protected java.lang.Object listModel
boundModel
private SwingBoundModel boundModel
- Helper to manage model to view binding.
shownModel
private java.lang.Object shownModel
- The (list) model object that the SListModel presents,
which may be a property of the bound model if a Selector
is specified. May be null if the bound property is
a JavaBeans indexed property.
index
private static final org.scopemvc.core.IntIndexSelector index
- Share this instance for all fetches from the list.
Synchronize on it first!
manager
private org.scopemvc.core.PropertyManager manager
- The property manager for the bound (list) model.
| Constructor Detail |
SAbstractListModel
public SAbstractListModel()
| Method Detail |
setSizeSelector
public void setSizeSelector(org.scopemvc.core.Selector inSelector)
setSizeSelectorString
public void setSizeSelectorString(java.lang.String inSelectorString)
getSizeSelector
public org.scopemvc.core.Selector getSizeSelector()
setListModel
public void setListModel(java.lang.Object inModel)
- Can use this to specify a static list model for the contents of
the list rather than binding to a dynamic property of some
view model.
isSorted
public boolean isSorted()
setSorted
public void setSorted(boolean inSorted)
setSorted
public void setSorted(java.util.Comparator inComparator)
setComparator
public void setComparator(java.util.Comparator inComparator)
- Deprecated. see setSorted(Comparator)
getBoundModel
public final java.lang.Object getBoundModel()
setBoundModel
public 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)
- Ignores inReadOnly because makes no sense here.
- Specified by:
updateFromPropertyin interfaceorg.scopemvc.view.util.ModelBindable
getViewValue
public final java.lang.Object getViewValue()
- Makes no sense: can't change the property using an SAbstractListModel!
- Specified by:
getViewValuein interfaceorg.scopemvc.view.util.ModelBindable
validationFailed
public void validationFailed(java.lang.Exception inException)
- Makes no sense: can't change the property using an SAbstractListModel!
- Specified by:
validationFailedin interfaceorg.scopemvc.view.util.ModelBindable
validationSuccess
public void validationSuccess()
- Makes no sense: can't change the property using an SAbstractListModel!
- Specified by:
validationSuccessin interfaceorg.scopemvc.view.util.ModelBindable
getShownModel
public final java.lang.Object getShownModel()
- Get the (list) model object that the SListModel presents,
which may be a property of the bound model if a Selector
is specified. May be null if the bound property is
a JavaBeans indexed property.
setShownModel
protected void setShownModel(java.lang.Object inModel)
- Called internally from updateFromProperty().
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:
refreshin interfaceRefreshable
getManager
final org.scopemvc.core.PropertyManager getManager()
modelChanged
public void modelChanged(org.scopemvc.core.ModelChangeEvent inEvent)
- Description copied from interface:
org.scopemvc.core.ModelChangeListener Invoked to notify listeners of a change in the state of a org.scopemvc.core.ModelChangeEventSource.
- Specified by:
modelChangedin interfaceorg.scopemvc.core.ModelChangeListener
getSize
public int getSize()
- Description copied from interface:
javax.swing.ListModel - Return the number of data elements in the list.
- Specified by:
getSizein interfacejavax.swing.ListModel
getElementAt
public java.lang.Object getElementAt(int inIndex)
- Note that if the get() fails for any reason, a null is returned.
- Specified by:
getElementAtin interfacejavax.swing.ListModel
|
|||||||||
| Home >> All >> org >> scopemvc >> view >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC