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 import org.apache.tapestry.contrib.table.model.ITableSortingState;
021
022 /**
023 * A container holding all of the table model states.
024 *
025 * @author mindbridge
026 */
027 public class SimpleTableState implements Serializable
028 {
029
030 private static final long serialVersionUID = 1L;
031
032 private ITablePagingState m_objPagingState;
033 private ITableSortingState m_objSortingState;
034
035 public SimpleTableState()
036 {
037 this(new SimpleTablePagingState(), new SimpleTableSortingState());
038 }
039
040 public SimpleTableState(ITablePagingState objPagingState,
041 ITableSortingState objSortingState)
042 {
043 m_objPagingState = objPagingState;
044 m_objSortingState = objSortingState;
045 }
046
047 public SimpleTableState(int nPageSize, int nCurrentPage,
048 String strSortColumn, boolean bSortOrder)
049 {
050 this(new SimpleTablePagingState(nPageSize, nCurrentPage),
051 new SimpleTableSortingState(strSortColumn, bSortOrder));
052 }
053
054 /**
055 * Returns the pagingState.
056 *
057 * @return ITablePagingState
058 */
059 public ITablePagingState getPagingState()
060 {
061 return m_objPagingState;
062 }
063
064 /**
065 * Returns the sortingState.
066 *
067 * @return ITableSortingState
068 */
069 public ITableSortingState getSortingState()
070 {
071 return m_objSortingState;
072 }
073
074 }