KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > servlet > http > jsp > tagext > tree > TreeLeafTag


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.servlet.http.jsp.tagext.tree;
8
9 import javax.servlet.jsp.JspException JavaDoc;
10 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
11
12 import org.apache.struts.util.RequestUtils;
13 import org.apache.struts.util.ResponseUtils;
14
15 /**
16  * Description of the Class
17  *
18  * @author Laurent Etiemble
19  * @version $Revision: 1.1 $
20  * @todo Javadoc to complete
21  * @jsp:tag name="treeLeaf" body-content="empty"
22  */

23 public class TreeLeafTag extends TagSupport JavaDoc
24 {
25    /** Description of the Field */
26    protected String JavaDoc name = null;
27    /** Description of the Field */
28    protected String JavaDoc property = null;
29    /** Description of the Field */
30    protected String JavaDoc scope = null;
31    /** Description of the Field */
32    protected boolean value = false;
33
34
35    /**
36     * Description of the Method
37     *
38     * @return Description of the Return Value
39     * @exception JspException Description of the Exception
40     */

41    public int doStartTag()
42       throws JspException JavaDoc
43    {
44       String JavaDoc img = null;
45       boolean leaf = getValue();
46
47       if (name != null)
48       {
49          if (property != null)
50          {
51             leaf = ((Boolean JavaDoc) RequestUtils.lookup(pageContext, name, property, scope)).booleanValue();
52          }
53          else
54          {
55             leaf = ((Boolean JavaDoc) RequestUtils.lookup(pageContext, name, scope)).booleanValue();
56          }
57       }
58
59       if (leaf)
60       {
61          img = "<img SRC=\"images/tree/join.gif\"/>";
62       }
63       else
64       {
65          img = "<img SRC=\"images/tree/joinbottom.gif\"/>";
66       }
67
68       ResponseUtils.write(pageContext, img);
69
70       // Continue processing this page
71
return (SKIP_BODY);
72    }
73
74
75    /**
76     * Gets the name attribute of the TreeSpacerTag object
77     *
78     * @return The name value
79     * @jsp:attribute name="name" required="false" rtexprvalue="true"
80     */

81    public String JavaDoc getName()
82    {
83       return (this.name);
84    }
85
86
87    /**
88     * Gets the property attribute of the TreeSpacerTag object
89     *
90     * @return The property value
91     * @jsp:attribute name="property" required="false" rtexprvalue="true"
92     */

93    public String JavaDoc getProperty()
94    {
95       return (this.property);
96    }
97
98
99    /**
100     * Gets the scope attribute of the TreeSpacerTag object
101     *
102     * @return The scope value
103     * @jsp:attribute name="scope" required="false" rtexprvalue="true"
104     */

105    public String JavaDoc getScope()
106    {
107       return (this.scope);
108    }
109
110
111    /**
112     * Gets the follow attribute of the TreeSpacerTag object
113     *
114     * @return The follow value
115     * @jsp:attribute name="value" required="false" rtexprvalue="true"
116     */

117    public boolean getValue()
118    {
119       return (this.value);
120    }
121
122
123
124    /** Release all allocated resources. */
125    public void release()
126    {
127       super.release();
128       value = false;
129    }
130
131
132    /**
133     * Sets the name attribute of the TreeSpacerTag object
134     *
135     * @param name The new name value
136     */

137    public void setName(String JavaDoc name)
138    {
139       this.name = name;
140    }
141
142
143    /**
144     * Sets the property attribute of the TreeSpacerTag object
145     *
146     * @param property The new property value
147     */

148    public void setProperty(String JavaDoc property)
149    {
150       this.property = property;
151    }
152
153
154    /**
155     * Sets the scope attribute of the TreeSpacerTag object
156     *
157     * @param scope The new scope value
158     */

159    public void setScope(String JavaDoc scope)
160    {
161       this.scope = scope;
162    }
163
164
165    /**
166     * Sets the follow attribute of the TreeSpacerTag object
167     *
168     * @param value The new value value
169     */

170    public void setValue(boolean value)
171    {
172       this.value = value;
173    }
174
175 }
176
177
Popular Tags