org.gvsig.tools.paging
Interface PagingCalculator

All Known Subinterfaces:
DynObjectPagingHelper
All Known Implementing Classes:
DefaultDynObjectPagingHelper, DefaultPagingCalculator

public interface PagingCalculator

Calculates all the values needed to perform pagination over a set of data.

Author:
gvSIG team

Nested Class Summary
static interface PagingCalculator.Sizeable
          Interface for objects that have a size.
 
Field Summary
static int DEFAULT_PAGE_SIZE
           
 
Method Summary
 long getCurrentPage()
          Returns the number of the currently loaded page of data (zero based).
 int getCurrentPageSize()
          Returns the number of elements of the current page.
 long getInitialIndex()
          Returns the index of the initial element of the current page into all the elements.
 int getMaxPageSize()
          Returns the current maximum number of values per page.
 long getNumPages()
          Returns the number of pages available, calculated with the total number of elements and the maximum number of elements per page.
 long getTotalSize()
          Returns the number of elements of the entire set of data.
 void setCurrentPage(long page)
          Sets the current page number (zero based), and loads the elements for that page.
 void setMaxPageSize(int pageSize)
          Sets the current maximum number of elements per page.
 

Field Detail

DEFAULT_PAGE_SIZE

static final int DEFAULT_PAGE_SIZE
See Also:
Constant Field Values
Method Detail

getMaxPageSize

int getMaxPageSize()
Returns the current maximum number of values per page.

Returns:
the current maximum page size

setMaxPageSize

void setMaxPageSize(int pageSize)
                    throws BaseException
Sets the current maximum number of elements per page. As the page size changes, the current page of data is reloaded. All pages, but maybe the last one, will have this number of elements.

Parameters:
pageSize - the maximum number of values per page
Throws:
BaseException - if there is an error reloading the current page

getCurrentPage

long getCurrentPage()
Returns the number of the currently loaded page of data (zero based).

Returns:
the current page number

setCurrentPage

void setCurrentPage(long page)
                    throws BaseException
Sets the current page number (zero based), and loads the elements for that page.

Parameters:
page - the page to load
Throws:
BaseException - if there is an error setting the current page

getInitialIndex

long getInitialIndex()
Returns the index of the initial element of the current page into all the elements.

Returns:
the index of the initial element

getNumPages

long getNumPages()
Returns the number of pages available, calculated with the total number of elements and the maximum number of elements per page.

Returns:
the number of pages available

getTotalSize

long getTotalSize()
Returns the number of elements of the entire set of data.

Returns:
the number of elements

getCurrentPageSize

int getCurrentPageSize()
Returns the number of elements of the current page. All the pages, but maybe the last one, will have the maximum number of elements per page.

Returns:
the current page size


Copyright © 2004-2011 gvSIG. All Rights Reserved.