Class PagerBeanUtil
java.lang.Object
org.nuiton.topia.persistence.util.PagerBeanUtil
Useful method around
PagerBean.
Copied from nuiton-utils-3.0, removed since then.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidGiven a pagerBean, compute hisPagerBean.recordStartIndex,PagerBean.recordEndIndexandPagerBean.pagesNumber.static <E> List<E>Get the elements of the lists using the pager datas:elements:all elements of the pagerpageSize: number of elements in a pagepage: the requested page number starting at1getPageBound(long totalCount, int page, int pageSize) Compute the pager bound given his datas:totalCount: count of all elements of the pagerpageSize: number of elements in a pagepage: the requested page number starting at1static longgetTotalPage(long totalCount, int pageSize) Given a total count of elements and a page size, compute the number of pages available.static PagerBean
-
Constructor Details
-
PagerBeanUtil
public PagerBeanUtil()
-
-
Method Details
-
getTotalPage
public static long getTotalPage(long totalCount, int pageSize) Given a total count of elements and a page size, compute the number of pages available.- Parameters:
totalCount- total count of elements in the pagerpageSize- size of a page- Returns:
- the number of available pages
-
getPageBound
public static org.apache.commons.lang3.tuple.Pair<Long,Long> getPageBound(long totalCount, int page, int pageSize) Compute the pager bound given his datas:totalCount: count of all elements of the pagerpageSize: number of elements in a pagepage: the requested page number starting at1
- Parameters:
totalCount- total count of elements in the pagerpage- pager page number (starting at1)pageSize- number of elements in a page- Returns:
- the bound of start and end index of the requested elements of the pager
-
getPage
Get the elements of the lists using the pager datas:elements:all elements of the pagerpageSize: number of elements in a pagepage: the requested page number starting at1
- Type Parameters:
E- n'importe quel type- Parameters:
elements- all pager elementspage- pager page number (starting at1)pageSize- number of elements in a page- Returns:
- la liste une fois filtrée
-
computeRecordIndexesAndPagesNumber
Given a pagerBean, compute hisPagerBean.recordStartIndex,PagerBean.recordEndIndexandPagerBean.pagesNumber.- Parameters:
bean- the pagerBean to fill- Since:
- 2.4.3
-
newPagerBean
-