KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > list > A_CmsListReport


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/list/A_CmsListReport.java,v $
3  * Date : $Date: 2005/06/27 23:22:25 $
4  * Version: $Revision: 1.8 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.list;
33
34 import org.opencms.jsp.CmsJspActionElement;
35 import org.opencms.report.I_CmsReportThread;
36 import org.opencms.workplace.CmsReport;
37 import org.opencms.workplace.CmsWorkplaceSettings;
38
39 import javax.servlet.http.HttpServletRequest JavaDoc;
40 import javax.servlet.http.HttpServletResponse JavaDoc;
41 import javax.servlet.jsp.JspException JavaDoc;
42 import javax.servlet.jsp.PageContext JavaDoc;
43
44 /**
45  * Provides a report in the list widget.<p>
46  *
47  * @author Michael Emmerich
48  *
49  * @version $Revision: 1.8 $
50  *
51  * @since 6.0.0
52  */

53 public abstract class A_CmsListReport extends CmsReport {
54
55     /**
56      * Public constructor with JSP action element.<p>
57      *
58      * @param jsp an initialized JSP action element
59      */

60     public A_CmsListReport(CmsJspActionElement jsp) {
61
62         super(jsp);
63
64     }
65
66     /**
67      * Public constructor with JSP variables.<p>
68      *
69      * @param context the JSP page context
70      * @param req the JSP request
71      * @param res the JSP response
72      */

73     public A_CmsListReport(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
74
75         this(new CmsJspActionElement(context, req, res));
76
77     }
78
79     /**
80      * @see org.opencms.workplace.CmsDialog#actionCloseDialog()
81      */

82     public void actionCloseDialog() throws JspException JavaDoc {
83
84         getSettings().setListObject(null);
85         super.actionCloseDialog();
86     }
87
88     /**
89      * Performs the dialog actions depending on the initialized action.<p>
90      *
91      * @throws JspException if dialog actions fail
92      */

93     public void displayReport() throws JspException JavaDoc {
94
95         // save initialized instance of this class in request attribute for included sub-elements
96
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
97         switch (getAction()) {
98             case ACTION_REPORT_END:
99                 actionCloseDialog();
100                 break;
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 m_thread = initializeThread();
113                 m_thread.start();
114                 setParamAction(REPORT_BEGIN);
115                 setParamThread(m_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(CmsWorkplaceSettings settings, HttpServletRequest JavaDoc request) {
131
132         // fill the parameter values in the get/set methods
133
fillParamValues(request);
134
135         if (REPORT_UPDATE.equals(getParamAction())) {
136             setAction(ACTION_REPORT_UPDATE);
137         } else if (REPORT_BEGIN.equals(getParamAction())) {
138             setAction(ACTION_REPORT_BEGIN);
139         } else if (REPORT_END.equals(getParamAction())) {
140             setAction(ACTION_REPORT_END);
141         } else if (DIALOG_CANCEL.equals(getParamAction())) {
142             setAction(ACTION_CANCEL);
143         } else {
144             // set the default action
145
setAction(ACTION_DEFAULT);
146         }
147     }
148
149 }
Popular Tags