fr.paris.lutece.util.html
Class Paginator

java.lang.Object
  extended by fr.paris.lutece.util.html.Paginator

public class Paginator
extends java.lang.Object

Paginator provides a way to display a collection of items on severals pages.


Field Summary
static java.lang.String PARAMETER_ITEMS_PER_PAGE
          Default value for Items Per Page Parameter
static java.lang.String PARAMETER_PAGE_INDEX
          Default value for Page Index Parameter
 
Constructor Summary
Paginator(java.util.List list, int nItemPerPage, java.lang.String strBaseUrl, java.lang.String strPageIndexParameterName, java.lang.String strPageIndex)
          Creates a new instance of Paginator
 
Method Summary
 int getItemsCount()
          Returns the number of items in the collection
static int getItemsPerPage(javax.servlet.http.HttpServletRequest request, java.lang.String strParameter, int nCurrent, int nDefault)
          Gets the number of items per page from a request parameter
 java.lang.String getNextPageLink()
          Returns the previous page link
 int getPageCurrent()
          Returns the current page index
static java.lang.String getPageIndex(javax.servlet.http.HttpServletRequest request, java.lang.String strParameter, java.lang.String strCurrentPageIndex)
          Gets the new page index from a request parameter
 java.util.List getPageItems()
          Returns the List
 int getPagesCount()
          Gets the number of pages
 java.util.List<PaginatorPage> getPagesLinks()
          Returns Pages Links
 java.lang.String getPreviousPageLink()
          Returns the previous page link
 int getRangeMax()
          Returns the index of the last item of the current page range
 int getRangeMin()
          Returns the index of the first item of the current page range
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_PAGE_INDEX

public static final java.lang.String PARAMETER_PAGE_INDEX
Default value for Page Index Parameter

See Also:
Constant Field Values

PARAMETER_ITEMS_PER_PAGE

public static final java.lang.String PARAMETER_ITEMS_PER_PAGE
Default value for Items Per Page Parameter

See Also:
Constant Field Values
Constructor Detail

Paginator

public Paginator(java.util.List list,
                 int nItemPerPage,
                 java.lang.String strBaseUrl,
                 java.lang.String strPageIndexParameterName,
                 java.lang.String strPageIndex)
Creates a new instance of Paginator

Parameters:
list - The collection to paginate
nItemPerPage - Number of items to display per page
strBaseUrl - The base Url for build links on each page link
strPageIndexParameterName - The parameter name for the page index
strPageIndex - The current page index
Method Detail

getPagesCount

public int getPagesCount()
Gets the number of pages

Returns:
the number of pages

getPageItems

public java.util.List getPageItems()
Returns the List

Returns:
The List

getPageCurrent

public int getPageCurrent()
Returns the current page index

Returns:
The current page index

getPreviousPageLink

public java.lang.String getPreviousPageLink()
Returns the previous page link

Returns:
The previous page link

getNextPageLink

public java.lang.String getNextPageLink()
Returns the previous page link

Returns:
The previous page link

getPagesLinks

public java.util.List<PaginatorPage> getPagesLinks()
Returns Pages Links

Returns:
Pages Links

getRangeMin

public int getRangeMin()
Returns the index of the first item of the current page range

Returns:
The index of the first item of the current page range

getRangeMax

public int getRangeMax()
Returns the index of the last item of the current page range

Returns:
The index of the last item of the current page range

getItemsCount

public int getItemsCount()
Returns the number of items in the collection

Returns:
The number of items in the collection

getItemsPerPage

public static int getItemsPerPage(javax.servlet.http.HttpServletRequest request,
                                  java.lang.String strParameter,
                                  int nCurrent,
                                  int nDefault)
Gets the number of items per page from a request parameter

Parameters:
request - The HTTP request
strParameter - The request parameter name
nCurrent - The current number of items
nDefault - The default number of items
Returns:
The new number of items

getPageIndex

public static java.lang.String getPageIndex(javax.servlet.http.HttpServletRequest request,
                                            java.lang.String strParameter,
                                            java.lang.String strCurrentPageIndex)
Gets the new page index from a request parameter

Parameters:
request - The HTTP request
strParameter - The request parameter name
strCurrentPageIndex - The current page index
Returns:
The new page index


Copyright © 2007 Mairie de Paris. All Rights Reserved.