org.scopemvc.model.collection
Class ListModel

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

public class ListModel
extends BasicModel
implements java.util.List

A BasicModel wrapper for an List that can propagate changes to contained Models up the Model hierarchy. The list itself is exposed via the "list" property, however, changes to this list must be made through this class's public API in order to maintain the event propagation.

By default ListModel registers itself as a listener to Models that are added to the list and deregisters when those Models are removed. This behaviour can be changed at creation so that ModelChangeEvent propagation is disabled.

Version:
$Revision: 1.12 $
Author:
Simon Harris
, Steve Meyfroidt

Field Summary
protected  java.util.List contents
          TODO: describe of the Field
static Selector LIST
          TODO: describe of the Field
protected  boolean propagateModelChanges
          TODO: describe of the Field
protected static java.lang.String TO_STRING_SEPARATOR
          TODO: describe of the Field
protected static int TO_STRING_SEPARATOR_LENGTH
          TODO: describe of the Field
 
Fields inherited from interface org.scopemvc.core.ModelChangeTypes
ACCESS_CHANGED, VALUE_ADDED, VALUE_CHANGED, VALUE_REMOVED
 
Constructor Summary
ListModel()
          Constructor for the ListModel object
ListModel(boolean inPropagateModelChanges)
          Constructor for the ListModel object
ListModel(boolean inPropagateModelChanges, java.util.List inList)
          Constructor for the ListModel object
ListModel(java.util.List inList)
          Constructor for the ListModel object
 
Method Summary
 void add(int index, java.lang.Object o)
          TODO: document the method
 boolean add(java.lang.Object o)
          TODO: document the method
 boolean addAll(java.util.Collection c)
          Adds an element to the All attribute of the ListModel object
 boolean addAll(int index, java.util.Collection c)
          Adds an element to the All attribute of the ListModel object
 void clear()
          TODO: document the method
 boolean contains(java.lang.Object o)
          TODO: document the method
 boolean containsAll(java.util.Collection c)
          TODO: document the method
 boolean equals(java.lang.Object o)
          TODO: document the method
 java.lang.Object get(int index)
          TODO: document the method
 int getIndexOf(java.lang.Object inValue)
          Gets the index of
 java.util.List getList()
          Gets the list
 int getSize()
          Gets the size
 int hashCode()
          TODO: document the method
 int indexOf(java.lang.Object o)
          TODO: document the method
 boolean isEmpty()
          Gets the empty
 java.util.Iterator iterator()
          TODO: document the method
 int lastIndexOf(java.lang.Object o)
          TODO: document the method
 java.util.ListIterator listIterator()
          TODO: document the method
 java.util.ListIterator listIterator(int index)
          TODO: document the method
 java.lang.Object remove(int index)
          TODO: document the method
 boolean remove(java.lang.Object o)
          TODO: document the method
 boolean removeAll(java.util.Collection c)
          TODO: document the method
 boolean retainAll(java.util.Collection c)
          TODO: document the method
 java.lang.Object set(int index, java.lang.Object element)
          TODO: document the method
 void setList(java.util.List inContents)
          Set contents to the passed Object list and fire a ModelChangeEvent.
 int size()
          TODO: document the method
 java.util.List subList(int fromIndex, int toIndex)
          TODO: document the method
 java.lang.Object[] toArray()
          TODO: document the method
 java.lang.Object[] toArray(java.lang.Object[] a)
          TODO: document the method
 java.lang.String toString()
          TODO: document the method
 
Methods inherited from class org.scopemvc.model.basic.BasicModel
addModelChangeListener, fireModelChange, listenNewSubmodel, makeActive, modelChanged, removeModelChangeListener, unlistenOldSubmodel
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LIST

public static final Selector LIST
TODO: describe of the Field


TO_STRING_SEPARATOR

protected static final java.lang.String TO_STRING_SEPARATOR
TODO: describe of the Field

See Also:
Constant Field Values

TO_STRING_SEPARATOR_LENGTH

protected static final int TO_STRING_SEPARATOR_LENGTH
TODO: describe of the Field


contents

protected java.util.List contents
TODO: describe of the Field


propagateModelChanges

protected boolean propagateModelChanges
TODO: describe of the Field

Constructor Detail

ListModel

public ListModel()
Constructor for the ListModel object


ListModel

public ListModel(java.util.List inList)
Constructor for the ListModel object

Parameters:
inList - TODO: Describe the Parameter

ListModel

public ListModel(boolean inPropagateModelChanges)
Constructor for the ListModel object

Parameters:
inPropagateModelChanges - TODO: Describe the Parameter

ListModel

public ListModel(boolean inPropagateModelChanges,
                 java.util.List inList)
