org.mentawai.filter
Class Paginator

java.lang.Object
  extended by org.mentawai.filter.Paginator

public class Paginator
extends Object

Paginator POJO which contains paged data and other useful information. The class should only be instantiated and used by the PaginatorFilter!

Author:
Sven Jacobs
See Also:
PaginatorFilter

Method Summary
 int getCount()
          Gets the count (amount of all data over all pages)
 int getCurrentPage()
          Gets current page index.
 Object[] getData()
          Returns the paged data.
 int getItemsPerPage()
          Gets items per page.
 int getMaxPage()
          Gets max page index.
 int getNextPage()
           
 int getNumberOfItems()
          Return the number of items in this page.
 int getPreviousPage()
           
 boolean hasNext()
           
 boolean hasPrevious()
           
 void setCount(int count)
          Sets the count (amount of all data over all pages)
 void setCurrentPage(int currentPage)
          Set current page index.
 void setData(Object[] data)
          Sets the paged data.
 void setItemsPerPage(int itemsPerPage)
          Sets items per page.
 void setMaxPage(int maxPage)
          Sets max page index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasNext

public boolean hasNext()

hasPrevious

public boolean hasPrevious()

getNextPage

public int getNextPage()

getPreviousPage

public int getPreviousPage()

setData

public void setData(Object[] data)
Sets the paged data.

Parameters:
data - Paged data

getData

public Object[] getData()
Returns the paged data.

Returns:
Paged data

setCurrentPage

public void setCurrentPage(int currentPage)
Set current page index.

Parameters:
currentPage - Current page index

getCurrentPage

public int getCurrentPage()
Gets current page index.

Returns:
Current page index

setMaxPage

public void setMaxPage(int maxPage)
Sets max page index.

Parameters:
maxPage - Max page index

getMaxPage

public int getMaxPage()
Gets max page index.

Returns:
Max page index

setItemsPerPage

public void setItemsPerPage(int itemsPerPage)
Sets items per page.

This value reflects the itemsPerPage property of the PaginatorFilter and not the actual amount of items of the current page.

Parameters:
itemsPerPage - Items per page
See Also:
PaginatorFilter

getItemsPerPage

public int getItemsPerPage()
Gets items per page.

This value reflects the itemsPerPage property of the PaginatorFilter and not the actual amount of items of the current page.

Returns:
Items per page
See Also:
PaginatorFilter

getNumberOfItems

public int getNumberOfItems()
Return the number of items in this page. This may be less than what this page can display, for example, you may be displaying 10 items per page but your collecion has only 15 items. So the last page will have 5 items only.

Returns:
The number of items in this page

setCount

public void setCount(int count)
Sets the count (amount of all data over all pages)

Parameters:
count - Amount of all data

getCount

public int getCount()
Gets the count (amount of all data over all pages)

Returns:
Amount of all data


Copyright © 2013. All Rights Reserved.