KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > strutsel > taglib > tiles > ELAddTag


1 /*
2  * $Id: ELAddTag.java 54933 2004-10-16 17:04:52Z germuska $
3  *
4  * Copyright 1999-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.apache.strutsel.taglib.tiles;
20
21 import org.apache.struts.taglib.tiles.AddTag;
22 import javax.servlet.jsp.JspException JavaDoc;
23 import org.apache.strutsel.taglib.utils.EvalHelper;
24
25 /**
26  * Adds an element to the surrounding list tag. Same syntax as
27  * <code>&lt;put&gt;</code>.
28  *<p>
29  * This class is a subclass of the class
30  * <code>org.apache.struts.taglib.tiles.AddTag</code> which provides most of
31  * the described functionality. This subclass allows all attribute values to
32  * be specified as expressions utilizing the JavaServer Pages Standard Library
33  * expression language.
34  *
35  * @version $Rev: 54933 $
36  */

37 public class ELAddTag extends AddTag {
38
39     /**
40      * Instance variable mapped to "value" tag attribute.
41      * (Mapping set in associated BeanInfo class.)
42      */

43     private String JavaDoc valueExpr;
44     /**
45      * Instance variable mapped to "content" tag attribute.
46      * (Mapping set in associated BeanInfo class.)
47      */

48     private String JavaDoc contentExpr;
49     /**
50      * Instance variable mapped to "direct" tag attribute.
51      * (Mapping set in associated BeanInfo class.)
52      */

53     private String JavaDoc directExpr;
54     /**
55      * Instance variable mapped to "type" tag attribute.
56      * (Mapping set in associated BeanInfo class.)
57      */

58     private String JavaDoc typeExpr;
59     /**
60      * Instance variable mapped to "beanName" tag attribute.
61      * (Mapping set in associated BeanInfo class.)
62      */

63     private String JavaDoc beanNameExpr;
64     /**
65      * Instance variable mapped to "beanProperty" tag attribute.
66      * (Mapping set in associated BeanInfo class.)
67      */

68     private String JavaDoc beanPropertyExpr;
69     /**
70      * Instance variable mapped to "beanScope" tag attribute.
71      * (Mapping set in associated BeanInfo class.)
72      */

73     private String JavaDoc beanScopeExpr;
74     /**
75      * Instance variable mapped to "role" tag attribute.
76      * (Mapping set in associated BeanInfo class.)
77      */

78     private String JavaDoc roleExpr;
79
80     /**
81      * Getter method for "value" tag attribute.
82      * (Mapping set in associated BeanInfo class.)
83      */

84     public String JavaDoc getValueExpr() { return (valueExpr); }
85     /**
86      * Getter method for "content" tag attribute.
87      * (Mapping set in associated BeanInfo class.)
88      */

89     public String JavaDoc getContentExpr() { return (contentExpr); }
90     /**
91      * Getter method for "direct" tag attribute.
92      * (Mapping set in associated BeanInfo class.)
93      */

94     public String JavaDoc getDirectExpr() { return (directExpr); }
95     /**
96      * Getter method for "type" tag attribute.
97      * (Mapping set in associated BeanInfo class.)
98      */

99     public String JavaDoc getTypeExpr() { return (typeExpr); }
100     /**
101      * Getter method for "beanName" tag attribute.
102      * (Mapping set in associated BeanInfo class.)
103      */

104     public String JavaDoc getBeanNameExpr() { return (beanNameExpr); }
105     /**
106      * Getter method for "beanProperty" tag attribute.
107      * (Mapping set in associated BeanInfo class.)
108      */

109     public String JavaDoc getBeanPropertyExpr() { return (beanPropertyExpr); }
110     /**
111      * Getter method for "beanScope" tag attribute.
112      * (Mapping set in associated BeanInfo class.)
113      */

114     public String JavaDoc getBeanScopeExpr() { return (beanScopeExpr); }
115     /**
116      * Getter method for "role" tag attribute.
117      * (Mapping set in associated BeanInfo class.)
118      */

119     public String JavaDoc getRoleExpr() { return (roleExpr); }
120
121     /**
122      * Setter method for "value" tag attribute.
123      * (Mapping set in associated BeanInfo class.)
124      */

125     public void setValueExpr(String JavaDoc valueExpr) { this.valueExpr = valueExpr; }
126     /**
127      * Setter method for "content" tag attribute.
128      * (Mapping set in associated BeanInfo class.)
129      */

130     public void setContentExpr(String JavaDoc contentExpr) { this.contentExpr = contentExpr; }
131     /**
132      * Setter method for "direct" tag attribute.
133      * (Mapping set in associated BeanInfo class.)
134      */

135     public void setDirectExpr(String JavaDoc directExpr) { this.directExpr = directExpr; }
136     /**
137      * Setter method for "type" tag attribute.
138      * (Mapping set in associated BeanInfo class.)
139      */

140     public void setTypeExpr(String JavaDoc typeExpr) { this.typeExpr = typeExpr; }
141     /**
142      * Setter method for "beanName" tag attribute.
143      * (Mapping set in associated BeanInfo class.)
144      */

145     public void setBeanNameExpr(String JavaDoc beanNameExpr) { this.beanNameExpr = beanNameExpr; }
146     /**
147      * Setter method for "beanProperty" tag attribute.
148      * (Mapping set in associated BeanInfo class.)
149      */

150     public void setBeanPropertyExpr(String JavaDoc beanPropertyExpr) { this.beanPropertyExpr = beanPropertyExpr; }
151     /**
152      * Setter method for "beanScope" tag attribute.
153      * (Mapping set in associated BeanInfo class.)
154      */

155     public void setBeanScopeExpr(String JavaDoc beanScopeExpr) { this.beanScopeExpr = beanScopeExpr; }
156     /**
157      * Setter method for "role" tag attribute.
158      * (Mapping set in associated BeanInfo class.)
159      */

160     public void setRoleExpr(String JavaDoc roleExpr) { this.roleExpr = roleExpr; }
161
162     /**
163      * Resets attribute values for tag reuse.
164      */

165     public void release()
166     {
167         super.release();
168         setValueExpr(null);
169         setContentExpr(null);
170         setDirectExpr(null);
171         setTypeExpr(null);
172         setBeanNameExpr(null);
173         setBeanPropertyExpr(null);
174         setBeanScopeExpr(null);
175         setRoleExpr(null);
176     }
177     
178     /**
179      * Process the start tag.
180      *
181      * @exception JspException if a JSP exception has occurred
182      */

183     public int doStartTag() throws JspException JavaDoc {
184         evaluateExpressions();
185         return (super.doStartTag());
186     }
187     
188     /**
189      * Processes all attribute values which use the JSTL expression evaluation
190      * engine to determine their values.
191      *
192      * @exception JspException if a JSP exception has occurred
193      */

194     private void evaluateExpressions() throws JspException JavaDoc {
195         String JavaDoc string = null;
196
197         if ((string = EvalHelper.evalString("value", getValueExpr(),
198                                             this, pageContext)) != null)
199             setValue(string);
200         if ((string = EvalHelper.evalString("content", getContentExpr(),
201                                             this, pageContext)) != null)
202             setContent(string);
203         if ((string = EvalHelper.evalString("direct", getDirectExpr(),
204                                             this, pageContext)) != null)
205             setDirect(string);
206         if ((string = EvalHelper.evalString("type", getTypeExpr(),
207                                             this, pageContext)) != null)
208             setType(string);
209         if ((string = EvalHelper.evalString("beanName", getBeanNameExpr(),
210                                             this, pageContext)) != null)
211             setBeanName(string);
212         if ((string = EvalHelper.evalString("beanProperty", getBeanPropertyExpr(),
213                                             this, pageContext)) != null)
214             setBeanProperty(string);
215         if ((string = EvalHelper.evalString("beanScope", getBeanScopeExpr(),
216                                             this, pageContext)) != null)
217             setBeanScope(string);
218         if ((string = EvalHelper.evalString("role", getRoleExpr(),
219                                             this, pageContext)) != null)
220             setRole(string);
221     }
222 }
223
Popular Tags