View Javadoc

1   /**
2    * This file is part of the equanda project.
3    *
4    * The contents of this file are subject to the Mozilla Public License Version 1.1 (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 http://www.mozilla.org/MPL/
7    *
8    * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
9    * ANY KIND, either express or implied. See the License for the specific language governing rights and
10   * limitations under the License.
11   *
12   * Alternatively, the contents of this file may be used under the terms of
13   * either the GNU General Public License Version 2 or later (the "GPL"), or
14   * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
15   * in which case the provisions of the GPL or the LGPL are applicable instead
16   * of those above. If you wish to allow use of your version of this file only
17   * under the terms of either the GPL or the LGPL, and not to allow others to
18   * use your version of this file under the terms of the MPL, indicate your
19   * decision by deleting the provisions above and replace them with the notice
20   * and other provisions required by the GPL or the LGPL. If you do not delete
21   * the provisions above, a recipient may use your version of this file under
22   * the terms of any one of the MPL, the GPL or the LGPL.
23   */
24  
25  package org.equanda.tapestry5.base;
26  
27  import org.apache.tapestry5.json.JSONObject;
28  
29  /**
30   * Configuration bean for {@link org.equanda.tapestry5.components.JSPager}
31   * @author <a href="mailto:vladimir.tkachenko@gmail.com">Vladimir Tkachenko</a>
32   */
33  public class PagerConfig
34  {
35      private int range;
36      private int maxPages;
37      private int rowsPerPage;
38      private int lastIndex;
39      private int currentPage;
40      private int rowCount;
41      private int addedRowCount;
42      private int additionalRowCount;
43      private String currentPageFieldName;
44      private String addedRowFieldName;
45      private String containerClass;
46      private String rowClass;
47      private String addLinkClass;
48      private String addBlockClass;
49      private String name;
50  
51      public PagerConfig()
52      {
53          
54      }
55  
56      public PagerConfig( int range, int maxPages, int rowsPerPage, int lastIndex, int currentPage, int rowCount,
57          int addedRowCount, int additionalRowCount, String currentPageFieldName, String addedRowFieldName,
58          String containerClass, String rowClass, String addLinkClass, String addBlockClass, String name )
59      {
60          super();
61          this.range = range;
62          this.maxPages = maxPages;
63          this.rowsPerPage = rowsPerPage;
64          this.lastIndex = lastIndex;
65          this.currentPage = currentPage;
66          this.rowCount = rowCount;
67          this.addedRowCount = addedRowCount;
68          this.additionalRowCount = additionalRowCount;
69          this.currentPageFieldName = currentPageFieldName;
70          this.addedRowFieldName = addedRowFieldName;
71          this.containerClass = containerClass;
72          this.rowClass = rowClass;
73          this.addLinkClass = addLinkClass;
74          this.addBlockClass = addBlockClass;
75          this.name = name;
76      }
77  
78      public int getRange()
79      {
80          return range;
81      }
82  
83      public void setRange( int range )
84      {
85          this.range = range;
86      }
87  
88      public int getMaxPages()
89      {
90          return maxPages;
91      }
92  
93      public void setMaxPages( int maxPages )
94      {
95          this.maxPages = maxPages;
96      }
97  
98      public int getRowsPerPage()
99      {
100         return rowsPerPage;
101     }
102 
103     public void setRowsPerPage( int rowsPerPage )
104     {
105         this.rowsPerPage = rowsPerPage;
106     }
107 
108     public int getLastIndex()
109     {
110         return lastIndex;
111     }
112 
113     public void setLastIndex( int lastIndex )
114     {
115         this.lastIndex = lastIndex;
116     }
117 
118     public int getCurrentPage()
119     {
120         return currentPage;
121     }
122 
123     public void setCurrentPage( int currentPage )
124     {
125         this.currentPage = currentPage;
126     }
127 
128     public int getRowCount()
129     {
130         return rowCount;
131     }
132 
133     public void setRowCount( int rowCount )
134     {
135         this.rowCount = rowCount;
136     }
137 
138     public int getAddedRowCount()
139     {
140         return addedRowCount;
141     }
142 
143     public void setAddedRowCount( int addedRowCount )
144     {
145         this.addedRowCount = addedRowCount;
146     }
147 
148     public int getAdditionalRowCount()
149     {
150         return additionalRowCount;
151     }
152 
153     public void setAdditionalRowCount( int additionalRowCount )
154     {
155         this.additionalRowCount = additionalRowCount;
156     }
157 
158     public String getCurrentPageFieldName()
159     {
160         return currentPageFieldName;
161     }
162 
163     public void setCurrentPageFieldName( String currentPageFieldName )
164     {
165         this.currentPageFieldName = currentPageFieldName;
166     }
167 
168     public String getAddedRowFieldName()
169     {
170         return addedRowFieldName;
171     }
172 
173     public void setAddedRowFieldName( String addedRowFieldName )
174     {
175         this.addedRowFieldName = addedRowFieldName;
176     }
177 
178     public String getContainerClass()
179     {
180         return containerClass;
181     }
182 
183     public void setContainerClass( String containerClass )
184     {
185         this.containerClass = containerClass;
186     }
187 
188     public String getRowClass()
189     {
190         return rowClass;
191     }
192 
193     public void setRowClass( String rowClass )
194     {
195         this.rowClass = rowClass;
196     }
197 
198     public String getAddLinkClass()
199     {
200         return addLinkClass;
201     }
202 
203     public void setAddLinkClass( String addLinkClass )
204     {
205         this.addLinkClass = addLinkClass;
206     }
207 
208     public String getAddBlockClass()
209     {
210         return addBlockClass;
211     }
212 
213     public void setAddBlockClass( String addBlockClass )
214     {
215         this.addBlockClass = addBlockClass;
216     }
217 
218     public String getName()
219     {
220         return name;
221     }
222 
223     public void setName( String name )
224     {
225         this.name = name;
226     }
227 
228     public JSONObject getJSONObject()
229     {
230         JSONObject object = new JSONObject();
231         object.put( "range", range );
232         object.put( "rowsPerPage", rowsPerPage );
233         object.put( "lastIndex", lastIndex );
234         object.put( "currentPage", currentPage );
235         object.put( "rowCount", rowCount );
236         object.put( "addedRowCount", addedRowCount );
237         object.put( "additionalRowCount", additionalRowCount );
238         object.put( "currentPageFieldName", currentPageFieldName );
239         object.put( "addedRowFieldName", addedRowFieldName );
240         object.put( "containerClass", containerClass );
241         object.put( "rowClass", rowClass );
242         object.put( "addLinkClass", addLinkClass );
243         object.put( "addBlockClass", addBlockClass );
244         object.put( "name", name );
245         return object;
246     }
247 }