public class

SimplePager

extends AbstractPager
java.lang.Object
   ↳ com.google.gwt.user.client.ui.UIObject
     ↳ com.google.gwt.user.client.ui.Widget
       ↳ com.google.gwt.user.client.ui.Composite
         ↳ com.google.gwt.user.cellview.client.AbstractPager
           ↳ com.google.gwt.user.cellview.client.SimplePager

Class Overview

A pager for controlling a HasRows that only supports simple page navigation.

Example

{@example com.google.gwt.examples.cellview.SimplePagerExample}

Summary

Nested Classes
interface SimplePager.Resources A ClientBundle that provides images for this widget. 
interface SimplePager.Style Styles used by this widget. 
enum SimplePager.TextLocation The location of the text relative to the paging buttons. 
[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
Public Constructors
SimplePager()
Construct a SimplePager with the default text location.
SimplePager(SimplePager.TextLocation location)
Construct a SimplePager with the specified text location.
SimplePager(SimplePager.TextLocation location, SimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton)
Construct a SimplePager with the specified resources.
Public Methods
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.
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.
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 previousPage()
Move the starting row back by 'pageSize' rows.
void setDisplay(HasRows display)
Set the HasRows to be paged.
void setPage(int index)
Go to a specific page.
void setPageSize(int pageSize)
Set the page size of the display.
void setPageStart(int index)
Set the page start index.
void startLoading()
Let the page know that the table is loading.
Protected Methods
String createText()
Get the text to display in the pager that reflects the state of the pager.
void onRangeOrRowCountChanged()
Called when the range or row count changes.
[Expand]
Inherited Methods
From class com.google.gwt.user.cellview.client.AbstractPager
From class com.google.gwt.user.client.ui.Composite
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.ui.IsWidget

Public Constructors

public SimplePager ()

Construct a SimplePager with the default text location.

public SimplePager (SimplePager.TextLocation location)

Construct a SimplePager with the specified text location.

Parameters
location the location of the text relative to the buttons

public SimplePager (SimplePager.TextLocation location, SimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton)

Construct a SimplePager with the specified resources.

Parameters
location the location of the text relative to the buttons
resources the SimplePager.Resources to use
showFastForwardButton if true, show a fast-forward button that advances by a larger increment than a single page
fastForwardRows the number of rows to jump when fast forwarding
showLastPageButton if true, show a button to go the the last page

Public Methods

public void firstPage ()

Go to the first page.

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, or -1 if the display is not set

public int getPageCount ()

Get the number of pages based on the data size.

Returns
  • the page count, or -1 if the display is not set

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.

Returns
  • true if there is a next page

public boolean hasNextPages (int pages)

Returns true if there is enough data to display a given number of additional pages.

Parameters
pages the number of pages to query
Returns
  • true if there are pages next pages

public boolean hasPage (int index)

Returns true if there is enough data such that the specified page is within range.

Parameters
index the page index
Returns
  • true if the specified page is in range

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.

Returns
  • true if there is a previous page

public boolean hasPreviousPages (int pages)

Returns true if there is enough data to display a given number of previous pages.

Parameters
pages the number of previous pages to query
Returns
  • true if there are pages previous pages

public void lastPage ()

Go to the last page.

public void lastPageStart ()

Set the page start to the last index that will still show a full page.

public void nextPage ()

Advance the starting row by 'pageSize' rows.

public void previousPage ()

Move the starting row back by 'pageSize' rows.

public void setDisplay (HasRows display)

Set the HasRows to be paged.

Parameters
display the HasRows

public void setPage (int index)

Go to a specific page.

Parameters
index the page index

public void setPageSize (int pageSize)

Set the page size of the display.

Parameters
pageSize the new page size

public void setPageStart (int index)

Set the page start index.

Parameters
index the index

public void startLoading ()

Let the page know that the table is loading. Call this method to clear all data from the table and hide the current range when new data is being loaded into the table.

Protected Methods

protected String createText ()

Get the text to display in the pager that reflects the state of the pager.

Returns
  • the text

protected void onRangeOrRowCountChanged ()

Called when the range or row count changes. Implement this method to update the pager.