001 // Copyright 2004, 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.contrib.table.model.simple; 016 017 import java.io.Serializable; 018 019 import org.apache.tapestry.contrib.table.model.ITablePagingState; 020 021 /** 022 * A minimal implementation of 023 * {@link org.apache.tapestry.contrib.table.model.ITablePagingState}. 024 * 025 * @author mindbridge 026 */ 027 public class SimpleTablePagingState implements ITablePagingState, Serializable 028 { 029 030 private static final long serialVersionUID = 1L; 031 032 private static final int DEFAULT_PAGE_SIZE = 10; 033 034 private int m_nPageSize; 035 private int m_nCurrentPage; 036 037 public SimpleTablePagingState() 038 { 039 this(DEFAULT_PAGE_SIZE, 0); 040 } 041 042 public SimpleTablePagingState(int nPageSize, int nCurrentPage) 043 { 044 m_nPageSize = nPageSize; 045 m_nCurrentPage = nCurrentPage; 046 } 047 048 /** 049 * Returns the pageSize. 050 * 051 * @return int 052 */ 053 public int getPageSize() 054 { 055 return m_nPageSize; 056 } 057 058 /** 059 * Sets the pageSize. 060 * 061 * @param pageSize 062 * The pageSize to set 063 */ 064 public void setPageSize(int pageSize) 065 { 066 m_nPageSize = pageSize; 067 } 068 069 /** 070 * Returns the currentPage. 071 * 072 * @return int 073 */ 074 public int getCurrentPage() 075 { 076 return m_nCurrentPage; 077 } 078 079 /** 080 * Sets the currentPage. 081 * 082 * @param currentPage 083 * The currentPage to set 084 */ 085 public void setCurrentPage(int currentPage) 086 { 087 m_nCurrentPage = currentPage; 088 } 089 090 }