View Javadoc

1   /*
2    * This file was automatically generated by Apache Tiles Autotag.
3    */
4   package org.apache.tiles.jsp.taglib;
5   
6   import java.io.IOException;
7   
8   import javax.servlet.jsp.JspException;
9   import javax.servlet.jsp.tagext.SimpleTagSupport;
10  
11  import org.apache.tiles.autotag.core.runtime.ModelBody;
12  import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
13  
14  /**
15   * <p>
16   * <strong> Render the value of the specified template attribute to the current
17   * Writer</strong>
18   * </p>
19   * 
20   * <p>
21   * Retrieve the value of the specified template attribute property, and render
22   * it to the current Writer as a String. The usual toString() conversions is
23   * applied on found value.
24   * </p>
25   */
26  public class GetAsStringTag extends SimpleTagSupport {
27  
28      /**
29       * The template model.
30       */
31      private org.apache.tiles.template.GetAsStringModel model = new org.apache.tiles.template.GetAsStringModel();
32  
33      /**
34       * If <code>true</code>, if an exception happens during
35       * rendering, of if the attribute is null, the problem will be ignored.
36       */
37      private boolean ignore;
38  
39      /**
40       * The preparer to invoke before rendering the attribute.
41       */
42      private java.lang.String preparer;
43  
44      /**
45       * A comma-separated list of roles. If present, the attribute
46       * will be rendered only if the current user belongs to one of the roles.
47       */
48      private java.lang.String role;
49  
50      /**
51       * The default value of the attribute. To use only if
52       * the attribute was not computed.
53       */
54      private java.lang.Object defaultValue;
55  
56      /**
57       * The default comma-separated list of roles. To use
58       * only if the attribute was not computed.
59       */
60      private java.lang.String defaultValueRole;
61  
62      /**
63       * The default type of the attribute. To use only if
64       * the attribute was not computed.
65       */
66      private java.lang.String defaultValueType;
67  
68      /**
69       * The name of the attribute.
70       */
71      private java.lang.String name;
72  
73      /**
74       * The attribute to use immediately, if not null.
75       */
76      private org.apache.tiles.Attribute value;
77  
78      /**
79       * Getter for ignore property.
80       *
81       * @return
82       * If <code>true</code>, if an exception happens during
83       * rendering, of if the attribute is null, the problem will be ignored.
84       */
85      public boolean isIgnore() {
86          return ignore;
87      }
88  
89      /**
90       * Setter for ignore property.
91       *
92       * @param ignore
93       * If <code>true</code>, if an exception happens during
94       * rendering, of if the attribute is null, the problem will be ignored.
95       */
96      public void setIgnore(boolean ignore) {
97          this.ignore = ignore;
98      }
99  
100     /**
101      * Getter for preparer property.
102      *
103      * @return
104      * The preparer to invoke before rendering the attribute.
105      */
106     public java.lang.String getPreparer() {
107         return preparer;
108     }
109 
110     /**
111      * Setter for preparer property.
112      *
113      * @param preparer
114      * The preparer to invoke before rendering the attribute.
115      */
116     public void setPreparer(java.lang.String preparer) {
117         this.preparer = preparer;
118     }
119 
120     /**
121      * Getter for role property.
122      *
123      * @return
124      * A comma-separated list of roles. If present, the attribute
125      * will be rendered only if the current user belongs to one of the roles.
126      */
127     public java.lang.String getRole() {
128         return role;
129     }
130 
131     /**
132      * Setter for role property.
133      *
134      * @param role
135      * A comma-separated list of roles. If present, the attribute
136      * will be rendered only if the current user belongs to one of the roles.
137      */
138     public void setRole(java.lang.String role) {
139         this.role = role;
140     }
141 
142     /**
143      * Getter for defaultValue property.
144      *
145      * @return
146      * The default value of the attribute. To use only if
147      * the attribute was not computed.
148      */
149     public java.lang.Object getDefaultValue() {
150         return defaultValue;
151     }
152 
153     /**
154      * Setter for defaultValue property.
155      *
156      * @param defaultValue
157      * The default value of the attribute. To use only if
158      * the attribute was not computed.
159      */
160     public void setDefaultValue(java.lang.Object defaultValue) {
161         this.defaultValue = defaultValue;
162     }
163 
164     /**
165      * Getter for defaultValueRole property.
166      *
167      * @return
168      * The default comma-separated list of roles. To use
169      * only if the attribute was not computed.
170      */
171     public java.lang.String getDefaultValueRole() {
172         return defaultValueRole;
173     }
174 
175     /**
176      * Setter for defaultValueRole property.
177      *
178      * @param defaultValueRole
179      * The default comma-separated list of roles. To use
180      * only if the attribute was not computed.
181      */
182     public void setDefaultValueRole(java.lang.String defaultValueRole) {
183         this.defaultValueRole = defaultValueRole;
184     }
185 
186     /**
187      * Getter for defaultValueType property.
188      *
189      * @return
190      * The default type of the attribute. To use only if
191      * the attribute was not computed.
192      */
193     public java.lang.String getDefaultValueType() {
194         return defaultValueType;
195     }
196 
197     /**
198      * Setter for defaultValueType property.
199      *
200      * @param defaultValueType
201      * The default type of the attribute. To use only if
202      * the attribute was not computed.
203      */
204     public void setDefaultValueType(java.lang.String defaultValueType) {
205         this.defaultValueType = defaultValueType;
206     }
207 
208     /**
209      * Getter for name property.
210      *
211      * @return
212      * The name of the attribute.
213      */
214     public java.lang.String getName() {
215         return name;
216     }
217 
218     /**
219      * Setter for name property.
220      *
221      * @param name
222      * The name of the attribute.
223      */
224     public void setName(java.lang.String name) {
225         this.name = name;
226     }
227 
228     /**
229      * Getter for value property.
230      *
231      * @return
232      * The attribute to use immediately, if not null.
233      */
234     public org.apache.tiles.Attribute getValue() {
235         return value;
236     }
237 
238     /**
239      * Setter for value property.
240      *
241      * @param value
242      * The attribute to use immediately, if not null.
243      */
244     public void setValue(org.apache.tiles.Attribute value) {
245         this.value = value;
246     }
247 
248     /** {@inheritDoc} */
249     @Override
250     public void doTag() throws JspException, IOException {
251         AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.jsp.autotag.JspAutotagRuntime();
252         if (runtime instanceof SimpleTagSupport) {
253             SimpleTagSupport tag = (SimpleTagSupport) runtime;
254             tag.setJspContext(getJspContext());
255             tag.setJspBody(getJspBody());
256             tag.setParent(getParent());
257             tag.doTag();
258         }
259         org.apache.tiles.request.Request request = runtime.createRequest();        
260         ModelBody modelBody = runtime.createModelBody();
261         model.execute(
262             ignore,
263             preparer,
264             role,
265             defaultValue,
266             defaultValueRole,
267             defaultValueType,
268             name,
269             value,
270             request, modelBody
271         );
272     }
273 }