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 StopwordsPager implements Serializable {
24  
25      private static final long serialVersionUID = 1L;
26  
27      private int allRecordCount;
28  
29      private int allPageCount;
30  
31      private boolean existPrePage;
32  
33      private boolean existNextPage;
34  
35      private List<Integer> pageNumberList;
36  
37      private int pageSize;
38  
39      private int currentPageNumber;
40  
41      public String id;
42  
43      public void clear() {
44          allRecordCount = 0;
45          allPageCount = 0;
46          existPrePage = false;
47          existNextPage = false;
48          pageSize = getDefaultPageSize();
49          currentPageNumber = getDefaultCurrentPageNumber();
50  
51          id = null;
52      }
53  
54      protected int getDefaultPageSize() {
55          return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
56      }
57  
58      protected int getDefaultCurrentPageNumber() {
59          return 1;
60      }
61  
62      public int getAllRecordCount() {
63          return allRecordCount;
64      }
65  
66      public void setAllRecordCount(final int allRecordCount) {
67          this.allRecordCount = allRecordCount;
68      }
69  
70      public int getAllPageCount() {
71          return allPageCount;
72      }
73  
74      public void setAllPageCount(final int allPageCount) {
75          this.allPageCount = allPageCount;
76      }
77  
78      public boolean isExistPrePage() {
79          return existPrePage;
80      }
81  
82      public void setExistPrePage(final boolean existPrePage) {
83          this.existPrePage = existPrePage;
84      }
85  
86      public boolean isExistNextPage() {
87          return existNextPage;
88      }
89  
90      public void setExistNextPage(final boolean existNextPage) {
91          this.existNextPage = existNextPage;
92      }
93  
94      public int getPageSize() {
95          if (pageSize <= 0) {
96              pageSize = getDefaultPageSize();
97          }
98          return pageSize;
99      }
100 
101     public void setPageSize(final int pageSize) {
102         this.pageSize = pageSize;
103     }
104 
105     public int getCurrentPageNumber() {
106         if (currentPageNumber <= 0) {
107             currentPageNumber = getDefaultCurrentPageNumber();
108         }
109         return currentPageNumber;
110     }
111 
112     public void setCurrentPageNumber(final int currentPageNumber) {
113         this.currentPageNumber = currentPageNumber;
114     }
115 
116     public List<Integer> getPageNumberList() {
117         return pageNumberList;
118     }
119 
120     public void setPageNumberList(final List<Integer> pageNumberList) {
121         this.pageNumberList = pageNumberList;
122     }
123 }