Class 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
- All Implemented Interfaces:
HasAttachHandlers
,HasHandlers
,EventListener
,HasVisibility
,IsRenderable
,IsWidget
- Direct Known Subclasses:
PageSizePager
,SimplePager
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
Modifier and TypeFieldDescription(package private) HandlerRegistration
(package private) HandlerRegistration
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Go to the first page.Get theHasRows
being paged.protected int
getPage()
Get the current page index.protected int
Get the number of pages based on the data size.int
Get the page size.int
Get the page start index.protected boolean
Returns true if there is enough data such that a call tonextPage()
will succeed in moving the starting point of the table forward.protected boolean
hasNextPages
(int pages) Returns true if there is enough data to display a given number of additional pages.protected boolean
hasPage
(int index) Returns true if there is enough data such that the specified page is within range.protected boolean
Returns true if there is enough data such that a call topreviousPage()
will succeed in moving the starting point of the table backward.protected boolean
hasPreviousPages
(int pages) Returns true if there is enough data to display a given number of previous pages.boolean
Check if the page should be limited to the actual data size.protected void
lastPage()
Go to the last page.protected void
Set the page start to the last index that will still show a full page.protected void
nextPage()
Advance the starting row by 'pageSize' rows.protected abstract void
Called when the range or row count changes.protected void
Move the starting row back by 'pageSize' rows.void
setDisplay
(HasRows display) Set theHasRows
to be paged.protected void
setPage
(int index) Go to a specific page.protected void
setPageSize
(int pageSize) Set the page size of the display.protected 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
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
-
Field Details
-
rangeChangeHandler
HandlerRegistration rangeChangeHandler -
rowCountChangeHandler
HandlerRegistration rowCountChangeHandler
-
-
Constructor Details
-
AbstractPager
public AbstractPager()
-
-
Method Details
-
getDisplay
Get theHasRows
being paged.- Returns:
- the
HasRows
- See Also:
-
getPageSize
public int getPageSize()Get the page size.- Returns:
- the page size, or -1 if the display is not set
- See Also:
-
getPageStart
public int getPageStart()Get the page start index.- Returns:
- the page start index, or -1 if the display is not set
- See Also:
-
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
- See Also:
-
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
- true to limit the range, false not to- See Also:
-
setDisplay
Set theHasRows
to be paged.- Parameters:
display
- theHasRows
- See Also:
-
firstPage
protected void firstPage()Go to the first page. -
getPage
protected 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
- See Also:
-
getPageCount
protected int getPageCount()Get the number of pages based on the data size.- Returns:
- the page count, or -1 if the display is not set
-
hasNextPage
protected boolean hasNextPage()Returns true if there is enough data such that a call tonextPage()
will succeed in moving the starting point of the table forward.- Returns:
- true if there is a next page
-
hasNextPages
protected 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
-
hasPage
protected 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
-
hasPreviousPage
protected boolean hasPreviousPage()Returns true if there is enough data such that a call topreviousPage()
will succeed in moving the starting point of the table backward.- Returns:
- true if there is a previous page
-
hasPreviousPages
protected 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
-
lastPage
protected void lastPage()Go to the last page. -
lastPageStart
protected void lastPageStart()Set the page start to the last index that will still show a full page. -
nextPage
protected void nextPage()Advance the starting row by 'pageSize' rows. -
onRangeOrRowCountChanged
protected abstract void onRangeOrRowCountChanged()Called when the range or row count changes. Implement this method to update the pager. -
previousPage
protected void previousPage()Move the starting row back by 'pageSize' rows. -
setPage
protected void setPage(int index) Go to a specific page.- Parameters:
index
- the page index- See Also:
-
setPageSize
protected void setPageSize(int pageSize) Set the page size of the display.- Parameters:
pageSize
- the new page size- See Also:
-
setPageStart
protected void setPageStart(int index) Set the page start index.- Parameters:
index
- the index- See Also:
-