KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > contrib > table > model > simple > SimpleTablePagingState


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 JavaDoc;
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 JavaDoc
28 {
29     private static final long serialVersionUID = 1L;
30
31     private static final int DEFAULT_PAGE_SIZE = 10;
32
33     private int m_nPageSize;
34     private int m_nCurrentPage;
35
36     public SimpleTablePagingState()
37     {
38         this(DEFAULT_PAGE_SIZE, 0);
39     }
40
41     public SimpleTablePagingState(int nPageSize, int nCurrentPage) {
42         m_nPageSize = nPageSize;
43         m_nCurrentPage = nCurrentPage;
44     }
45     
46     /**
47      * Returns the pageSize.
48      * @return int
49      */

50     public int getPageSize()
51     {
52         return m_nPageSize;
53     }
54
55     /**
56      * Sets the pageSize.
57      * @param pageSize The pageSize to set
58      */

59     public void setPageSize(int pageSize)
60     {
61         m_nPageSize = pageSize;
62     }
63
64     /**
65      * Returns the currentPage.
66      * @return int
67      */

68     public int getCurrentPage()
69     {
70         return m_nCurrentPage;
71     }
72
73     /**
74      * Sets the currentPage.
75      * @param currentPage The currentPage to set
76      */

77     public void setCurrentPage(int currentPage)
78     {
79         m_nCurrentPage = currentPage;
80     }
81
82 }
83
Popular Tags