Class Paging
java.lang.Object
io.jenkins.plugins.batchcontrol.ui.Paging
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public final class Paging
extends Object
Paging arithmetic shared by every list screen (D-44). Each section keeps its own
Jelly-facing names (
getPage, getPageItems, getTotal,
isHasPrevious, isHasNext) and delegates the arithmetic here, so the screens
cannot drift apart again.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRows per page on every Batch Control list screen (SPEC: 50 by default). -
Method Summary
Modifier and TypeMethodDescriptionstatic intThe 1-based page from thepagequery parameter; 1 on absence or garbage.static intcurrentPage(String parameter) The 1-based page from the named query parameter; 1 on absence, garbage or a value below 1.static booleanhasNext(int page, int total) Whether an older page exists for a list oftotalrows.static booleanhasPrevious(int page) Whether a newer page exists (every page after the first).static intoffset(int page) The zero-based offset of the first row ofpage; saturates instead of overflowing.static String#45: the query string (without the leading?) of a pager link topageof the list paged withparameter: every other parameter of the current URL's query string, in its order (the other lists'pendingPage,activePage,endedPage), thenparameter=page.static <T> List<T> The rows ofpageout of a fully materialised, already sorted list (a copy).
-
Field Details
-
PAGE_SIZE
public static final int PAGE_SIZERows per page on every Batch Control list screen (SPEC: 50 by default).- See Also:
-
-
Method Details
-
currentPage
public static int currentPage()The 1-based page from thepagequery parameter; 1 on absence or garbage. -
currentPage
The 1-based page from the named query parameter; 1 on absence, garbage or a value below 1.- Parameters:
parameter- the query parameter name (a screen with two tables uses two names)
-
offset
public static int offset(int page) The zero-based offset of the first row ofpage; saturates instead of overflowing. -
slice
The rows ofpageout of a fully materialised, already sorted list (a copy). -
query
#45: the query string (without the leading?) of a pager link topageof the list paged withparameter: every other parameter of the current URL's query string, in its order (the other lists'pendingPage,activePage,endedPage), thenparameter=page. Only the query string is read, never a form body, and each name and value is decoded and URL-encoded again, so a hostile value travels as data; the view escapes the result as an attribute value too. A pair that does not decode is dropped.- Parameters:
parameter- the query parameter of the paged listpage- the 1-based page the link opens
-
hasPrevious
public static boolean hasPrevious(int page) Whether a newer page exists (every page after the first). -
hasNext
public static boolean hasNext(int page, int total) Whether an older page exists for a list oftotalrows.
-