Package org.zkoss.pivot.impl.util
Class PagingInfo
java.lang.Object
org.zkoss.pivot.impl.util.PagingInfo
An abstraction that represents paging concept. Also offer utilities that assist
paging calculations.
- Author:
- simonpai
-
Constructor Summary
ConstructorsConstructorDescriptionPagingInfo(int dataSize) Construct a PagingInfo with start = 0 and no limit.PagingInfo(int start, int limit, int dataSize) Construct a PagingInfo with start index and limit. -
Method Summary
Modifier and TypeMethodDescriptionintReturn how many entries under the first node is cut off.intGet data size on this rank.intgetEnd()Get the end index of this page, exclusively.intgetLimit()Get page size.intReturn how many entries under the last node is cut off.intGet the end index of node, exclusively.intGet the number of nodes involved in current page, including those partially shown.intGet the start index of node rather then entries.intgetPagedSize(int size) Return row/column numbers cropped by paging.intgetRealCutoffEnd(int realNodeSize) Return how many entries under the last node is cut off.intgetStart()Get start index of current page.booleanReturn true if the paging has a limit
-
Constructor Details
-
PagingInfo
public PagingInfo(int dataSize) Construct a PagingInfo with start = 0 and no limit. This is equivalent to waiving the page concept. We introduce this generalization for a better tree traversal logic and a potential extension on column paging. -
PagingInfo
public PagingInfo(int start, int limit, int dataSize) Construct a PagingInfo with start index and limit.
-
-
Method Details
-
getDataSize
public int getDataSize()Get data size on this rank. -
getStart
public int getStart()Get start index of current page. -
getLimit
public int getLimit()Get page size. Negative value means no limit. -
getEnd
public int getEnd()Get the end index of this page, exclusively. For example, if start = 3, limit = 5, then last index in range is 7 and end = 8. -
isLimited
public boolean isLimited()Return true if the paging has a limit -
getNodeStart
public int getNodeStart()Get the start index of node rather then entries. They are mostly different as long as data size is greater than one. -
getNodeLimit
public int getNodeLimit()Get the number of nodes involved in current page, including those partially shown. Does not concern whether current page is the last page. -
getNodeEnd
public int getNodeEnd()Get the end index of node, exclusively. -
getCutoffStart
public int getCutoffStart()Return how many entries under the first node is cut off. -
getNaiveCutoffEnd
public int getNaiveCutoffEnd()Return how many entries under the last node is cut off. Does not concern whether current page is the last page. -
getRealCutoffEnd
public int getRealCutoffEnd(int realNodeSize) Return how many entries under the last node is cut off. If the current page is last page, the value will surely be 0.- Parameters:
realNodeSize- the real number of nodes involved in this page. As we do not know anything about the tree, we have to pass in this information to know the real cut-off value.
-
getPagedSize
public int getPagedSize(int size) Return row/column numbers cropped by paging.
-