001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/list/A_CmsListReport.java,v $
003: * Date : $Date: 2008-02-27 12:05:28 $
004: * Version: $Revision: 1.11 $
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.report.I_CmsReportThread;
036: import org.opencms.workplace.CmsReport;
037: import org.opencms.workplace.CmsWorkplaceSettings;
038:
039: import javax.servlet.http.HttpServletRequest;
040: import javax.servlet.http.HttpServletResponse;
041: import javax.servlet.jsp.JspException;
042: import javax.servlet.jsp.PageContext;
043:
044: /**
045: * Provides a report in the list widget.<p>
046: *
047: * @author Michael Emmerich
048: *
049: * @version $Revision: 1.11 $
050: *
051: * @since 6.0.0
052: */
053: public abstract class A_CmsListReport extends CmsReport {
054:
055: /**
056: * Public constructor with JSP action element.<p>
057: *
058: * @param jsp an initialized JSP action element
059: */
060: public A_CmsListReport(CmsJspActionElement jsp) {
061:
062: super (jsp);
063:
064: }
065:
066: /**
067: * Public constructor with JSP variables.<p>
068: *
069: * @param context the JSP page context
070: * @param req the JSP request
071: * @param res the JSP response
072: */
073: public A_CmsListReport(PageContext context, HttpServletRequest req,
074: HttpServletResponse res) {
075:
076: this (new CmsJspActionElement(context, req, res));
077:
078: }
079:
080: /**
081: * @see org.opencms.workplace.CmsDialog#actionCloseDialog()
082: */
083: public void actionCloseDialog() throws JspException {
084:
085: getSettings().setListObject(null);
086: super .actionCloseDialog();
087: }
088:
089: /**
090: * Performs the dialog actions depending on the initialized action.<p>
091: *
092: * @throws JspException if dialog actions fail
093: */
094: public void displayReport() throws JspException {
095:
096: // save initialized instance of this class in request attribute for included sub-elements
097: getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS,
098: this );
099: switch (getAction()) {
100: case ACTION_REPORT_END:
101: case ACTION_CANCEL:
102: actionCloseDialog();
103: break;
104: case ACTION_REPORT_UPDATE:
105: setParamAction(REPORT_UPDATE);
106: getJsp().include(FILE_REPORT_OUTPUT);
107: break;
108: case ACTION_REPORT_BEGIN:
109: case ACTION_CONFIRMED:
110: case ACTION_DEFAULT:
111: default:
112: I_CmsReportThread thread = initializeThread();
113: thread.start();
114: setParamAction(REPORT_BEGIN);
115: setParamThread(thread.getUUID().toString());
116: getJsp().include(FILE_REPORT_OUTPUT);
117: }
118: }
119:
120: /**
121: * Initalizes the report thread to use for this report.<p>
122: *
123: * @return the reportd thread to use for this report.
124: */
125: public abstract I_CmsReportThread initializeThread();
126:
127: /**
128: * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
129: */
130: protected void initWorkplaceRequestValues(
131: CmsWorkplaceSettings settings, HttpServletRequest request) {
132:
133: // fill the parameter values in the get/set methods
134: fillParamValues(request);
135:
136: if (REPORT_UPDATE.equals(getParamAction())) {
137: setAction(ACTION_REPORT_UPDATE);
138: } else if (REPORT_BEGIN.equals(getParamAction())) {
139: setAction(ACTION_REPORT_BEGIN);
140: } else if (REPORT_END.equals(getParamAction())) {
141: setAction(ACTION_REPORT_END);
142: } else if (DIALOG_CANCEL.equals(getParamAction())) {
143: setAction(ACTION_CANCEL);
144: } else {
145: // set the default action
146: setAction(ACTION_DEFAULT);
147: }
148: }
149:
150: }
|