org.scopemvc.model.collection
Class ArrayModel

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

public class ArrayModel
extends BasicModel
implements java.util.List

A BasicModel wrapper for an Object[] that can propagate changes to contained Models up the Model hierarchy, and implements the java.util.List interface. The array itself is exposed via the "array" property, however, changes to this array must be made through the public API in order to maintain the model change propagation.

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

Version:
$Revision: 1.7 $ $Date: 2002/09/12 10:51:03 $
Author:
Steve Meyfroidt

Field Summary
static Selector ARRAY
          The selector for the array contained in this wrapper class.
 
Fields inherited from interface org.scopemvc.core.ModelChangeTypes
ACCESS_CHANGED, VALUE_ADDED, VALUE_CHANGED, VALUE_REMOVED
 
Constructor Summary
ArrayModel()
          Constructor for the ArrayModel object
ArrayModel(boolean inPropagateModelChanges)
          Constructor for the ArrayModel object
ArrayModel(boolean inPropagateModelChanges, int inSize)
          Constructor for the ArrayModel object
ArrayModel(boolean inPropagateModelChanges, java.lang.Object[] inArray)
          Constructor for the ArrayModel object
ArrayModel(int inSize)
          Constructor for the ArrayModel object
ArrayModel(java.lang.Object[] inArray)
          Constructor for the ArrayModel object
 
Method Summary
 void add(int index, java.lang.Object element)
          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 ArrayModel object
 boolean addAll(int index, java.util.Collection c)
          Adds an element to the All attribute of the ArrayModel 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
 java.lang.Object[] getArray()
          Gets the array
 int getIndexOf(java.lang.Object inValue)
          Deprecated. see indexOf
 int getSize()
          Expose size as a JavaBeans property.
 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 setArray(java.lang.Object[] inContents)
          Set contents to the passed Object array 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

ARRAY

public static final Selector ARRAY
The selector for the array contained in this wrapper class.

Constructor Detail

ArrayModel

public ArrayModel()
Constructor for the ArrayModel object


ArrayModel

public ArrayModel(java.lang.Object[] inArray)
Constructor for the ArrayModel object

Parameters:
inArray - The array to wrap

ArrayModel

public ArrayModel(int inSize)
Constructor for the ArrayModel object

Parameters:
inSize - The initial size of the array

ArrayModel

public ArrayModel(boolean inPropagateModelChanges)
Constructor for the ArrayModel object

Parameters:
inPropagateModelChanges - If true, propagate the changes made in the elements of the array

ArrayModel

public ArrayModel(boolean inPropagateModelChanges,
                  int inSize)
Constructor for the ArrayModel object

Parameters:
inPropagateModelChanges - If true, propagate the changes made in the elements of the array
inSize - The initial size of the array

ArrayModel

public ArrayModel(boolean inPropagateModelChanges,
                  java.lang.Object[] inArray)
Constructor for the ArrayModel object

Parameters:
inPropagateModelChanges - If true, propagate the changes made in the elements of the array
inArray - The array to wrap
Method Detail

getArray

public java.lang.Object[] getArray()
Gets the array

Returns:
The array value

getSize

public int getSize()
Expose size as a JavaBeans property.

Returns:
size of array, 0 if null.

getIndexOf

public int getIndexOf(java.lang.Object inValue)
Deprecated. see indexOf

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

setArray

public void setArray(java.lang.Object[] inContents)
Set contents to the passed Object array and fire a ModelChangeEvent.

Parameters:
inContents - The new array 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 ArrayModel 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 ArrayModel 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 element)
TODO: document the method

Specified by:
add in interface java.util.List
Parameters:
index - TODO: Describe the Parameter
element - 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.