public class Paginator extends Object
| Constructor and Description |
|---|
Paginator() |
| Modifier and Type | Method and Description |
|---|---|
int |
calculateTotalPageNumber(int items)
Calculates the total number of pages and returns the value
|
String |
changePage(int pageNumber,
String pageToGo)
Changes the current page and refresh the page
|
String |
changePageSize(int pageSize,
int items,
String pageToGo)
Changes the page size and refresh the page
|
int |
getCurrentPageNumber()
Returns the current page number
|
int |
getPageSize()
Returns the pageSize
|
int |
getTotalPageNumber()
Returns the total number of pages
|
List<Integer> |
getTotalPageNumberList()
Returns a list of integers based on the current page and the total number of pages
It calculates the number of pages that can be displayed in the pagination bar
|
void |
init() |
boolean |
isCurrentPage(int pageNumber)
Returns true if the current page matches the value passed
|
boolean |
isFirstPage()
Returns true if the current page is 1
|
boolean |
isLastPage()
Returns true if the current page is the last one
|
String |
nextPage(String pageToGo)
Changes the current page to the next one
|
String |
previousPage(String pageToGo)
Changes the page to the previous one
|
void |
setCurrentPageNumber(int currentPageNumber)
Modifies the current page number
|
void |
setPageSize(int pageSize)
Modifies the pageSize
|
void |
setTotalPageNumber(int totalPageNumber)
Modifies the total number of pages
|
public int getPageSize()
public void setPageSize(int pageSize)
pageSize - public int getCurrentPageNumber()
public void setCurrentPageNumber(int currentPageNumber)
currentPageNumber - public int getTotalPageNumber()
public void setTotalPageNumber(int totalPageNumber)
totalPageNumber - public void init()
public int calculateTotalPageNumber(int items)
public List<Integer> getTotalPageNumberList()
public String changePage(int pageNumber, String pageToGo)
pageNumber - pageToGo - public String changePageSize(int pageSize, int items, String pageToGo)
pageSize - items - public boolean isFirstPage()
public boolean isLastPage()
public boolean isCurrentPage(int pageNumber)
pageNumber - Copyright © 2020. All rights reserved.