org.riotfamily.components.model.wrapper
Class ListWrapper

java.lang.Object
  extended by org.riotfamily.components.model.wrapper.ValueWrapper<List<?>>
      extended by org.riotfamily.components.model.wrapper.ListWrapper
All Implemented Interfaces:
Iterable<Object>, Collection<Object>, List<Object>

public class ListWrapper
extends ValueWrapper<List<?>>
implements List<Object>

Since:
7.0
Author:
Felix Gnass [fgnass at neteye dot de]

Constructor Summary
ListWrapper()
           
 
Method Summary
 void add(int index, Object item)
           
 boolean add(Object item)
           
 boolean addAll(Collection<?> items)
           
 boolean addAll(int index, Collection<?> items)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> items)
           
 ListWrapper deepCopy()
          Creates a deep copy.
 void each(ValueCallback callback)
           
 boolean equals(Object obj)
          Delegates the call to the equals method of the wrapped object.
 Object get(int index)
           
 List<?> getValue()
          Returns the value that is passed to the form element when the value is edited.
 List<ValueWrapper<?>> getWrapperList()
           
 int hashCode()
          Delegates the call to the hashCode method of the wrapped object.
 int indexOf(Object o)
           
 boolean isEmpty()
           
 Iterator iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> items)
           
 boolean retainAll(Collection<?> items)
           
 Object set(int index, Object o)
           
 void setValue(List<?> value)
           
 void setWrapperList(List<ValueWrapper<?>> wrapperList)
           
 int size()
           
 List subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 List<?> unwrap()
          Returns the wrapped value.
 void wrap(Object value)
          Wraps the given value.
 
Methods inherited from class org.riotfamily.components.model.wrapper.ValueWrapper
getId, setId, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListWrapper

public ListWrapper()
Method Detail

wrap

public void wrap(Object value)
Description copied from class: ValueWrapper
Wraps the given value. The default implementation delegates the call to ValueWrapper.setValue(Object).

Overrides:
wrap in class ValueWrapper<List<?>>

getValue

public List<?> getValue()
Description copied from class: ValueWrapper
Returns the value that is passed to the form element when the value is edited. Subclasses will usually return the wrapped value, except for complex wrappers (like ListWrapper and MapWrapper) which return a self-reference.

Specified by:
getValue in class ValueWrapper<List<?>>

setValue

public void setValue(List<?> value)
Specified by:
setValue in class ValueWrapper<List<?>>

getWrapperList

public List<ValueWrapper<?>> getWrapperList()

setWrapperList

public void setWrapperList(List<ValueWrapper<?>> wrapperList)

unwrap

public List<?> unwrap()
Description copied from class: ValueWrapper
Returns the wrapped value. The default implementation delegates the call to ValueWrapper.getValue(). Subclasses that wrap complex values (values with nested wrappers) must overwrite this method to perform a "deep-unwrapping".

Overrides:
unwrap in class ValueWrapper<List<?>>

deepCopy

public ListWrapper deepCopy()
Description copied from class: ValueWrapper
Creates a deep copy. Subclasses will usually just create a new wrapper instance and and invoke ValueWrapper.setValue(Object) with the value returned by ValueWrapper.getValue(). Complex wrappers have to make sure that the deepCopy method is invoked for all nested values too.

Specified by:
deepCopy in class ValueWrapper<List<?>>

each

public void each(ValueCallback callback)
Overrides:
each in class ValueWrapper<List<?>>

clear

public void clear()
Specified by:
clear in interface Collection<Object>
Specified by:
clear in interface List<Object>

add

public boolean add(Object item)
Specified by:
add in interface Collection<Object>
Specified by:
add in interface List<Object>

add

public void add(int index,
                Object item)
Specified by:
add in interface List<Object>

addAll

public boolean addAll(Collection<?> items)
Specified by:
addAll in interface Collection<Object>
Specified by:
addAll in interface List<Object>

addAll

public boolean addAll(int index,
                      Collection<?> items)
Specified by:
addAll in interface List<Object>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<Object>
Specified by:
contains in interface List<Object>

containsAll

public boolean containsAll(Collection<?> items)
Specified by:
containsAll in interface Collection<Object>
Specified by:
containsAll in interface List<Object>

get

public Object get(int index)
Specified by:
get in interface List<Object>

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List<Object>

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List<Object>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<Object>
Specified by:
isEmpty in interface List<Object>

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable<Object>
Specified by:
iterator in interface Collection<Object>
Specified by:
iterator in interface List<Object>

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List<Object>

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List<Object>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<Object>
Specified by:
remove in interface List<Object>

remove

public Object remove(int index)
Specified by:
remove in interface List<Object>

removeAll

public boolean removeAll(Collection<?> items)
Specified by:
removeAll in interface Collection<Object>
Specified by:
removeAll in interface List<Object>

retainAll

public boolean retainAll(Collection<?> items)
Specified by:
retainAll in interface Collection<Object>
Specified by:
retainAll in interface List<Object>

set

public Object set(int index,
                  Object o)
Specified by:
set in interface List<Object>

size

public int size()
Specified by:
size in interface Collection<Object>
Specified by:
size in interface List<Object>

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List<Object>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<Object>
Specified by:
toArray in interface List<Object>

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection<Object>
Specified by:
toArray in interface List<Object>

hashCode

public int hashCode()
Description copied from class: ValueWrapper
Delegates the call to the hashCode method of the wrapped object.

Specified by:
hashCode in interface Collection<Object>
Specified by:
hashCode in interface List<Object>
Overrides:
hashCode in class ValueWrapper<List<?>>

equals

public boolean equals(Object obj)
Description copied from class: ValueWrapper
Delegates the call to the equals method of the wrapped object.

Specified by:
equals in interface Collection<Object>
Specified by:
equals in interface List<Object>
Overrides:
equals in class ValueWrapper<List<?>>