@@ -17,25 +17,65 @@ public class GridPager<T> implements IGridPager<T> {
1717 public final static String DEFAULT_VIRTUALIZED_COUNT_QUERY_PARAMETER = "grid-virt-count" ;
1818 public final static String DEFAULT_NO_TOTALS_PARAMETER = "grid-no-totals" ;
1919
20+ private final CustomQueryStringBuilder queryBuilder ;
21+
22+
2023 @ Getter
2124 private final IGrid <T > grid ;
2225
23- private final CustomQueryStringBuilder queryBuilder ;
24-
2526 private int currentPage ;
2627
28+ public int getCurrentPage () {
29+
30+ if (this .currentPage >= 0 || this .grid .getPagingType () == PagingType .VIRTUALIZATION ) return this .currentPage ;
31+ var currentPageParameter = this .grid .getQuery ().get (this .parameterName );
32+ if (currentPageParameter != null && currentPageParameter .size () == 1 )
33+ this .currentPage = Integer .parseInt (currentPageParameter .get (0 ));
34+ else
35+ this .currentPage = 1 ;
36+
37+ if (this .currentPage > this .pageCount )
38+ this .currentPage = this .pageCount ;
39+ return this .currentPage ;
40+ }
41+
42+ public void setCurrentPage (int value ) {
43+ this .currentPage = value ;
44+ RecalculatePages ();
45+ }
46+
2747 @ Getter
28- private int itemsCount ;
48+ private long itemsCount ;
49+
50+ public void setItemsCount (long value ) {
51+ this .itemsCount = value ;
52+ RecalculatePages ();
53+ }
2954
3055 @ Getter
3156 private int maxDisplayedPages = DEFAULT_MAX_DISPLAYED_PAGES ;
3257
58+ public void setMaxDisplayedPages (int value ) {
59+ this .maxDisplayedPages = value ;
60+ RecalculatePages ();
61+ }
62+
3363 @ Getter
3464 private int pageSize ;
3565
66+ public void setPageSize (int value ) {
67+ this .pageSize = value ;
68+ RecalculatePages ();
69+ }
70+
3671 @ Getter
3772 private int queryPageSize ;
3873
74+ public void setQueryPageSize (int value ) {
75+ this .queryPageSize = value ;
76+ RecalculatePages ();
77+ }
78+
3979 @ Getter
4080 @ Setter
4181 private int startIndex = 0 ;
@@ -99,47 +139,8 @@ public GridPager(IGrid<T> grid) {
99139 }
100140 }
101141
102- public void initialize (int count ) {
103- this .itemsCount = count ;
104- }
105-
106- public void setPageSize (int value ) {
107- this .pageSize = value ;
108- RecalculatePages ();
109- }
110-
111- public void setQueryPageSize (int value ) {
112- this .queryPageSize = value ;
113- RecalculatePages ();
114- }
115-
116- public int getCurrentPage () {
117-
118- if (this .currentPage >= 0 || this .grid .getPagingType () == PagingType .VIRTUALIZATION ) return this .currentPage ;
119- var currentPageParameter = this .grid .getQuery ().get (this .parameterName );
120- if (currentPageParameter != null && currentPageParameter .size () == 1 )
121- this .currentPage = Integer .parseInt (currentPageParameter .get (0 ));
122- else
123- this .currentPage = 1 ;
124-
125- if (this .currentPage > this .pageCount )
126- this .currentPage = this .pageCount ;
127- return this .currentPage ;
128- }
129-
130- public void setCurrentPage (int value ) {
131- this .currentPage = value ;
132- RecalculatePages ();
133- }
134-
135- public void setItemsCount (int value ) {
136- this .itemsCount = value ;
137- RecalculatePages ();
138- }
139-
140- public void setMaxDisplayedPages (int value ) {
141- this .maxDisplayedPages = value ;
142- RecalculatePages ();
142+ public void initialize (long count ) {
143+ setItemsCount (count );
143144 }
144145
145146 protected void RecalculatePages () {
0 commit comments