java.lang.Object
org.scopemvc.model.basic.BasicModel
org.scopemvc.model.collection.ListModelAdaptor
- All Implemented Interfaces:
- org.scopemvc.core.ModelChangeEventSource, org.scopemvc.core.ModelChangeListener, org.scopemvc.core.ModelChangeTypes
- public class ListModelAdaptor
- extends org.scopemvc.model.basic.BasicModel
- implements org.scopemvc.core.ModelChangeListener
Used to present a list of ListModelSources as
an active BasicModel. Useful when
initialising org.scopemvc.view.swing.SComboBox
or org.scopemvc.view.swing.SList with a static
list of data.
This will propogate ModelChangeEvents from sublists that
are ModelChangeEventSources. Note that this adaptor registers
as a listener with such sublists: it may be necessary to
manually unregister with removeModelChangeListeners() 55
if an adaptor is no longer needed.
The adaptor can present its ListModelSources as a sorted list
if a Comparator is passed to setComparator(java.util.Comparator) 55
or all list elements implement Comparable and setSorted(boolean) 55
is called.
- Version:
- $Revision: 1.4 $ $Date: 2002/01/12 09:35:40 $
| Fields inherited from class org.scopemvc.model.basic.BasicModel |
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LIST_SELECTOR
public static final org.scopemvc.core.Selector LIST_SELECTOR
LIST_SIZE_SELECTOR
public static final org.scopemvc.core.Selector LIST_SIZE_SELECTOR
list
private java.util.List list
listSources
private ListModelSource[] listSources
sorted
private boolean sorted
comparator
private java.util.Comparator comparator
ListModelAdaptor
public ListModelAdaptor(ListModelSource[] listSources)
ListModelAdaptor
public ListModelAdaptor(ListModelSource listSource)
removeModelChangeListeners
public void removeModelChangeListeners()
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:
modelChanged in interface org.scopemvc.core.ModelChangeListener
isListChangeEvent
private boolean isListChangeEvent(org.scopemvc.core.ModelChangeEvent inEvent)
getList
public java.util.List getList()
getSize
public int getSize()
getElementAt
public java.lang.Object getElementAt(int inIndex)
isSorted
public boolean isSorted()
setSorted
public void setSorted(boolean inSorted)
setComparator
public void setComparator(java.util.Comparator inComparator)
loadList
protected void loadList()