Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SimpleTablePagingState |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.contrib.table.model.simple; | |
16 | ||
17 | import java.io.Serializable; | |
18 | ||
19 | import org.apache.tapestry.contrib.table.model.ITablePagingState; | |
20 | ||
21 | /** | |
22 | * A minimal implementation of | |
23 | * {@link org.apache.tapestry.contrib.table.model.ITablePagingState}. | |
24 | * | |
25 | * @author mindbridge | |
26 | */ | |
27 | public class SimpleTablePagingState implements ITablePagingState, Serializable | |
28 | { | |
29 | ||
30 | private static final long serialVersionUID = 1L; | |
31 | ||
32 | private static final int DEFAULT_PAGE_SIZE = 10; | |
33 | ||
34 | private int m_nPageSize; | |
35 | private int m_nCurrentPage; | |
36 | ||
37 | public SimpleTablePagingState() | |
38 | { | |
39 | 0 | this(DEFAULT_PAGE_SIZE, 0); |
40 | 0 | } |
41 | ||
42 | public SimpleTablePagingState(int nPageSize, int nCurrentPage) | |
43 | 0 | { |
44 | 0 | m_nPageSize = nPageSize; |
45 | 0 | m_nCurrentPage = nCurrentPage; |
46 | 0 | } |
47 | ||
48 | /** | |
49 | * Returns the pageSize. | |
50 | * | |
51 | * @return int | |
52 | */ | |
53 | public int getPageSize() | |
54 | { | |
55 | 0 | return m_nPageSize; |
56 | } | |
57 | ||
58 | /** | |
59 | * Sets the pageSize. | |
60 | * | |
61 | * @param pageSize | |
62 | * The pageSize to set | |
63 | */ | |
64 | public void setPageSize(int pageSize) | |
65 | { | |
66 | 0 | m_nPageSize = pageSize; |
67 | 0 | } |
68 | ||
69 | /** | |
70 | * Returns the currentPage. | |
71 | * | |
72 | * @return int | |
73 | */ | |
74 | public int getCurrentPage() | |
75 | { | |
76 | 0 | return m_nCurrentPage; |
77 | } | |
78 | ||
79 | /** | |
80 | * Sets the currentPage. | |
81 | * | |
82 | * @param currentPage | |
83 | * The currentPage to set | |
84 | */ | |
85 | public void setCurrentPage(int currentPage) | |
86 | { | |
87 | 0 | m_nCurrentPage = currentPage; |
88 | 0 | } |
89 | ||
90 | } |