01: /*
02: * Copyright (c) 2005 Opensymphony. All Rights Reserved.
03: */
04: package com.opensymphony.webwork.components;
05:
06: import com.opensymphony.xwork.util.OgnlValueStack;
07:
08: import javax.servlet.http.HttpServletRequest;
09: import javax.servlet.http.HttpServletResponse;
10:
11: /**
12: * <!-- START SNIPPET: javadoc -->
13: *
14: * Renders a tree node within a tree widget with AJAX support.<p/>
15: *
16: * Either of the following combinations should be used depending on if the tree
17: * is to be constrcted dynamically or statically. <p/>
18: *
19: * <b>Dynamically</b>
20: * <ul>
21: * <li>id - id of this tree node</li>
22: * <li>title - label to be displayed for this tree node</li>
23: * </ul>
24: *
25: * <b>Statically</b>
26: * <ul>
27: * <li>rootNode - the parent node of which this tree is derived from</li>
28: * <li>nodeIdProperty - property to obtained this current tree node's id</li>
29: * <li>nodeTitleProperty - property to obtained this current tree node's title</li>
30: * <li>childCollectionProperty - property that returnds this current tree node's children</li>
31: * </ul>
32: *
33: * <!-- END SNIPPET: javadoc -->
34: *
35: * <p/> <b>Examples</b>
36: *
37: * <pre>
38: * <!-- START SNIPPET: example -->
39: *
40: * <-- statically -->
41: * <ww:tree id="..." label="...">
42: * <ww:treenode id="..." label="..." />
43: * <ww:treenode id="..." label="...">
44: * <ww:treenode id="..." label="..." />
45: * <ww:treenode id="..." label="..." />
46: * &;lt;/ww:treenode>
47: * <ww:treenode id="..." label="..." />
48: * </ww:tree>
49: *
50: * <-- dynamically -->
51: * <ww:tree
52: * id="..."
53: * rootNode="..."
54: * nodeIdProperty="..."
55: * nodeTitleProperty="..."
56: * childCollectionProperty="..." />
57: *
58: * <!-- END SNIPPET: example -->
59: * </pre>
60: *
61: * Created : Dec 12, 2005 3:53:40 PM
62: *
63: * @author Jason Carreira <jcarreira@eplus.com>
64: * @author tm_jee
65: *
66: * @ww.tag name="treenode" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.TreeNodeTag"
67: * description="Render a tree node within a tree widget."
68: */
69: public class TreeNode extends ClosingUIBean {
70: private static final String TEMPLATE = "treenode-close";
71: private static final String OPEN_TEMPLATE = "treenode";
72:
73: public TreeNode(OgnlValueStack stack, HttpServletRequest request,
74: HttpServletResponse response) {
75: super (stack, request, response);
76: }
77:
78: public String getDefaultOpenTemplate() {
79: return OPEN_TEMPLATE;
80: }
81:
82: protected String getDefaultTemplate() {
83: return TEMPLATE;
84: }
85:
86: /**
87: * Label expression used for rendering tree node label.
88: * @ww.tagattribute required="true"
89: */
90: public void setLabel(String label) {
91: super.setLabel(label);
92: }
93: }
|