public class SimplePager extends AbstractPager
HasRows that only supports simple page
navigation.
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);
}
}
| Modifier and Type | Class and Description |
|---|---|
static interface |
SimplePager.ImageButtonsConstants
Constant for labeling the simple pager navigational
ImageButtons |
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.
|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledrangeChangeHandler, rowCountChangeHandlerDEBUG_ID_PREFIX| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
getDisplay, getPageSize, getPageStart, isRangeLimited, setRangeLimitedclaimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, 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, toStringpublic SimplePager()
SimplePager with the default text location.@UiConstructor public SimplePager(SimplePager.TextLocation location)
SimplePager with the specified text location.location - the location of the text relative to the buttonspublic SimplePager(SimplePager.TextLocation location, boolean showFastForwardButton, boolean showLastPageButton)
SimplePager with the default resources, fast forward rows and
default image button names.location - the location of the text relative to the buttonsshowFastForwardButton - if true, show a fast-forward button that
advances by a larger increment than a single pageshowLastPageButton - if true, show a button to go to the last pagepublic SimplePager(SimplePager.TextLocation location, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton)
SimplePager with the default resources and default image button names.location - the location of the text relative to the buttonsshowFastForwardButton - if true, show a fast-forward button that
advances by a larger increment than a single pagefastForwardRows - the number of rows to jump when fast forwardingshowLastPageButton - if true, show a button to go to the last pagepublic SimplePager(SimplePager.TextLocation location, SimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton, SimplePager.ImageButtonsConstants imageButtonConstants)
SimplePager with the specified resources.location - the location of the text relative to the buttonsresources - the SimplePager.Resources to useshowFastForwardButton - if true, show a fast-forward button that
advances by a larger increment than a single pagefastForwardRows - the number of rows to jump when fast forwardingshowLastPageButton - if true, show a button to go to the last pageimageButtonConstants - Constants that contain the image button namespublic SimplePager(SimplePager.TextLocation location, SimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton, boolean showFirstPageButton, SimplePager.ImageButtonsConstants imageButtonConstants)
SimplePager with the specified resources.location - the location of the text relative to the buttonsresources - the SimplePager.Resources to useshowFastForwardButton - if true, show a fast-forward button that
advances by a larger increment than a single pagefastForwardRows - the number of rows to jump when fast forwardingshowLastPageButton - if true, show a button to go to the last pageshowFirstPageButton - if true, show a button to go to the first pageimageButtonConstants - Constants that contain the image button namespublic SimplePager(SimplePager.TextLocation location, SimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton)
SimplePager with the specified resources and default image button names.location - the location of the text relative to the buttonsresources - the SimplePager.Resources to useshowFastForwardButton - if true, show a fast-forward button that
advances by a larger increment than a single pagefastForwardRows - the number of rows to jump when fast forwardingshowLastPageButton - if true, show a button to go to the last pagepublic void firstPage()
AbstractPagerfirstPage in class AbstractPagerpublic int getPage()
AbstractPagerGet 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.
getPage in class AbstractPagerAbstractPager.setPage(int)public int getPageCount()
AbstractPagergetPageCount in class AbstractPagerpublic boolean hasNextPage()
AbstractPagerAbstractPager.nextPage() will succeed in moving the starting point of the table
forward.hasNextPage in class AbstractPagerpublic boolean hasNextPages(int pages)
AbstractPagerhasNextPages in class AbstractPagerpages - the number of pages to querypages next pagespublic boolean hasPage(int index)
AbstractPagerhasPage in class AbstractPagerindex - the page indexpublic boolean hasPreviousPage()
AbstractPagerAbstractPager.previousPage() will succeed in moving the starting point of the
table backward.hasPreviousPage in class AbstractPagerpublic boolean hasPreviousPages(int pages)
AbstractPagerhasPreviousPages in class AbstractPagerpages - the number of previous pages to querypages previous pagespublic void lastPage()
AbstractPagerlastPage in class AbstractPagerpublic void lastPageStart()
AbstractPagerlastPageStart in class AbstractPagerpublic void nextPage()
AbstractPagernextPage in class AbstractPagerpublic void previousPage()
AbstractPagerpreviousPage in class AbstractPagerpublic void setDisplay(HasRows display)
AbstractPagerHasRows to be paged.setDisplay in class AbstractPagerdisplay - the HasRowsAbstractPager.getDisplay()public void setPage(int index)
AbstractPagersetPage in class AbstractPagerindex - the page indexAbstractPager.getPage()public void setPageSize(int pageSize)
AbstractPagersetPageSize in class AbstractPagerpageSize - the new page sizeAbstractPager.getPageSize()public void setPageStart(int index)
AbstractPagersetPageStart in class AbstractPagerindex - the indexAbstractPager.getPageStart()public void startLoading()
protected java.lang.String createText()
protected void onRangeOrRowCountChanged()
AbstractPageronRangeOrRowCountChanged in class AbstractPagerboolean isNextButtonDisabled()
boolean isPreviousButtonDisabled()