org.apache.commons.scaffold.util
Class ResultListBase

java.lang.Object
  extended by org.apache.commons.scaffold.util.ResultListBase
All Implemented Interfaces:
Iterable, Collection, ResultList

public class ResultListBase
extends Object
implements ResultList

Concrete implementation of ResultList.

Version:
$Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
Author:
Ted Husted

Field Summary
protected  Map displayName
          The displayName map, if any.
protected  List result
          The result list [ArrayList].
protected  Scroller scroller
          Our scroller object for paging through lists.
 
Constructor Summary
ResultListBase()
          Default constructor.
ResultListBase(Collection c)
          Convenience constructor to populate result with a Collection.
ResultListBase(Object o)
          Convenience constructor to populate result with an element.
 
Method Summary
 boolean add(Object o)
          Appends the specified element to the end of this list (optional operation).
 boolean addAll(Collection c)
          Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.
 void clear()
          Removes all of the elements from this list..
 boolean contains(Object element)
          Returns true if this collection contains the specified element.
 boolean containsAll(Collection c)
          Returns true if this collection contains all of the elements in the specified collection.
 Object get(int index)
          Returns the element at the specified position in this list.
 Integer getCode()
          Return the code.
 int getCounter()
          Convenience method for maintaining a counter that can be shared among multiple components in some presentation systems (e.g, Tiles).
 Map getDisplayName()
          Return the displayName map (a HashMap).
 Object getElement(int index)
          Convenience accessor for get().
 Iterator getIterator()
          Convenience accessor for iterator().
 String getLegend()
          Return the legend.
 List getResult()
          Return the result list
 Scroller getScroller()
          Return our scroller.
 int getSize()
          Convenience accessor for size().
 boolean isEmpty()
          Returns true if this collection contains no elements.
 Iterator iterator()
          Return an iterator for the List.
 boolean populate(Object o, int index)
          Populate matching properties on given object, using bean at given index.
 boolean remove(Object o)
          Removes a single instance of the specified element from this collection, if it is present (optional operation).
 boolean removeAll(Collection c)
          Removes all this collection's elements that are also contained in the specified collection.
 boolean retainAll(Collection c)
          Retains only the elements in this collection that are contained in the specified collection.
 void setCode(Integer code)
          Set the code.
 void setCounter(int counter)
          Set a new counter value.
 void setDisplayName(Map displayName)
          Assign a new displayName list.
 void setLegend(String legend)
          Set the legend.
 void setLegend(String name, String value)
          Set the legend.
 void setResult(List result)
          Set our result
 void setScroller(Scroller scroller)
          Set our scroller.
 int size()
          Return the number of elements on the List.
 Object[] toArray()
          Returns an array containing all of the elements in this collection.
 Object[] toArray(Object[] a)
          Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

result

protected List result
The result list [ArrayList].


scroller

protected Scroller scroller
Our scroller object for paging through lists.


displayName

protected Map displayName
The displayName map, if any.

Constructor Detail

ResultListBase

public ResultListBase()
Default constructor.


ResultListBase

public ResultListBase(Object o)
Convenience constructor to populate result with an element.


ResultListBase

public ResultListBase(Collection c)
Convenience constructor to populate result with a Collection.

Method Detail

getResult

public List getResult()
Description copied from interface: ResultList
Return the result list

Specified by:
getResult in interface ResultList
Returns:
the result list

setResult

public void setResult(List result)
Description copied from interface: ResultList
Set our result

Specified by:
setResult in interface ResultList
Parameters:
result - The new result

setScroller

public void setScroller(Scroller scroller)
Description copied from interface: ResultList
Set our scroller.

Specified by:
setScroller in interface ResultList
Parameters:
scroller - The new scroller

getScroller

public Scroller getScroller()
Description copied from interface: ResultList
Return our scroller. The scroller object tracks the client's current position in a result list. The database (or a cache) can return part of a larger list at a time. The scroller object can be used to request the appropriate next or previous entry on the list, and also to display the relative postion of the first item in this batch (x of xx).

Specified by:
getScroller in interface ResultList
Returns:
Our scroller

getCounter

public int getCounter()
Description copied from interface: ResultList
Convenience method for maintaining a counter that can be shared among multiple components in some presentation systems (e.g, Tiles).

Specified by:
getCounter in interface ResultList
Returns:
The next counter value

setCounter

public void setCounter(int counter)
Description copied from interface: ResultList
Set a new counter value.

Specified by:
setCounter in interface ResultList

