1
2
3
4
5
6
7
8
9
10
11
12
13
14 package net.sf.tacos.components.dojo.old;
15
16 import java.util.HashMap;
17 import java.util.Map;
18
19 import org.apache.tapestry.AbstractComponent;
20 import org.apache.tapestry.IMarkupWriter;
21 import org.apache.tapestry.IRequestCycle;
22 import org.apache.tapestry.IScript;
23 import org.apache.tapestry.PageRenderSupport;
24 import org.apache.tapestry.TapestryUtils;
25 import org.apache.tapestry.dojo.DojoUtils;
26 import org.apache.tapestry.dojo.IWidget;
27 import org.apache.tapestry.json.JSONObject;
28
29
30
31
32
33
34
35
36 public abstract class TitlePane extends AbstractComponent implements IWidget, IDojoTitlePane
37 {
38
39 public abstract String getIdParameter();
40
41
42 public abstract String getOptions();
43
44
45 public abstract IScript getScript();
46
47
48
49
50 public void renderWidget(IMarkupWriter writer, IRequestCycle cycle)
51 {
52 renderComponent(writer, cycle);
53 }
54
55
56
57
58
59 protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
60 {
61 writer.begin("div");
62 writer.attribute("id", getIdParameter());
63
64 renderInformalParameters(writer, cycle);
65 renderBody(writer, cycle);
66
67 writer.end();
68
69 JSONObject obj = DojoUtils.parseJSONParameter(this, "options");
70
71 obj.put("labelNode", getLabelNode());
72 obj.put("labelNodeClass", getLabelNodeClass());
73 obj.put("label", getLabel());
74 obj.put("containerNodeClass", getContainerNodeClass());
75
76
77 Map scriptParms = new HashMap();
78 scriptParms.put("id", getIdParameter());
79 scriptParms.put("props", obj.toString());
80
81 PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);
82
83 getScript().execute(this, cycle, pageRenderSupport, scriptParms);
84 }
85 }