org.scopemvc.model.collection
Class ListModelAdaptor

java.lang.Object
  |
  +--org.scopemvc.model.basic.BasicModel
        |
        +--org.scopemvc.model.collection.ListModelAdaptor
All Implemented Interfaces:
ModelChangeEventSource, ModelChangeListener, ModelChangeTypes

public class ListModelAdaptor
extends BasicModel
implements ModelChangeListener

Used to present a list of ListModelSources as an active BasicModel. Useful when initialising SComboBox or SList with a static list of data.

This will propagate 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() 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) or all list elements implement Comparable and setSorted(boolean) is called.

Version:
$Revision: 1.6 $ $Date: 2002/09/12 10:51:03 $
Author:
Roytman, Alex
, Steve Meyfroidt

Field Summary
static Selector LIST_SELECTOR
          TODO: describe of the Field
static Selector LIST_SIZE_SELECTOR
          TODO: describe of the Field
 
Fields inherited from interface org.scopemvc.core.ModelChangeTypes
ACCESS_CHANGED, VALUE_ADDED, VALUE_CHANGED, VALUE_REMOVED
 
Constructor Summary
ListModelAdaptor(ListModelSource listSource)
          Constructor for the ListModelAdaptor object
ListModelAdaptor(ListModelSource[] listSources)
          Constructor for the ListModelAdaptor object
 
Method Summary
 java.lang.Object getElementAt(int inIndex)
          Gets the element at
 java.util.List getList()
          Gets the list
 int getSize()
          Gets the size
 boolean isSorted()
          Gets the sorted
protected  void loadList()
          TODO: document the method
 void modelChanged(ModelChangeEvent inEvent)
          TODO: document the method
 void removeModelChangeListeners()
          TODO: document the method
 void setComparator(java.util.Comparator inComparator)
          Sets the comparator
 void setSorted(boolean inSorted)
          Sets the sorted
 
Methods inherited from class org.scopemvc.model.basic.BasicModel
addModelChangeListener, fireModelChange, listenNewSubmodel, makeActive, removeModelChangeListener, unlistenOldSubmodel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIST_SELECTOR

public static final Selector LIST_SELECTOR
TODO: describe of the Field


LIST_SIZE_SELECTOR

public static final Selector LIST_SIZE_SELECTOR
TODO: describe of the Field

Constructor Detail

ListModelAdaptor

public ListModelAdaptor(ListModelSource[] listSources)
Constructor for the ListModelAdaptor object

Parameters:
listSources - TODO: Describe the Parameter

ListModelAdaptor

public ListModelAdaptor(ListModelSource listSource)
Constructor for the ListModelAdaptor object

Parameters:
listSource - TODO: Describe the Parameter
Method Detail

getList

public java.util.List getList()
Gets the list

Returns:
The list value

getSize

public int getSize()
Gets the size

Returns:
The size value

getElementAt

public java.lang.Object getElementAt(int inIndex)
Gets the element at

Parameters:
inIndex - TODO: Describe the Parameter
Returns:
The elementAt value

isSorted

public boolean isSorted()
Gets the sorted

Returns:
The sorted value

setSorted

public void setSorted(boolean inSorted)
Sets the sorted

Parameters:
inSorted - The new sorted value

setComparator

public void setComparator(java.util.Comparator inComparator)
Sets the comparator

Parameters:
inComparator - The new comparator value

removeModelChangeListeners

public void removeModelChangeListeners()
TODO: document the method


modelChanged

public void modelChanged(ModelChangeEvent inEvent)
TODO: document the method

Specified by:
modelChanged in interface ModelChangeListener
Overrides:
modelChanged in class BasicModel
Parameters:
inEvent - TODO: Describe the Parameter

loadList

protected void loadList()
TODO: document the method



Copyright © 2000-2002 The Scope Team. All Rights Reserved.