getCode

public Integer getCode()
Description copied from interface: ResultList
Return the code.

Specified by:
getCode in interface ResultList
Returns:
the code

setCode

public void setCode(Integer code)
Description copied from interface: ResultList
Set the code.

Specified by:
setCode in interface ResultList
Parameters:
code - The new code

getLegend

public String getLegend()
Description copied from interface: ResultList
Return the legend.

Specified by:
getLegend in interface ResultList
Returns:
the legend

setLegend

public void setLegend(String legend)
Description copied from interface: ResultList
Set the legend.

Specified by:
setLegend in interface ResultList
Parameters:
legend - The new legend

setLegend

public void setLegend(String name,
                      String value)
Description copied from interface: ResultList
Set the legend.

Specified by:
setLegend in interface ResultList

getDisplayName

public Map getDisplayName()
Description copied from interface: ResultList
Return the displayName map (a HashMap). These are localized titles for the properties names in the result list.

Specified by:
getDisplayName in interface ResultList
Returns:
the displayName list

setDisplayName

public void setDisplayName(Map displayName)
Description copied from interface: ResultList
Assign a new displayName list. These are localized titles for the properties names in the result list.

Specified by:
setDisplayName in interface ResultList

toArray

public Object[] toArray()
Description copied from interface: ResultList
Returns an array containing all of the elements in this collection.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface ResultList
Returns:
an array containing all of the elements in this collection

toArray

public Object[] toArray(Object[] a)
Description copied from interface: ResultList
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface ResultList
Returns:
an array containing the elements of this collection

isEmpty

public boolean isEmpty()
Description copied from interface: ResultList
Returns true if this collection contains no elements.

Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface ResultList
Returns:
true if this collection contains no elements

size

public int size()
Description copied from interface: ResultList
Return the number of elements on the List.

Specified by:
size in interface Collection
Specified by:
size in interface ResultList
Returns:
the size of the List

contains

public boolean contains(Object element)
Description copied from interface: ResultList
Returns true if this collection contains the specified element.

Specified by:
contains in interface Collection
Specified by:
contains in interface ResultList
Returns:
true if this collection contains the specified element

add

public boolean add(Object o)
Description copied from interface: ResultList
Appends the specified element to the end of this list (optional operation).

Specified by:
add in interface Collection
Specified by:
add in interface ResultList
Returns:
the row count

iterator

public Iterator iterator()
Description copied from interface: ResultList
Return an iterator for the List.

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface ResultList
Returns:
an iterator for the List

get

public Object get(int index)
Description copied from interface: ResultList
Returns the element at the specified position in this list.

Specified by:
get in interface ResultList

addAll

public boolean addAll(Collection c)
Description copied from interface: ResultList
Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.

Specified by:
addAll in interface Collection
Specified by:
addAll in interface ResultList

clear

public void clear()
Description copied from interface: ResultList
Removes all of the elements from this list..

Specified by:
clear in interface Collection
Specified by:
clear in interface ResultList

containsAll

public boolean containsAll(Collection c)
Description copied from interface: ResultList
Returns true if this collection contains all of the elements in the specified collection.

Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface ResultList
Returns:
true if this collection contains all of the elements in the specified collection

remove

public boolean remove(Object o)
Description copied from interface: ResultList
Removes a single instance of the specified element from this collection, if it is present (optional operation).

Specified by:
remove in interface Collection
Specified by:
remove in interface ResultList

removeAll

public boolean removeAll(Collection c)
Description copied from interface: ResultList
Removes all this collection's elements that are also contained in the specified collection.

Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface ResultList

retainAll

public boolean retainAll(Collection c)
Description copied from interface: ResultList
Retains only the elements in this collection that are contained in the specified collection.

Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface ResultList

getElement

public Object getElement(int index)
Description copied from interface: ResultList
Convenience accessor for get().

Specified by:
getElement in interface ResultList

getIterator

public Iterator getIterator()
Description copied from interface: ResultList
Convenience accessor for iterator().

Specified by:
getIterator in interface ResultList
Returns:
an iterator for the List

getSize

public int getSize()
Description copied from interface: ResultList
Convenience accessor for size().

Specified by:
getSize in interface ResultList
Returns:
the size of the List

populate

public boolean populate(Object o,
                        int index)
                 throws Exception
Description copied from interface: ResultList
Populate matching properties on given object, using bean at given index. Returns false if index>size. PropertyUtils.describe.

Specified by:
populate in interface ResultList
Throws:
Exception


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.