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
015package org.apache.tapestry.contrib.table.model.simple;
016
017import java.io.Serializable;
018
019import org.apache.tapestry.contrib.table.model.ITableSortingState;
020
021/**
022 * A minimal implementation of 
023 * {@link org.apache.tapestry.contrib.table.model.ITableSortingState}
024 * 
025 * @author mindbridge
026 */
027public class SimpleTableSortingState
028        implements ITableSortingState, Serializable
029{
030        private static final long serialVersionUID = 1L;
031        
032        private String m_strSortColumn;
033        private boolean m_bSortOrder;
034
035        public SimpleTableSortingState()
036        {
037                this(null, ITableSortingState.SORT_ASCENDING); 
038        }
039
040        public SimpleTableSortingState(String strSortColumn, boolean bSortOrder)
041        {
042                m_strSortColumn = strSortColumn; 
043                m_bSortOrder = bSortOrder;
044        }
045        
046        /**
047         * Returns the SortOrder.
048         * @return boolean
049         */
050        public boolean getSortOrder()
051        {
052                return m_bSortOrder;
053        }
054
055        /**
056         * Returns the SortColumn.
057         * @return int
058         */
059        public String getSortColumn()
060        {
061                return m_strSortColumn;
062        }
063
064        /**
065         * Sets the SortColumn.
066         * @param strSortColumn The SortColumn to set
067         */
068        public void setSortColumn(String strSortColumn, boolean bSortOrder)
069        {
070                m_strSortColumn = strSortColumn;
071                m_bSortOrder = bSortOrder;
072        }
073
074}