|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.forum.action.util.Paginator
public class Paginator
A class to make paging of forum content easier. Lists of threads and messages usually need to be paged - using this class from your action or view should reduce the code need for page logic.
A paginator represents a set set of pages and a way to tell what the current, previous and next pages are. The getPages()/getPages(int) methods return a "window" of page objects. This makes it possible to easily print out a paginator of 10 pages out of a total of (for example) 279 pages. The window is intelligently computed to be around the current page. Note, this page doesn't maintain a cursor that can be advanced - simply, this class is not an iterator. This class facilitates a paginated view of a set of items at a given point in time.
Constructor Summary | |
---|---|
Paginator(Pageable pageable)
Creates a Paginator object. |
Method Summary | |
---|---|
boolean |
getNextPage()
Returns true if there is a page of items next to the current one in the list. |
int |
getNextPageStart()
Returns the starting index of the next page. |
int |
getNumPages()
Returns the number of total pages in this pagniator. |
Pageable |
getPageable()
Returns the underlying pageable object. |
int |
getPageIndex()
Returns the index of the current page. |
Page[] |
getPages()
Returns an array of viewable pages 10 items in length (at most). |
Page[] |
getPages(int numViewablePages)
Returns an array of Page objects representing the pages in a set of items. |
boolean |
getPreviousPage()
Returns true if there is a page of items previous to the current one in the list. |
int |
getPreviousPageStart()
Returns the starting index of the previous page. |
int |
getRange()
Returns the number of items per page. |
int |
getStart()
Returns the starting index at the current point in the list of items. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Paginator(Pageable pageable)
pageable
- an object implementing the Pageable inteface.Method Detail |
---|
public int getNumPages()
public Pageable getPageable()
public int getStart()
public int getRange()
public int getPageIndex()
public boolean getPreviousPage()
public int getPreviousPageStart()
public boolean getNextPage()
public int getNextPageStart()
public Page[] getPages()
getPages(int)
public Page[] getPages(int numViewablePages)
Note, the numViewablePages parameter is a hint but not a hard limit on the number of pages returned. The number of pages returned will be close to that number but not exactly to make the page array look good when rendered.
numViewablePages
- the size of the page window.
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |