com.google.gwt.user.cellview.client
Class AbstractPager<T>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.google.gwt.user.cellview.client.AbstractPager<T>
Type Parameters:
T - the type of the PagingListView being controlled
All Implemented Interfaces:
HasHandlers, EventListener, PagingListView.Pager<T>
Direct Known Subclasses:
SimplePager

public abstract class AbstractPager<T>
extends Composite
implements PagingListView.Pager<T>

An abstract pager that exposes many methods useful for paging.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
AbstractPager(PagingListView<T> view)
           
 
Method Summary
 void firstPage()
          Go to the first page.
 int getPage()
          Get the current page index.
 int getPageCount()
          Get the number of pages based on the data size.
 int getPageSize()
          Get the page size.
 int getPageStart()
          Get the page start index.
 PagingListView<T> getPagingListView()
          Get the PagingListView being paged.
 boolean hasNextPage()
          Returns true if there is enough data such that a call to nextPage() will succeed in moving the starting point of the table forward.
 boolean hasNextPages(int pages)
          Returns true if there is enough data to display a given number of additional pages.
 boolean hasPage(int index)
          Returns true if there is enough data such that the specified page is within range.
 boolean hasPreviousPage()
          Returns true if there is enough data such that a call to previousPage() will succeed in moving the starting point of the table backward.
 boolean hasPreviousPages(int pages)
          Returns true if there is enough data to display a given number of previous pages.
 boolean isRangeLimited()
          Check if the page should be limited to the actual data size.
 void lastPage()
          Go to the last page.
 void lastPageStart()
          Set the page start to the last index that will still show a full page.
 void nextPage()
          Advance the starting row by 'pageSize' rows.
 void onRangeOrSizeChanged(PagingListView<T> listView)
           
 void previousPage()
          Move the starting row back by 'pageSize' rows.
 void setPage(int index)
          Go to a specific page.
 void setPageSize(int pageSize)
          Set the page size of the view.
 void setPageStart(int index)
          Set the page start index.
 void setRangeLimited(boolean isRangeLimited)
          Set whether or not the page range should be limited to the actual data size.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
isAttached, onBrowserEvent
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
fireEvent, getLayoutData, getParent, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPager

public AbstractPager(PagingListView<T> view)
Method Detail

firstPage

public void firstPage()
Go to the first page.


getPage

public int getPage()
Get the current page index. Since the page start index can be set to any value, its possible to be between pages. In this case, the return value is the number of times previousPage() can be called.

Returns:
the page index

getPageCount

public int getPageCount()
Get the number of pages based on the data size.

Returns:
the page count

getPageSize

public int getPageSize()
Get the page size.

Returns:
the page size

getPageStart

public int getPageStart()
Get the page start index.

Returns:
the page start index

getPagingListView

public PagingListView<T> getPagingListView()
Get the PagingListView being paged.

Returns:
the PagingListView

hasNextPage

public boolean hasNextPage()
Returns true if there is enough data such that a call to nextPage() will succeed in moving the starting point of the table forward.


hasNextPages

public boolean hasNextPages(int pages)
Returns true if there is enough data to display a given number of additional pages.


hasPage

public boolean hasPage(int index)
Returns true if there is enough data such that the specified page is within range.


hasPreviousPage

public boolean hasPreviousPage()
Returns true if there is enough data such that a call to previousPage() will succeed in moving the starting point of the table backward.


hasPreviousPages

public boolean hasPreviousPages(int pages)
Returns true if there is enough data to display a given number of previous pages.


isRangeLimited

public boolean isRangeLimited()
Check if the page should be limited to the actual data size. Defaults to true.

Returns:
true if the range is limited to the data size

lastPage

public void lastPage()
Go to the last page.


lastPageStart

public void lastPageStart()
Set the page start to the last index that will still show a full page.


nextPage

public void nextPage()
Advance the starting row by 'pageSize' rows.


onRangeOrSizeChanged

public void onRangeOrSizeChanged(PagingListView<T> listView)
Specified by:
onRangeOrSizeChanged in interface PagingListView.Pager<T>

previousPage

public void previousPage()
Move the starting row back by 'pageSize' rows.


setPage

public void setPage(int index)
Go to a specific page.

Parameters:
index - the page index

setPageSize

public void setPageSize(int pageSize)
Set the page size of the view.

Parameters:
pageSize - the new page size

setPageStart

public void setPageStart(int index)
Set the page start index.

Parameters:
index - the index

setRangeLimited

public void setRangeLimited(boolean isRangeLimited)
Set whether or not the page range should be limited to the actual data size. If true, all operations will adjust so that there is always data visible on the page.

Parameters:
isRangeLimited -