|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractListModel | +--org.scopemvc.view.swing.SAbstractListModel
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:
setSizeSelector(org.scopemvc.core.Selector)
or setSizeSelectorString(java.lang.String)
. 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)
or all list elements implement
Comparable and setSorted(boolean)
is called.
***** This implementation makes no provisions for thread-safety.
SList
,
STable
,
SComboBox
,
ListModelAdaptor
,
Serialized FormField Summary | |
protected java.lang.Object |
listModel
TODO: describe of the Field |
protected Selector |
sizeSelector
TODO: describe of the Field |
Fields inherited from class javax.swing.AbstractListModel |
listenerList |
Constructor Summary | |
SAbstractListModel()
|
Method Summary | |
protected boolean |
containsElement(java.lang.Object inValue)
Returns true if the bound model contains the value in its list of elements |
protected void |
doModelChanged(ModelChangeEvent inEvent)
Respond to a change in the model by firing the appropriate ListDataEvent |
java.lang.Object |
getBoundModel()
Gets the bound model |
java.lang.Object |
getElementAt(int inIndex)
Note that if the get() fails for any reason, a null is returned. |
Selector |
getSelector()
Gets the selector |
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()
Gets the size |
Selector |
getSizeSelector()
Gets the size selector |
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. |
boolean |
isSorted()
Gets the sorted |
void |
modelChanged(ModelChangeEvent inEvent)
Invoked to notify listeners of a change in the state of a ModelChangeEventSource . |
void |
refresh()
TODO: document the method |
void |
setBoundModel(java.lang.Object inModel)
Sets the bound model |
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(Selector inSelector)
Sets the selector |
void |
setSelectorString(java.lang.String inSelectorString)
Sets the selector string |
protected void |
setShownModel(java.lang.Object inModel)
Called internally from updateFromProperty(). |
void |
setSizeSelector(Selector inSelector)
Sets the size selector |
void |
setSizeSelectorString(java.lang.String inSelectorString)
Sets the size selector string |
void |
setSorted(boolean inSorted)
Sets the sorted |
void |
setSorted(java.util.Comparator inComparator)
Sets the sorted |
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 |
protected Selector sizeSelector
protected java.lang.Object listModel
Constructor Detail |
public SAbstractListModel()
Method Detail |
public final java.lang.Object getBoundModel()
public final Selector getSelector()
public final java.lang.Object getViewValue()
getViewValue
in interface ModelBindable
public final java.lang.Object getShownModel()
public Selector getSizeSelector()
public boolean isSorted()
public int getSize()
getSize
in interface javax.swing.ListModel
public java.lang.Object getElementAt(int inIndex)
getElementAt
in interface javax.swing.ListModel
inIndex
- TODO: Describe the Parameter
public final void setSelector(Selector inSelector)
inSelector
- The new selector valuepublic final void setSelectorString(java.lang.String inSelectorString)
inSelectorString
- The new selectorString valuepublic void setSizeSelector(Selector inSelector)
inSelector
- The new sizeSelector valuepublic void setSizeSelectorString(java.lang.String inSelectorString)
inSelectorString
- The new sizeSelectorString valuepublic void setListModel(java.lang.Object inModel)
inModel
- The new listModel valueListModelAdaptor
public void setSorted(boolean inSorted)
inSorted
- The new sorted valuepublic void setSorted(java.util.Comparator inComparator)
inComparator
- The new sorted valuepublic void setComparator(java.util.Comparator inComparator)
inComparator
- The new comparator valuepublic void setBoundModel(java.lang.Object inModel)
inModel
- The new boundModel valuepublic void updateFromProperty(java.lang.Object inValue, boolean inReadOnly)
updateFromProperty
in interface ModelBindable
inValue
- TODO: Describe the ParameterinReadOnly
- TODO: Describe the Parameterpublic void validationFailed(java.lang.Exception inException)
validationFailed
in interface ModelBindable
inException
- TODO: Describe the Parameterpublic void validationSuccess()
validationSuccess
in interface ModelBindable
ModelBindable.validationFailed(java.lang.Exception)
public void refresh()
refresh
in interface Refreshable
public void modelChanged(ModelChangeEvent inEvent)
Invoked to notify listeners of a change in the state of a ModelChangeEventSource
.
ListDataEvent are fired by this method from the Swing event thread.
modelChanged
in interface ModelChangeListener
inEvent
- the ModelChangeEvent
representing the change in
state of the ModelChangeEventSource.protected void setShownModel(java.lang.Object inModel)
inModel
- The new shownModel valueprotected void doModelChanged(ModelChangeEvent inEvent)
inEvent
- the ModelChangeEvent
representing the change in
state of the ModelChangeEventSource.protected boolean containsElement(java.lang.Object inValue)
inValue
- The value to check
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |