public class PaginationHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
SEPARATOR |
Constructor and Description |
---|
PaginationHelper() |
Modifier and Type | Method and Description |
---|---|
static PageableController |
getController(org.eclipse.swt.widgets.Widget widget)
Returns the attached
PageableController 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.util.Locale locale)
Returns the results text (ex: "Results 1-5 of 10") for the given
pagination controller.
|
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 void |
setController(org.eclipse.swt.widgets.Widget widget,
PageableController controller)
Attach the given
PageableController to the given widget. |
public static final int SEPARATOR
public static int[] getPageIndexes(int currentPageIndex, int totalPages, int nbMax)
currentPageIndex
- totalPages
- nbMax
- public static PageableController getController(org.eclipse.swt.widgets.Widget widget)
PageableController
to the given widget.widget
- public static void setController(org.eclipse.swt.widgets.Widget widget, PageableController controller)
PageableController
to the given widget.widget
- controller
- public static java.lang.String getResultsText(PageableController controller, java.util.Locale locale)
controller
- the pagination controller.locale
- the locale.public static java.lang.String getResultsText(PageableController controller, java.lang.String resultsMessage)
controller
- the pagination controller.resultsMessage
- the results message.public static java.lang.String getResultsText(int start, int end, long total, PageableController controller, java.lang.String resultsMessage)
start
- first page offset.end
- last page offsettotal
- total elements.controller
- resultsMessage
- public static java.lang.String getPageText(int pageIndex, int totalPage, java.util.Locale locale)
pageIndex
- the page index.totalPage
- the total page.locale
- the locale.