01: /*
02: * Copyright (c) 2006 Your Corporation. All Rights Reserved.
03: */
04:
05: /*
06: * Created by IntelliJ IDEA.
07: * User: Jacques
08: * Date: Jan 2, 2006
09: * Time: 7:07:47 PM
10: */
11: package com.technoetic.xplanner.tags.util;
12:
13: import java.util.Map;
14: import java.util.Iterator;
15: import java.util.Enumeration;
16: import java.io.Writer;
17: import java.io.IOException;
18: import javax.servlet.jsp.tagext.BodyTagSupport;
19: import javax.servlet.jsp.tagext.BodyContent;
20: import javax.servlet.jsp.JspException;
21: import javax.servlet.ServletRequest;
22:
23: import org.apache.struts.util.ResponseUtils;
24: import org.apache.commons.collections.map.ListOrderedMap;
25:
26: import com.technoetic.xplanner.util.StringUtilities;
27:
28: public class BoxTag extends BodyTagSupport {
29: private String id;
30: private String styleClass = "box";
31: private String title;
32:
33: public int doEndTag() throws JspException {
34: String id = this .id;
35: if (id == null)
36: id = title;
37: StringBuffer results = new StringBuffer();
38: results.append("<div class=\"" + styleClass + "\">");
39: results.append("<h3 style=\"border-bottom-width:0px\">");
40: results.append("<span class=\"boxIcon\">");
41: results.append(" <span class=\"boxIconText\" id=\"" + id
42: + "-switch\" onclick=\"toggle('" + id
43: + "')\">[hide]</span>\n");
44: results.append("</span>");
45: results.append(title);
46: results.append("</h3>");
47: results.append("<div id=\"" + id + "\" class=\"boxBody\">");
48: renderBody(results);
49: results.append("</div>");
50: results.append("</div>");
51:
52: ResponseUtils.write(pageContext, results.toString());
53:
54: return super .doEndTag();
55: }
56:
57: protected void renderBody(StringBuffer results) {
58: if (bodyContent != null) {
59: results.append(bodyContent.getString());
60: }
61: }
62:
63: public void setStyleClass(String styleClass) {
64: this .styleClass = styleClass;
65: }
66:
67: public void setTitle(String title) {
68: this .title = title;
69: }
70:
71: public void setId(String id) {
72: this.id = id;
73: }
74: }
|