KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > modules > CmsModulesEditResources


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/modules/CmsModulesEditResources.java,v $
3  * Date : $Date: 2005/06/23 11:11:38 $
4  * Version: $Revision: 1.6 $
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.tools.modules;
33
34 import org.opencms.jsp.CmsJspActionElement;
35 import org.opencms.main.CmsRuntimeException;
36 import org.opencms.widgets.CmsVfsFileWidget;
37 import org.opencms.workplace.CmsWidgetDialogParameter;
38
39 import javax.servlet.http.HttpServletRequest JavaDoc;
40 import javax.servlet.http.HttpServletResponse JavaDoc;
41 import javax.servlet.jsp.PageContext JavaDoc;
42
43 /**
44  * Edit class to edit an exiting module.<p>
45  *
46  * @author Michael Emmerich
47  *
48  * @version $Revision: 1.6 $
49  *
50  * @since 6.0.0
51  */

52 public class CmsModulesEditResources extends CmsModulesEditBase {
53
54     /**
55      * Public constructor with JSP action element.<p>
56      *
57      * @param jsp an initialized JSP action element
58      */

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

71     public CmsModulesEditResources(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
72
73         this(new CmsJspActionElement(context, req, res));
74     }
75
76     /**
77      * @see org.opencms.workplace.tools.modules.CmsModulesEditBase#actionCommit()
78      */

79     public void actionCommit() {
80
81         try {
82             // validate the module reouces
83
m_module.checkResources(getCms());
84         } catch (CmsRuntimeException e) {
85             addCommitError(e);
86         }
87
88         // now do the committing in the base class
89
super.actionCommit();
90     }
91
92     /**
93      * Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
94      *
95      * @param dialog the dialog (page) to get the HTML for
96      * @return the dialog HTML for all defined widgets of the named dialog (page)
97      */

98     protected String JavaDoc createDialogHtml(String JavaDoc dialog) {
99
100         StringBuffer JavaDoc result = new StringBuffer JavaDoc(1024);
101
102         // create table
103
result.append(createWidgetTableStart());
104
105         // show error header once if there were validation errors
106
result.append(createWidgetErrorHeader());
107
108         if (dialog.equals(PAGES[0])) {
109             result.append(dialogBlockStart(key("label.resource")));
110             result.append(createWidgetTableStart());
111             result.append(createDialogRowsHtml(0, 0));
112             result.append(createWidgetTableEnd());
113             result.append(dialogBlockEnd());
114         }
115         // close table
116
result.append(createWidgetTableEnd());
117
118         return result.toString();
119     }
120
121     /**
122      * Creates the list of widgets for this dialog.<p>
123      */

124     protected void defineWidgets() {
125
126         initModule();
127
128         addWidget(new CmsWidgetDialogParameter(m_module, "resources", PAGES[0], new CmsVfsFileWidget()));
129     }
130 }
131
Popular Tags