SimplePager (GWT Javadoc)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.user.cellview.client
Class SimplePager

    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

All Implemented Interfaces:
  HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsRenderable, IsWidget

    public class SimplePager

extends AbstractPager

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

### Example

>     public class SimplePagerExample implements EntryPoint {

>       public void onModuleLoad() {
>         // Create a CellList.
>         CellList<String> cellList = new CellList<String>(new TextCell());

>         // Add a cellList to a data provider.
>         ListDataProvider<String> dataProvider = new ListDataProvider<String>();
>         List<String> data = dataProvider.getList();
>         for (int i = 0; i < 200; i++) {
>           data.add("Item " + i);
>         }
>         dataProvider.addDataDisplay(cellList);

>         // Create a SimplePager.
>         SimplePager pager = new SimplePager();

>         // Set the cellList as the display.
>         pager.setDisplay(cellList);

>         // Add the pager and list to the page.
>         VerticalPanel vPanel = new VerticalPanel();
>         vPanel.add(pager);
>         vPanel.add(cellList);
>         RootPanel.get().add(vPanel);
>       }
>     }

Nested Class Summary
`static interface` | `SimplePager.ImageButtonsConstants` Constant for labeling the simple pager navigational `ImageButton`s
`static interface` | `SimplePager.Resources` A ClientBundle that provides images for this widget.
`static interface` | `SimplePager.Style` Styles used by this widget.
`static class` | `SimplePager.TextLocation` The location of the text relative to the paging buttons.

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.cellview.client.AbstractPager
`rangeChangeHandler, rowCountChangeHandler`

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`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, boolean showFastForwardButton, boolean showLastPageButton)` Construct a `SimplePager` with the default resources, fast forward rows and default image button names.
`SimplePager(SimplePager.TextLocation location, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton)` Construct a `SimplePager` with the default resources and default image button names.
`SimplePager(SimplePager.TextLocation location, SimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton)` Construct a `SimplePager` with the specified resources and default image button names.
`SimplePager(SimplePager.TextLocation location, SimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton, boolean showFirstPageButton, SimplePager.ImageButtonsConstants imageButtonConstants)` Construct a `SimplePager` with the specified resources.
`SimplePager(SimplePager.TextLocation location, SimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton, SimplePager.ImageButtonsConstants imageButtonConstants)` Construct a `SimplePager` with the specified resources.

Method Summary
`protected java.lang.String` | `createText()` Get the text to display in the pager that reflects the state of the pager.
`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 `AbstractPager.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 `AbstractPager.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.
`(package private) boolean` | `isNextButtonDisabled()` Check if the next button is disabled.
`(package private) boolean` | `isPreviousButtonDisabled()` Check if the previous button is disabled.
`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.
`protected void` | `onRangeOrRowCountChanged()` Called when the range or row count changes.
`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.

Methods inherited from class com.google.gwt.user.cellview.client.AbstractPager
`getDisplay, getPageSize, getPageStart, isRangeLimited, setRangeLimited`

Methods inherited from class com.google.gwt.user.client.ui.Composite
`claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SimplePager

    public SimplePager()

  Construct a `SimplePager` with the default text location.

### SimplePager

    @UiConstructor
    public SimplePager(SimplePager.TextLocation location)

  Construct a `SimplePager` with the specified text location.

  Parameters:
    `location` - the location of the text relative to the buttons

### SimplePager

    public SimplePager(SimplePager.TextLocation location,
                       boolean showFastForwardButton,
                       boolean showLastPageButton)

  Construct a `SimplePager` with the default resources, fast forward rows and default image button names.

  Parameters:
    `location` - the location of the text relative to the buttons
    `showFastForwardButton` - if true, show a fast-forward button that advances by a larger increment than a single page
    `showLastPageButton` - if true, show a button to go to the last page

