KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > widgets > A_CmsHtmlGalleryWidget


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/widgets/A_CmsHtmlGalleryWidget.java,v $
3  * Date : $Date: 2006/03/27 14:52:19 $
4  * Version: $Revision: 1.9 $
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.widgets;
33
34 import org.opencms.file.CmsObject;
35 import org.opencms.i18n.CmsEncoder;
36 import org.opencms.workplace.galleries.A_CmsGallery;
37
38 /**
39  * Base class for non-editable "HTML display only" widget implementations.<p>
40  *
41  * @author Alexander Kandzior
42  * @author Andreas Zahner
43  *
44  * @version $Revision: 1.9 $
45  *
46  * @since 6.0.0
47  */

48 public abstract class A_CmsHtmlGalleryWidget extends A_CmsGalleryWidget {
49
50     /**
51      * Creates a html gallery widget with the specified combo options.<p>
52      *
53      * @param configuration the configuration (possible options) for the combo box
54      */

55     public A_CmsHtmlGalleryWidget(String JavaDoc configuration) {
56
57         super(configuration);
58     }
59
60     /**
61      * Creates a new html gallery widget.<p>
62      */

63     protected A_CmsHtmlGalleryWidget() {
64
65         // empty constructor is required for class registration
66
this("");
67     }
68
69     /**
70      * @see org.opencms.widgets.I_CmsWidget#getDialogWidget(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter)
71      */

72     public String JavaDoc getDialogWidget(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) {
73
74         String JavaDoc id = param.getId();
75         StringBuffer JavaDoc result = new StringBuffer JavaDoc(128);
76         result.append("<td class=\"xmlTd\">");
77         result.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"maxwidth\">");
78         result.append("<input type=\"hidden\" value=\"");
79         String JavaDoc fieldValue = param.getStringValue(cms);
80         result.append(CmsEncoder.escapeXml(fieldValue));
81         result.append("\" name=\"");
82         result.append(id);
83         result.append("\" id=\"");
84         result.append(id);
85         result.append("\">");
86         result.append("<tr><td style=\"width: 100%;\">");
87         // note that using "xmlHtmlGallery" here is ok since this is the formatting display area which is identical
88
// for all widgets based on this class
89
result.append("<div class=\"xmlHtmlGallery\" unselectable=\"on\" id=\"");
90         result.append(getNameLower());
91         result.append(".");
92         result.append(id);
93         result.append("\"><div>");
94         result.append("</td>");
95         result.append(widgetDialog.dialogHorizontalSpacer(10));
96         result.append("<td><table class=\"editorbuttonbackground\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
97         result.append(widgetDialog.button(
98             "javascript:open" + getNameUpper() + "Gallery('" + A_CmsGallery.MODE_WIDGET + "', '" + id + "');",
99             null,
100             getNameLower() + "gallery",
101             Messages.getButtonName(this.getNameLower()),
102             widgetDialog.getButtonStyle()));
103         result.append(widgetDialog.button(
104             "javascript:reset" + getNameUpper() + "Gallery('" + id + "');",
105             null,
106             "erase",
107             Messages.GUI_BUTTON_ERASE_0,
108             widgetDialog.getButtonStyle()));
109         result.append("</tr></table>");
110         result.append("</td></tr>");
111         result.append("<script type=\"text/javascript\">check");
112         result.append(getNameUpper());
113         result.append("Content('");
114         result.append(id);
115         result.append("');</script>");
116         result.append("</table>");
117
118         result.append("</td>");
119
120         return result.toString();
121     }
122
123     /**
124      * @see org.opencms.widgets.A_CmsGalleryWidget#showPreview(java.lang.String)
125      */

126     public boolean showPreview(String JavaDoc value) {
127
128         // not required for HTML display galleries
129
return false;
130     }
131 }
Popular Tags