Constructor for the ListModel object

Parameters:
inPropagateModelChanges - TODO: Describe the Parameter
inList - 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

getIndexOf

public int getIndexOf(java.lang.Object inValue)
Gets the index of

Parameters:
inValue - TODO: Describe the Parameter
Returns:
The indexOf value

isEmpty

public boolean isEmpty()
Gets the empty

Specified by:
isEmpty in interface java.util.List
Returns:
The empty value

get

public java.lang.Object get(int index)
TODO: document the method

Specified by:
get in interface java.util.List
Parameters:
index - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

setList

public void setList(java.util.List inContents)
Set contents to the passed Object list and fire a ModelChangeEvent.

Parameters:
inContents - The new list value

set

public java.lang.Object set(int index,
                            java.lang.Object element)
TODO: document the method

Specified by:
set in interface java.util.List
Parameters:
index - TODO: Describe the Parameter
element - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

toString

public java.lang.String toString()
TODO: document the method

Overrides:
toString in class java.lang.Object
Returns:
TODO: Describe the Return Value

iterator

public java.util.Iterator iterator()
TODO: document the method

Specified by:
iterator in interface java.util.List
Returns:
TODO: Describe the Return Value

size

public int size()
TODO: document the method

Specified by:
size in interface java.util.List
Returns:
TODO: Describe the Return Value

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
TODO: document the method

Specified by:
toArray in interface java.util.List
Parameters:
a - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

contains

public boolean contains(java.lang.Object o)
TODO: document the method

Specified by:
contains in interface java.util.List
Parameters:
o - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

remove

public boolean remove(java.lang.Object o)
TODO: document the method

Specified by:
remove in interface java.util.List
Parameters:
o - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

toArray

public java.lang.Object[] toArray()
TODO: document the method

Specified by:
toArray in interface java.util.List
Returns:
TODO: Describe the Return Value

addAll

public boolean addAll(java.util.Collection c)
Adds an element to the All attribute of the ListModel object

Specified by:
addAll in interface java.util.List
Parameters:
c - The element to be added to the All attribute
Returns:
TODO: Describe the Return Value

add

public boolean add(java.lang.Object o)
TODO: document the method

Specified by:
add in interface java.util.List
Parameters:
o - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

removeAll

public boolean removeAll(java.util.Collection c)
TODO: document the method

Specified by:
removeAll in interface java.util.List
Parameters:
c - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

containsAll

public boolean containsAll(java.util.Collection c)
TODO: document the method

Specified by:
containsAll in interface java.util.List
Parameters:
c - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

clear

public void clear()
TODO: document the method

Specified by:
clear in interface java.util.List

addAll

public boolean addAll(int index,
                      java.util.Collection c)
Adds an element to the All attribute of the ListModel object

Specified by:
addAll in interface java.util.List
Parameters:
index - The element to be added to the All attribute
c - The element to be added to the All attribute
Returns:
TODO: Describe the Return Value

hashCode

public int hashCode()
TODO: document the method

Specified by:
hashCode in interface java.util.List
Overrides:
hashCode in class java.lang.Object
Returns:
TODO: Describe the Return Value

retainAll

public boolean retainAll(java.util.Collection c)
TODO: document the method

Specified by:
retainAll in interface java.util.List
Parameters:
c - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

equals

public boolean equals(java.lang.Object o)
TODO: document the method

Specified by:
equals in interface java.util.List
Overrides:
equals in class java.lang.Object
Parameters:
o - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

remove

public java.lang.Object remove(int index)
TODO: document the method

Specified by:
remove in interface java.util.List
Parameters:
index - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

lastIndexOf

public int lastIndexOf(java.lang.Object o)
TODO: document the method

Specified by:
lastIndexOf in interface java.util.List
Parameters:
o - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

add

public void add(int index,
                java.lang.Object o)
TODO: document the method

Specified by:
add in interface java.util.List
Parameters:
index - TODO: Describe the Parameter
o - TODO: Describe the Parameter

listIterator

public java.util.ListIterator listIterator(int index)
TODO: document the method

Specified by:
listIterator in interface java.util.List
Parameters:
index - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

indexOf

public int indexOf(java.lang.Object o)
TODO: document the method

Specified by:
indexOf in interface java.util.List
Parameters:
o - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value

listIterator

public java.util.ListIterator listIterator()
TODO: document the method

Specified by:
listIterator in interface java.util.List
Returns:
TODO: Describe the Return Value

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
TODO: document the method

Specified by:
subList in interface java.util.List
Parameters:
fromIndex - TODO: Describe the Parameter
toIndex - TODO: Describe the Parameter
Returns:
TODO: Describe the Return Value


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