01: /**
02: * Copyright 2006-2007 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.jsp.tag.uilib.form.element.text;
16:
17: import java.io.Writer;
18: import javax.servlet.jsp.JspException;
19: import org.araneaframework.jsp.util.JspUtil;
20:
21: /**
22: * Standard text input form element tag with rich text editor capabilities.
23: * The tag uses a special style class denoted by EDITOR_SELECTOR which makes
24: * it possible for the RTE library to locate the area and wrap it.
25: *
26: * @author Toomas Römer
27: * @author Taimo Peelo (taimo@araneaframework.org)
28: *
29: * @jsp.tag
30: * name = "richTextarea"
31: * body-content = "JSP"
32: * description = "Form text input field (textarea) wrapped with rich text editor capabilities."
33: */
34: public class FormRichTextAreaHtmlTag extends FormTextareaHtmlTag {
35: public static final String EDITOR_SELECTOR = "richTextEditor";
36:
37: protected String getStyleClass() throws JspException {
38: return EDITOR_SELECTOR;
39: }
40:
41: protected int doStartTag(Writer out) throws Exception {
42: initializeRichEditor(out);
43:
44: return super .doStartTag(out);
45: }
46:
47: protected void initializeRichEditor(Writer out) throws Exception {
48: JspUtil.writeOpenStartTag(out, "script");
49: JspUtil.writeAttribute(out, "type", "text/javascript");
50: JspUtil.writeCloseStartTag_SS(out);
51: out.write("AraneaTinyMCEInit();");
52: JspUtil.writeEndTag(out, "script");
53: }
54: }
|