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
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.
|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
rangeChangeHandler, rowCountChangeHandler
DEBUG_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, setRangeLimited
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
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
public 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()
AbstractPager
firstPage
in class AbstractPager
public int getPage()
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.
getPage
in class AbstractPager
AbstractPager.setPage(int)
public int getPageCount()
AbstractPager
getPageCount
in class AbstractPager
public boolean hasNextPage()
AbstractPager
AbstractPager.nextPage()
will succeed in moving the starting point of the table
forward.hasNextPage
in class AbstractPager
public boolean hasNextPages(int pages)
AbstractPager
hasNextPages
in class AbstractPager
pages
- the number of pages to querypages
next pagespublic boolean hasPage(int index)
AbstractPager
hasPage
in class AbstractPager
index
- the page indexpublic boolean hasPreviousPage()
AbstractPager
AbstractPager.previousPage()
will succeed in moving the starting point of the
table backward.hasPreviousPage
in class AbstractPager
public boolean hasPreviousPages(int pages)
AbstractPager
hasPreviousPages
in class AbstractPager
pages
- the number of previous pages to querypages
previous pagespublic void lastPage()
AbstractPager
lastPage
in class AbstractPager
public void lastPageStart()
AbstractPager
lastPageStart
in class AbstractPager
public void nextPage()
AbstractPager
nextPage
in class AbstractPager
public void previousPage()
AbstractPager
previousPage
in class AbstractPager
public void setDisplay(HasRows display)
AbstractPager
HasRows
to be paged.setDisplay
in class AbstractPager
display
- the HasRows
AbstractPager.getDisplay()
public void setPage(int index)
AbstractPager
setPage
in class AbstractPager
index
- the page indexAbstractPager.getPage()
public void setPageSize(int pageSize)
AbstractPager
setPageSize
in class AbstractPager
pageSize
- the new page sizeAbstractPager.getPageSize()
public void setPageStart(int index)
AbstractPager
setPageStart
in class AbstractPager
index
- the indexAbstractPager.getPageStart()
public void startLoading()
protected java.lang.String createText()
protected void onRangeOrRowCountChanged()
AbstractPager
onRangeOrRowCountChanged
in class AbstractPager
boolean isNextButtonDisabled()
boolean isPreviousButtonDisabled()