Interface IPaging
- All Superinterfaces:
IAnyGroup<IPaging>,IComponent<IPaging>,IDisable<IPaging>,IHtmlBasedComponent<IPaging>,IMeshComposite<IPaging>,IXulElement<IPaging>
Paging component
A paging component is used with another component to separate long content into multiple pages. If a component has long content to display, you could separate them into pages, and then use a paging component as a controller to allow the user decide which page to display.
The listbox, grid and tree
components support the paging intrinsically, so you don't need
to specify a paging component explicitly. In other words, they will instantiate
and manage a paging component automatically if the paging mold
is specified. Of course, you could specify an external paging component,
if you want to have different visual layout, or to control multiple listboxes,
grids and/or trees with one single paging component.
Support @Action
| Name | Action Type |
|---|---|
| onPaging | ActionData: PagingData
Represents an action triggered by the user navigates a new page. |
Support Molds
| Name | Snapshot |
|---|---|
"default" |
![]() |
"os" |
![]() |
For example, suppose you have 100 items and prefer to show 20 items at a time, then you can use the paging components as follows.
@RichletMapping("")
public IComponent index() {
return IVlayout.of(IPaging.ofTotalSize(100));
}
- Author:
- jumperchen
- See Also:
-
Paging
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBuilds instances of typeIPaging.static classBuilds an updater of typeIPagingforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the active page (starting from 0).default intReturns the number of pages.default intReturns the number of page anchors shall appear at the client.default intReturns the number of items per page.default intReturns the total number of items.default StringReturns the client widget class.default booleanReturns whether to automatically hide the paging if there is only one page available.default booleanReturns whether to show the detailed info, such asgetTotalSize()static IPagingReturns the instance with the given id.static IPagingofTotalSize(int totalSize) Returns the instance with the given total size.withActivePage(int activePage) Returns a copy ofthisimmutable component with the specifiedactivePage.withAutohide(boolean autohide) Returns a copy ofthisimmutable component with the specifiedautohide.withDetailed(boolean detailed) Returns a copy ofthisimmutable component with the specifieddetailed.withPageCount(int pageCount) Returns a copy ofthisimmutable component with the specifiedpageCount.withPageIncrement(int pageIncrement) Returns a copy ofthisimmutable component with the specifiedpageIncrement.withPageSize(int pageSize) Returns a copy ofthisimmutable component with the specifiedpageSize.withTotalSize(int totalSize) Returns a copy ofthisimmutable component with the specifiedtotalSize.Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IDisable
isDisabled, withDisabledMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.mess.Paging"- Specified by:
getWidgetClassin interfaceIComponent<IPaging>
-
getPageSize
default int getPageSize()Returns the number of items per page.Default:
20. -
withPageSize
Returns a copy ofthisimmutable component with the specifiedpageSize.Sets the items to show in each page
- Parameters:
pageSize- The number of items per page. (positive only)Default:
20.- Returns:
- A modified copy of the
thisobject
-
getTotalSize
default int getTotalSize()Returns the total number of items.Default:
0 -
withTotalSize
Returns a copy ofthisimmutable component with the specifiedtotalSize.To specify the total size of the
pagingcomponent- Parameters:
totalSize- The total size of thepagingcomponent. (non-negative only)Default:
0- Returns:
- A modified copy of the
thisobject
-
getPageCount
default int getPageCount()Returns the number of pages.Note: there is at least one page even no item at all.
Default:
1 -
withPageCount
Returns a copy ofthisimmutable component with the specifiedpageCount.Sets the number of pages
Note: there is at least one page even no item at all.
- Parameters:
pageCount- The number of pages.Default:
1- Returns:
- A modified copy of the
thisobject
-
isDetailed
default boolean isDetailed()Returns whether to show the detailed info, such asgetTotalSize()Default:
false -
withDetailed
Returns a copy ofthisimmutable component with the specifieddetailed.Sets whether to show total size and index of items in current page
- Parameters:
detailed-trueif enables the detail information.Default:
false- Returns:
- A modified copy of the
thisobject
-
isAutohide
default boolean isAutohide()Returns whether to automatically hide the paging if there is only one page available.Default:
false -
withAutohide
Returns a copy ofthisimmutable component with the specifiedautohide.Sets whether to automatically hide the
pagingcomponent at client if there is only one page available.- Parameters:
autohide-trueif enables the auto-hide feature.Default:
false- Returns:
- A modified copy of the
thisobject
-
getActivePage
default int getActivePage()Returns the active page (starting from 0).Default:
0 -
withActivePage
Returns a copy ofthisimmutable component with the specifiedactivePage.Sets the active page (starting from 0)
Note: In server side, the active page starts from
0. But in browser UI, it starts from1for human to see.- Parameters:
activePage- The active page to display at client.Default:
0- Returns:
- A modified copy of the
thisobject
-
getPageIncrement
default int getPageIncrement()Returns the number of page anchors shall appear at the client.Default:
10. -
withPageIncrement
Returns a copy ofthisimmutable component with the specifiedpageIncrement.Sets the number of page list icon when the
moldis"os"- Parameters:
pageIncrement- The number of page list icon when themoldis"os"(Non-positive only)Default:
10.- Returns:
- A modified copy of the
thisobject
-
ofTotalSize
Returns the instance with the given total size.- Parameters:
totalSize- The total size of this paging component.
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-

