001: /*
002: * File : $Source$
003: * Date : $Date$
004: * Version: $Revision$
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.workplace.list;
033:
034: import org.opencms.jsp.CmsJspActionElement;
035: import org.opencms.workplace.CmsDialog;
036:
037: import javax.servlet.http.HttpServletRequest;
038: import javax.servlet.http.HttpServletResponse;
039: import javax.servlet.jsp.PageContext;
040:
041: /**
042: * Generates a CSV file for a given list.<p>
043: *
044: * @author Michael Moossen
045: *
046: * @version $Revision$
047: *
048: * @since 6.0.0
049: */
050: public class CmsListCsvExportDialog extends CmsDialog {
051:
052: /** List class parameter name constant. */
053: public static final String PARAM_LISTCLASS = "listclass";
054:
055: /** List class paramater value. */
056: private String m_paramListclass;
057:
058: /**
059: * Public constructor.<p>
060: *
061: * @param jsp an initialized JSP action element
062: */
063: public CmsListCsvExportDialog(CmsJspActionElement jsp) {
064:
065: super (jsp);
066: }
067:
068: /**
069: * Generates the CSV file for the given list.<p>
070: *
071: * @return CSV file
072: *
073: * @throws ClassNotFoundException if the list dialog class is not found
074: */
075: public String generateCsv() throws ClassNotFoundException {
076:
077: CmsHtmlList list = A_CmsListDialog.getListObject(Class
078: .forName(getParamListclass()), getSettings());
079: return list.listCsv();
080: }
081:
082: /**
083: * Public constructor with JSP variables.<p>
084: *
085: * @param context the JSP page context
086: * @param req the JSP request
087: * @param res the JSP response
088: */
089: public CmsListCsvExportDialog(PageContext context,
090: HttpServletRequest req, HttpServletResponse res) {
091:
092: this (new CmsJspActionElement(context, req, res));
093: }
094:
095: /**
096: * Returns the value for the List class parameter.<p>
097: *
098: * @return the value for the List class parameter
099: */
100: public String getParamListclass() {
101:
102: return m_paramListclass;
103: }
104:
105: /**
106: * Sets the value for the List class parameter.<p>
107: *
108: * @param listclass the value for the List class parameter to set
109: */
110: public void setParamListclass(String listclass) {
111:
112: m_paramListclass = listclass;
113: }
114:
115: }
|