Class PaginationHelper
java.lang.Object
org.eclipse.nebula.widgets.pagination.PaginationHelper
public class PaginationHelper
extends java.lang.Object
Pagination Utilities.
-
Field Summary
Fields Modifier and Type Field Description static int
SEPARATOR
-
Constructor Summary
Constructors Constructor Description PaginationHelper()
-
Method Summary
Modifier and Type Method Description static PageableController
getController(org.eclipse.swt.widgets.Widget widget)
Returns the attachedPageableController
to the given widget.static int[]
getPageIndexes(int currentPageIndex, int totalPages, int nbMax)
Returns an array of int with the page indexes for the given currentPageIndex, totalPages abd nbMax.static java.lang.String
getPageText(int pageIndex, int totalPage, java.util.Locale locale)
urns the page text (ex : Page 1/2).static java.lang.String
getResultsText(int start, int end, long total, PageableController controller, java.lang.String resultsMessage)
Returns the results text (ex: "Results 1-5 of 10") for the given pagination information start, end and total.static java.lang.String
getResultsText(PageableController controller, java.lang.String resultsMessage)
Returns the results text (ex: "Results 1-5 of 10") for the given pagination controller.static java.lang.String
getResultsText(PageableController controller, java.util.Locale locale)
Returns the results text (ex: "Results 1-5 of 10") for the given pagination controller.static void
setController(org.eclipse.swt.widgets.Widget widget, PageableController controller)
Attach the givenPageableController
to the given widget.
-
Field Details
-
SEPARATOR
public static final int SEPARATOR- See Also:
- Constant Field Values
-
-
Constructor Details
-
PaginationHelper
public PaginationHelper()
-
-
Method Details
-
getPageIndexes
public static int[] getPageIndexes(int currentPageIndex, int totalPages, int nbMax)Returns an array of int with the page indexes for the given currentPageIndex, totalPages abd nbMax.- Parameters:
currentPageIndex
-totalPages
-nbMax
-- Returns:
-
getController
Returns the attachedPageableController
to the given widget.- Parameters:
widget
-- Returns:
-
setController
public static void setController(org.eclipse.swt.widgets.Widget widget, PageableController controller)Attach the givenPageableController
to the given widget.- Parameters:
widget
-controller
-
-
getResultsText
public static java.lang.String getResultsText(PageableController controller, java.util.Locale locale)Returns the results text (ex: "Results 1-5 of 10") for the given pagination controller. The given locale is used to translate the results text.- Parameters:
controller
- the pagination controller.locale
- the locale.- Returns:
-
getResultsText
public static java.lang.String getResultsText(PageableController controller, java.lang.String resultsMessage)Returns the results text (ex: "Results 1-5 of 10") for the given pagination controller. The resultsMessage (ex: "Results {0}-{1} of {2}") is used to compute the text.- Parameters:
controller
- the pagination controller.resultsMessage
- the results message.- Returns:
-
getResultsText
public static java.lang.String getResultsText(int start, int end, long total, PageableController controller, java.lang.String resultsMessage)Returns the results text (ex: "Results 1-5 of 10") for the given pagination information start, end and total. The resultsMessage (ex: "Results {0}-{1} of {2}") is used to compute the text.- Parameters:
start
- first page offset.end
- last page offsettotal
- total elements.controller
-resultsMessage
-- Returns:
-
getPageText
public static java.lang.String getPageText(int pageIndex, int totalPage, java.util.Locale locale)urns the page text (ex : Page 1/2).- Parameters:
pageIndex
- the page index.totalPage
- the total page.locale
- the locale.- Returns:
-