edu.internet2.middleware.grouper.ui.util
Class CollectionPager

java.lang.Object
  extended by edu.internet2.middleware.grouper.ui.util.CollectionPager
All Implemented Interfaces:
Serializable

public class CollectionPager
extends Object
implements Serializable

Convenience class for use in UI to encapsulate paging logic, and enable creation of HTML links which maintain context

Version:
$Id: CollectionPager.java,v 1.6 2009-08-12 04:52:14 mchyzer Exp $
Author:
Gary Brown.
See Also:
Serialized Form

Constructor Summary
CollectionPager(Collection theAlwaysShowCollection, Collection collection, int count, String startStr, int start, String pageSizeStr, int pageSize)
          Constructor.
 
Method Summary
 Collection getCollection()
          Returns the collection.
 int getCount()
          Returns the count.
 int getLast()
           
 Map getNextParams()
           
 int getNextStart()
           
 int getPageSize()
          Returns the pageSize.
 HashMap getParams()
          Returns the params.
 Map getPrevParams()
           
 int getPrevStart()
           
 Map getRestartParams()
           
 int getStart()
          Returns the start.
 int getStart1()
          Returns the start.
 String getTarget()
           
 boolean isNext()
           
 boolean isPrev()
           
 void setCollection(Collection collection)
          Sets the collection.
 void setCount(int count)
          Sets the count.
 void setPageSize(int pageSize)
          Sets the pageSize.
 void setPageSizeStr(String pageSizeStr)
           
 void setParam(String key, Object value)
           
 void setParams(Map map)
          Adds to any existing params - used for generating links
 void setStartStr(String startStr)
           
 void setTarget(String target)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionPager

public CollectionPager(Collection theAlwaysShowCollection,
                       Collection collection,
                       int count,
                       String startStr,
                       int start,
                       String pageSizeStr,
                       int pageSize)
Constructor. If collection.size() < count it is assumed that only the items to display are in collection. start and pageSize can be set as int or String

Parameters:
collection - to page
count - total number of elements in collection
startStr -
start -
pageSizeStr -
pageSize -
Method Detail

getTarget

public String getTarget()
Returns:
Returns the target (where links are directed).

setTarget

public void setTarget(String target)
Parameters:
target - The target to set.

isNext

public boolean isNext()
Returns:
whether there is another page of results after current one

isPrev

public boolean isPrev()
Returns:
whther there was a previous page before current one

getNextStart

public int getNextStart()
Returns:
start position for next page

getPrevStart

public int getPrevStart()
Returns:
start position for previous page

getLast

public int getLast()
Returns:
position of last item to be returned on this page

getNextParams

public Map getNextParams()
Returns:
Map representing key/value pairs for a link to display the next page

getPrevParams

public Map getPrevParams()
Returns:
Map representing key/value pairs for a link to display the previous page

getRestartParams

public Map getRestartParams()
Returns:
Map representing key/value pairs for a link to display the first page

getCollection

public Collection getCollection()
Returns the collection.

Returns:
Collection

getCount

public int getCount()
Returns the count.

Returns:
int

getPageSize

public int getPageSize()
Returns the pageSize.

Returns:
int

getParams

public HashMap getParams()
Returns the params.

Returns:
HashMap

setCollection

public void setCollection(Collection collection)
Sets the collection.

Parameters:
collection - The collection to set

setCount

public void setCount(int count)
Sets the count.

Parameters:
count - The count to set

setPageSize

public void setPageSize(int pageSize)
Sets the pageSize.

Parameters:
pageSize - The pageSize to set

setParam

public void setParam(String key,
                     Object value)
Parameters:
key -
value -

setParams

public void setParams(Map map)
Adds to any existing params - used for generating links

Parameters:
map - The params to set

getStart

public int getStart()
Returns the start.

Returns:
int

getStart1

public int getStart1()
Returns the start.

Returns:
int

setPageSizeStr

public void setPageSizeStr(String pageSizeStr)
Parameters:
pageSizeStr - The pageSizeStr to set.

setStartStr

public void setStartStr(String startStr)
Parameters:
startStr - The startStr to set.