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>Add an element to the surrounding list. Equivalent to 'putAttribute',
17   * but for list element.</strong>
18   * </p>
19   * 
20   * <p>
21   * Add an element to the surrounding list. This tag can only be used inside
22   * 'putListAttribute' or 'addListAttribute' tags. Value can come from a direct
23   * assignment (value="aValue")
24   * </p>
25   */
26  public class AddAttributeTag extends SimpleTagSupport {
27  
28      /**
29       * The template model.
30       */
31      private org.apache.tiles.template.AddAttributeModel model = new org.apache.tiles.template.AddAttributeModel();
32  
33      /**
34       * The value of the attribute. Use this parameter, or
35       * expression, or body.
36       */
37      private java.lang.Object value;
38  
39      /**
40       * The expression to calculate the value from. Use this
41       * parameter, or value, or body.
42       */
43      private java.lang.String expression;
44  
45      /**
46       * A comma-separated list of roles. If present, the attribute
47       * will be rendered only if the current user belongs to one of the roles.
48       */
49      private java.lang.String role;
50  
51      /**
52       * The type (renderer) of the attribute.
53       */
54      private java.lang.String type;
55  
56      /**
57       * Getter for value property.
58       *
59       * @return
60       * The value of the attribute. Use this parameter, or
61       * expression, or body.
62       */
63      public java.lang.Object getValue() {
64          return value;
65      }
66  
67      /**
68       * Setter for value property.
69       *
70       * @param value
71       * The value of the attribute. Use this parameter, or
72       * expression, or body.
73       */
74      public void setValue(java.lang.Object value) {
75          this.value = value;
76      }
77  
78      /**
79       * Getter for expression property.
80       *
81       * @return
82       * The expression to calculate the value from. Use this
83       * parameter, or value, or body.
84       */
85      public java.lang.String getExpression() {
86          return expression;
87      }
88  
89      /**
90       * Setter for expression property.
91       *
92       * @param expression
93       * The expression to calculate the value from. Use this
94       * parameter, or value, or body.
95       */
96      public void setExpression(java.lang.String expression) {
97          this.expression = expression;
98      }
99  
100     /**
101      * Getter for role property.
102      *
103      * @return
104      * A comma-separated list of roles. If present, the attribute
105      * will be rendered only if the current user belongs to one of the roles.
106      */
107     public java.lang.String getRole() {
108         return role;
109     }
110 
111     /**
112      * Setter for role property.
113      *
114      * @param role
115      * A comma-separated list of roles. If present, the attribute
116      * will be rendered only if the current user belongs to one of the roles.
117      */
118     public void setRole(java.lang.String role) {
119         this.role = role;
120     }
121 
122     /**
123      * Getter for type property.
124      *
125      * @return
126      * The type (renderer) of the attribute.
127      */
128     public java.lang.String getType() {
129         return type;
130     }
131 
132     /**
133      * Setter for type property.
134      *
135      * @param type
136      * The type (renderer) of the attribute.
137      */
138     public void setType(java.lang.String type) {
139         this.type = type;
140     }
141 
142     /** {@inheritDoc} */
143     @Override
144     public void doTag() throws JspException, IOException {
145         AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.jsp.autotag.JspAutotagRuntime();
146         if (runtime instanceof SimpleTagSupport) {
147             SimpleTagSupport tag = (SimpleTagSupport) runtime;
148             tag.setJspContext(getJspContext());
149             tag.setJspBody(getJspBody());
150             tag.setParent(getParent());
151             tag.doTag();
152         }
153         org.apache.tiles.request.Request request = runtime.createRequest();        
154         ModelBody modelBody = runtime.createModelBody();
155         model.execute(
156             value,
157             expression,
158             role,
159             type,
160             request, modelBody
161         );
162     }
163 }