001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.workplace.list; 029 030/** 031 * Class for storing the state of a list.<p> 032 * 033 * A list state includes:<br> 034 * <ul> 035 * <li>The current sorted Column</li> 036 * <li>The sorted column Order</li> 037 * <li>The current displayed Page</li> 038 * <li>The current search Filter</li> 039 * </ul> 040 * <p> 041 * 042 * @since 6.0.0 043 */ 044public class CmsListState { 045 046 /** Current sorted column. */ 047 private String m_column; 048 /** Current search filter. */ 049 private String m_filter; 050 /** Current sort order. */ 051 private CmsListOrderEnum m_order; 052 /** Current visible page. */ 053 private int m_page; 054 055 /** 056 * Empty constructor, with default values.<p> 057 */ 058 public CmsListState() { 059 060 m_page = 1; 061 m_order = CmsListOrderEnum.ORDER_ASCENDING; 062 m_filter = ""; 063 m_column = ""; 064 } 065 066 /** 067 * Default Constructor.<p> 068 * 069 * @param list the list to read the state from 070 */ 071 public CmsListState(CmsHtmlList list) { 072 073 m_column = list.getSortedColumn(); 074 m_filter = list.getSearchFilter(); 075 m_page = list.getCurrentPage(); 076 m_order = list.getCurrentSortOrder(); 077 } 078 079 /** 080 * Returns the column.<p> 081 * 082 * @return the column 083 */ 084 public String getColumn() { 085 086 return m_column; 087 } 088 089 /** 090 * Returns the filter.<p> 091 * 092 * @return the filter 093 */ 094 public String getFilter() { 095 096 return m_filter; 097 } 098 099 /** 100 * Returns the order.<p> 101 * 102 * @return the order 103 */ 104 public CmsListOrderEnum getOrder() { 105 106 return m_order; 107 } 108 109 /** 110 * Returns the page.<p> 111 * 112 * @return the page 113 */ 114 public int getPage() { 115 116 return m_page; 117 } 118 119 /** 120 * Sets the column.<p> 121 * 122 * @param column the column to set 123 */ 124 public void setColumn(String column) { 125 126 m_column = column; 127 } 128 129 /** 130 * Sets the filter.<p> 131 * 132 * @param filter the filter to set 133 */ 134 public void setFilter(String filter) { 135 136 m_filter = filter; 137 } 138 139 /** 140 * Sets the order.<p> 141 * 142 * @param order the order to set 143 */ 144 public void setOrder(CmsListOrderEnum order) { 145 146 m_order = order; 147 } 148 149 /** 150 * Sets the page.<p> 151 * 152 * @param page the page to set 153 */ 154 public void setPage(int page) { 155 156 m_page = page; 157 } 158}