01: /**
02: * Copyright 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;
16:
17: import java.io.Writer;
18: import org.araneaframework.jsp.AraneaAttributes;
19: import org.araneaframework.jsp.util.JspUtil;
20:
21: /**
22: * Adds a marker to the page which is used to identify the widget to which
23: * the content belongs.
24: *
25: * @author Taimo Peelo (taimo@araneaframework.org)
26: * @since 1.1
27: * @jsp.tag
28: * name = "widgetMarker"
29: * body-content = "JSP"
30: * description = "Adds a marker to the page which can be used to identify the widget to which this tags content belongs. This tag
31: * can be used as many times as needed (content of one widget might be in several unconnected pieces)."
32: */
33: public class WidgetMarkerTag extends BaseWidgetTag {
34: public static final String MARKERCLASS = "widgetMarker";
35:
36: protected String tag = null;
37:
38: public int doStartTag(Writer out) throws Exception {
39: super .doStartTag(out);
40:
41: JspUtil.writeOpenStartTag(out, tag == null ? "div" : tag);
42: JspUtil.writeAttribute(out, "class", MARKERCLASS);
43: JspUtil.writeAttribute(out, AraneaAttributes.WIDGET_ID, widget
44: .getScope().toString());
45: JspUtil.writeCloseStartTag(out);
46:
47: return EVAL_BODY_INCLUDE;
48: }
49:
50: protected int doEndTag(Writer out) throws Exception {
51: JspUtil.writeEndTag(out, tag == null ? "div" : tag);
52: return super .doEndTag(out);
53: }
54:
55: /**
56: * @jsp.attribute
57: * type = "java.lang.String"
58: * required = "false"
59: * description = "UiLib widget id."
60: */
61: public void setTag(String tag) throws Exception {
62: this .tag = (String) evaluateNotNull("tag", tag, String.class);
63: }
64: }
|