KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/modules/CmsModulesEdit.java,v $
3  * Date : $Date: 2006/10/06 14:02:20 $
4  * Version: $Revision: 1.13 $
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.util.CmsStringUtil;
36 import org.opencms.widgets.CmsCheckboxWidget;
37 import org.opencms.widgets.CmsDisplayWidget;
38 import org.opencms.widgets.CmsInputWidget;
39 import org.opencms.widgets.CmsTextareaWidget;
40 import org.opencms.workplace.CmsWidgetDialogParameter;
41
42 import javax.servlet.http.HttpServletRequest JavaDoc;
43 import javax.servlet.http.HttpServletResponse JavaDoc;
44 import javax.servlet.jsp.PageContext JavaDoc;
45
46 /**
47  * Edit class to edit an exiting module.<p>
48  *
49  * @author Michael Emmerich
50  *
51  * @version $Revision: 1.13 $
52  *
53  * @since 6.0.0
54  */

55 public class CmsModulesEdit extends CmsModulesEditBase {
56
57     /**
58      * Public constructor with JSP action element.<p>
59      *
60      * @param jsp an initialized JSP action element
61      */

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

75     public CmsModulesEdit(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
76
77         this(new CmsJspActionElement(context, req, res));
78
79     }
80
81     /**
82      * Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
83      *
84      * @param dialog the dialog (page) to get the HTML for
85      * @return the dialog HTML for all defined widgets of the named dialog (page)
86      */

87     protected String JavaDoc createDialogHtml(String JavaDoc dialog) {
88
89         StringBuffer JavaDoc result = new StringBuffer JavaDoc(1024);
90
91         // create table
92
result.append(createWidgetTableStart());
93
94         // show error header once if there were validation errors
95
result.append(createWidgetErrorHeader());
96
97         if (dialog.equals(PAGES[0])) {
98             result.append(dialogBlockStart(key("label.moduleinformation")));
99             result.append(createWidgetTableStart());
100             result.append(createDialogRowsHtml(0, 5));
101             result.append(createWidgetTableEnd());
102             result.append(dialogBlockEnd());
103             result.append(dialogBlockStart(key("label.modulecreator")));
104             result.append(createWidgetTableStart());
105             result.append(createDialogRowsHtml(6, 7));
106             result.append(createWidgetTableEnd());
107             result.append(dialogBlockEnd());
108             if (CmsStringUtil.isEmpty(m_module.getName())) {
109                 result.append(dialogBlockStart(key("label.modulefolder")));
110                 result.append(createWidgetTableStart());
111                 result.append(createDialogRowsHtml(8, 13));
112                 result.append(createWidgetTableEnd());
113                 result.append(dialogBlockEnd());
114             }
115         }
116
117         // close table
118
result.append(createWidgetTableEnd());
119
120         return result.toString();
121     }
122
123     /**
124      * Creates the list of widgets for this dialog.<p>
125      */

126     protected void defineWidgets() {
127
128         initModule();
129
130         if (CmsStringUtil.isEmpty(m_module.getName())) {
131             addWidget(new CmsWidgetDialogParameter(m_module, "name", PAGES[0], new CmsInputWidget()));
132         } else {
133             addWidget(new CmsWidgetDialogParameter(m_module, "name", PAGES[0], new CmsDisplayWidget()));
134         }
135         addWidget(new CmsWidgetDialogParameter(m_module, "niceName", PAGES[0], new CmsInputWidget()));
136         addWidget(new CmsWidgetDialogParameter(m_module, "description", PAGES[0], new CmsTextareaWidget()));
137         addWidget(new CmsWidgetDialogParameter(m_module, "version.version", PAGES[0], new CmsInputWidget()));
138         addWidget(new CmsWidgetDialogParameter(m_module, "group", PAGES[0], new CmsInputWidget()));
139         addWidget(new CmsWidgetDialogParameter(m_module, "actionClass", PAGES[0], new CmsInputWidget()));
140         addWidget(new CmsWidgetDialogParameter(m_module, "authorName", PAGES[0], new CmsInputWidget()));
141         addWidget(new CmsWidgetDialogParameter(m_module, "authorEmail", PAGES[0], new CmsInputWidget()));
142         // add the second page only when creating a new module
143
if (CmsStringUtil.isEmpty(m_module.getName())) {
144             addWidget(new CmsWidgetDialogParameter(m_module, "createModuleFolder", PAGES[0], new CmsCheckboxWidget()));
145             addWidget(new CmsWidgetDialogParameter(m_module, "createTemplateFolder", PAGES[0], new CmsCheckboxWidget()));
146             addWidget(new CmsWidgetDialogParameter(m_module, "createElementsFolder", PAGES[0], new CmsCheckboxWidget()));
147             addWidget(new CmsWidgetDialogParameter(m_module, "createResourcesFolder", PAGES[0], new CmsCheckboxWidget()));
148             addWidget(new CmsWidgetDialogParameter(m_module, "createClassesFolder", PAGES[0], new CmsCheckboxWidget()));
149             addWidget(new CmsWidgetDialogParameter(m_module, "createLibFolder", PAGES[0], new CmsCheckboxWidget()));
150         }
151     }
152
153 }
154
Popular Tags