01: /**
02: * Copyright 2006 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;
16:
17: import java.io.Writer;
18: import javax.servlet.jsp.JspException;
19: import org.araneaframework.jsp.tag.uilib.form.BaseFormElementDisplayTag;
20: import org.araneaframework.jsp.util.JspUtil;
21: import org.araneaframework.uilib.form.control.StringArrayRequestControl;
22:
23: /**
24: * @author Jevgeni Kabanov (ekabanov <i>at</i> araneaframework <i>dot</i> org)
25: *
26: * @jsp.tag
27: * name = "checkboxDisplay"
28: * body-content = "JSP"
29: * description = "Form checkbox display field, represents UiLib "CheckboxControl"."
30: */
31: public class FormCheckboxDisplayHtmlTag extends
32: BaseFormElementDisplayTag {
33: protected String imageCode;
34:
35: {
36: baseStyleClass = "aranea-checkbox-display";
37: }
38:
39: protected int doEndTag(Writer out) throws Exception {
40: StringArrayRequestControl.ViewModel viewModel = ((StringArrayRequestControl.ViewModel) controlViewModel);
41:
42: JspUtil.writeOpenStartTag(out, "span");
43: JspUtil.writeAttribute(out, "class", getStyleClass());
44: JspUtil.writeAttribute(out, "style", getStyle());
45: JspUtil.writeAttributes(out, attributes);
46: JspUtil.writeCloseStartTag(out);
47:
48: if ("true".equals(viewModel.getSimpleValue())) //TODO: image?
49: JspUtil.writeEscaped(out, "x");
50:
51: return super .doEndTag(out);
52: }
53:
54: //XXX: why is it here, without attributes
55: protected void setImageCode(String imageCode) throws JspException {
56: this .imageCode = (String) evaluateNotNull("imageCode",
57: imageCode, String.class);
58: }
59: }
|