net.sourceforge.pebble.util
Class Pageable<T>

java.lang.Object
  extended by net.sourceforge.pebble.util.Pageable<T>

public class Pageable<T>
extends java.lang.Object

Helper class that implements paging over a collection.

Author:
Simon Brown

Field Summary
static int DEFAULT_PAGE_SIZE
          the default page size
 
Constructor Summary
Pageable(java.util.List<T> list)
          Creates a new instance with the specified list.
 
Method Summary
 java.util.List<T> getList()
          Gets the list that this instance is paging over.
 java.util.List<T> getListForPage()
          Gets the subset of the list for the current page.
 int getMaxPageRange()
          Gets the maximum page in the window.
 int getMaxPages()
          Gets the maximum number of pages.
 int getMinPageRange()
          Gets the minimum page in the window.
 int getNextPage()
          Determines whether there is a next page and gets the page number.
 int getPage()
          Gets the page.
 int getPageSize()
          Gets the page size.
 int getPreviousPage()
          Determines whether there is a previous page and gets the page number.
 void setPage(int p)
          Sets the page size.
 void setPageSize(int pageSize)
          Sets the page size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PAGE_SIZE

public static final int DEFAULT_PAGE_SIZE
the default page size

See Also:
Constant Field Values
Constructor Detail

Pageable

public Pageable(java.util.List<T> list)
Creates a new instance with the specified list.

Parameters:
list - a List
Method Detail

getList

public java.util.List<T> getList()
Gets the list that this instance is paging over.

Returns:
a List

getListForPage

public java.util.List<T> getListForPage()
Gets the subset of the list for the current page.

Returns:
a List

getPageSize

public int getPageSize()
Gets the page size.

Returns:
the page size as an int

setPageSize

public void setPageSize(int pageSize)
Sets the page size.

Parameters:
pageSize - the page size as an int

getPage

public int getPage()
Gets the page.

Returns:
the page as an int

setPage

public void setPage(int p)
Sets the page size.

Parameters:
p - the page as an int

getMaxPages

public int getMaxPages()
Gets the maximum number of pages.

Returns:
the maximum number of pages as an int

getPreviousPage

public int getPreviousPage()
Determines whether there is a previous page and gets the page number.

Returns:
the previous page number, or zero

getNextPage

public int getNextPage()
Determines whether there is a next page and gets the page number.

Returns:
the next page number, or 0

getMinPageRange

public int getMinPageRange()
Gets the minimum page in the window.

Returns:
the page number

getMaxPageRange

public int getMaxPageRange()
Gets the maximum page in the window.

Returns:
the page number


Copyright © 2003-2006, Simon Brown. All Rights Reserved.