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            private static final long serialVersionUID = 1L;
030            
031            private ITablePagingState m_objPagingState;
032            private ITableSortingState m_objSortingState;
033    
034            public SimpleTableState()
035            {
036                    this(new SimpleTablePagingState(), new SimpleTableSortingState());
037            }
038    
039            public SimpleTableState(
040                    ITablePagingState objPagingState,
041                    ITableSortingState objSortingState)
042            {
043                    m_objPagingState = objPagingState;
044                    m_objSortingState = objSortingState;
045            }
046    
047            public SimpleTableState(int nPageSize, int nCurrentPage, String strSortColumn, boolean bSortOrder) {
048                    this(new SimpleTablePagingState(nPageSize, nCurrentPage), 
049                                    new SimpleTableSortingState(strSortColumn, bSortOrder));
050            }
051            
052            /**
053             * Returns the pagingState.
054             * @return ITablePagingState
055             */
056            public ITablePagingState getPagingState()
057            {
058                    return m_objPagingState;
059            }
060    
061            /**
062             * Returns the sortingState.
063             * @return ITableSortingState
064             */
065            public ITableSortingState getSortingState()
066            {
067                    return m_objSortingState;
068            }
069    
070    }