View Javadoc
1   /*
2    * Copyright 2012-2021 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.app.pager;
17  
18  import java.io.Serializable;
19  import java.util.List;
20  
21  import org.codelibs.fess.util.ComponentUtil;
22  
23  public class ReqHeaderPager implements Serializable {
24  
25      private static final long serialVersionUID = 1L;
26  
27      public static final int DEFAULT_PAGE_SIZE = 20;
28  
29      public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1;
30  
31      private int allRecordCount;
32  
33      private int allPageCount;
34  
35      private boolean existPrePage;
36  
37      private boolean existNextPage;
38  
39      private List<Integer> pageNumberList;
40  
41      private int pageSize;
42  
43      private int currentPageNumber;
44  
45      public String id;
46  
47      public String name;
48  
49      public String value;
50  
51      public String webConfigId;
52  
53      public String createdBy;
54  
55      public String createdTime;
56  
57      public String versionNo;
58  
59      public void clear() {
60          allRecordCount = 0;
61          allPageCount = 0;
62          existPrePage = false;
63          existNextPage = false;
64          pageSize = getDefaultPageSize();
65          currentPageNumber = getDefaultCurrentPageNumber();
66  
67          id = null;
68          name = null;
69          value = null;
70          webConfigId = null;
71          createdBy = null;
72          createdTime = null;
73          versionNo = null;
74  
75      }
76  
77      protected int getDefaultCurrentPageNumber() {
78          return DEFAULT_CURRENT_PAGE_NUMBER;
79      }
80  
81      public int getAllRecordCount() {
82          return allRecordCount;
83      }
84  
85      public void setAllRecordCount(final int allRecordCount) {
86          this.allRecordCount = allRecordCount;
87      }
88  
89      public int getAllPageCount() {
90          return allPageCount;
91      }
92  
93      public void setAllPageCount(final int allPageCount) {
94          this.allPageCount = allPageCount;
95      }
96  
97      public boolean isExistPrePage() {
98          return existPrePage;
99      }
100 
101     public void setExistPrePage(final boolean existPrePage) {
102         this.existPrePage = existPrePage;
103     }
104 
105     public boolean isExistNextPage() {
106         return existNextPage;
107     }
108 
109     public void setExistNextPage(final boolean existNextPage) {
110         this.existNextPage = existNextPage;
111     }
112 
113     public int getPageSize() {
114         if (pageSize <= 0) {
115             pageSize = getDefaultPageSize();
116         }
117         return pageSize;
118     }
119 
120     public void setPageSize(final int pageSize) {
121         this.pageSize = pageSize;
122     }
123 
124     public int getCurrentPageNumber() {
125         if (currentPageNumber <= 0) {
126             currentPageNumber = getDefaultCurrentPageNumber();
127         }
128         return currentPageNumber;
129     }
130 
131     public void setCurrentPageNumber(final int currentPageNumber) {
132         this.currentPageNumber = currentPageNumber;
133     }
134 
135     public List<Integer> getPageNumberList() {
136         return pageNumberList;
137     }
138 
139     public void setPageNumberList(final List<Integer> pageNumberList) {
140         this.pageNumberList = pageNumberList;
141     }
142 
143     protected int getDefaultPageSize() {
144         return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
145     }
146 
147 }