### SimplePager

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

  Construct a `SimplePager` with the default resources and default image button names.

  Parameters:
    `location` - the location of the text relative to the buttons
    `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 to the last page

### SimplePager

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

  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 to the last page
    `imageButtonConstants` - Constants that contain the image button names

### SimplePager

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

  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 to the last page
    `showFirstPageButton` - if true, show a button to go to the first page
    `imageButtonConstants` - Constants that contain the image button names

### SimplePager

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

  Construct a `SimplePager` with the specified resources and default image button names.

  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 to the last page

Method Detail

### firstPage

    public void firstPage()

  Description copied from class: `AbstractPager`
  Go to the first page.

  Overrides:
    `firstPage` in class `AbstractPager`

### getPage

    public int getPage()

  Description copied from class: `AbstractPager`

  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 `AbstractPager.previousPage()` can be called.

  Overrides:
    `getPage` in class `AbstractPager`
  Returns:
    the page index, or -1 if the display is not set
  See Also:
    `AbstractPager.setPage(int)`

### getPageCount

    public int getPageCount()

  Description copied from class: `AbstractPager`
  Get the number of pages based on the data size.

  Overrides:
    `getPageCount` in class `AbstractPager`
  Returns:
    the page count, or -1 if the display is not set

### hasNextPage

    public boolean hasNextPage()

  Description copied from class: `AbstractPager`
  Returns true if there is enough data such that a call to `AbstractPager.nextPage()` will succeed in moving the starting point of the table forward.

  Overrides:
    `hasNextPage` in class `AbstractPager`
  Returns:
    true if there is a next page

### hasNextPages

    public boolean hasNextPages(int pages)

  Description copied from class: `AbstractPager`
  Returns true if there is enough data to display a given number of additional pages.

  Overrides:
    `hasNextPages` in class `AbstractPager`
  Parameters:
    `pages` - the number of pages to query
  Returns:
    true if there are `pages` next pages

### hasPage

    public boolean hasPage(int index)

  Description copied from class: `AbstractPager`
  Returns true if there is enough data such that the specified page is within range.

  Overrides:
    `hasPage` in class `AbstractPager`
  Parameters:
    `index` - the page index
  Returns:
    true if the specified page is in range

### hasPreviousPage

    public boolean hasPreviousPage()

  Description copied from class: `AbstractPager`
  Returns true if there is enough data such that a call to `AbstractPager.previousPage()` will succeed in moving the starting point of the table backward.

  Overrides:
    `hasPreviousPage` in class `AbstractPager`
  Returns:
    true if there is a previous page

### hasPreviousPages

    public boolean hasPreviousPages(int pages)

  Description copied from class: `AbstractPager`
  Returns true if there is enough data to display a given number of previous pages.

  Overrides:
    `hasPreviousPages` in class `AbstractPager`
  Parameters:
    `pages` - the number of previous pages to query
  Returns:
    true if there are `pages` previous pages

### lastPage

    public void lastPage()

  Description copied from class: `AbstractPager`
  Go to the last page.

  Overrides:
    `lastPage` in class `AbstractPager`

### lastPageStart

    public void lastPageStart()

  Description copied from class: `AbstractPager`
  Set the page start to the last index that will still show a full page.

  Overrides:
    `lastPageStart` in class `AbstractPager`

### nextPage

    public void nextPage()

  Description copied from class: `AbstractPager`
  Advance the starting row by 'pageSize' rows.

  Overrides:
    `nextPage` in class `AbstractPager`

### previousPage

    public void previousPage()

  Description copied from class: `AbstractPager`
  Move the starting row back by 'pageSize' rows.

  Overrides:
    `previousPage` in class `AbstractPager`

### setDisplay

    public void setDisplay(HasRows display)

  Description copied from class: `AbstractPager`
  Set the `HasRows` to be paged.

  Overrides:
    `setDisplay` in class `AbstractPager`
  Parameters:
    `display` - the `HasRows`
  See Also:
    `AbstractPager.getDisplay()`

### setPage

    public void setPage(int index)

  Description copied from class: `AbstractPager`
  Go to a specific page.

  Overrides:
    `setPage` in class `AbstractPager`
  Parameters:
    `index` - the page index
  See Also:
    `AbstractPager.getPage()`

### setPageSize

    public void setPageSize(int pageSize)

  Description copied from class: `AbstractPager`
  Set the page size of the display.

  Overrides:
    `setPageSize` in class `AbstractPager`
  Parameters:
    `pageSize` - the new page size
  See Also:
    `AbstractPager.getPageSize()`

### setPageStart

    public void setPageStart(int index)

  Description copied from class: `AbstractPager`
  Set the page start index.

  Overrides:
    `setPageStart` in class `AbstractPager`
  Parameters:
    `index` - the index
  See Also:
    `AbstractPager.getPageStart()`

### startLoading

    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.

### createText

    protected java.lang.String createText()

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

  Returns:
    the text

### onRangeOrRowCountChanged

    protected void onRangeOrRowCountChanged()

  Description copied from class: `AbstractPager`
  Called when the range or row count changes. Implement this method to update the pager.

  Specified by:
    `onRangeOrRowCountChanged` in class `AbstractPager`

### isNextButtonDisabled

    boolean isNextButtonDisabled()

  Check if the next button is disabled. Visible for testing.

### isPreviousButtonDisabled

    boolean isPreviousButtonDisabled()

  Check if the previous button is disabled. Visible for testing.

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD