View Javadoc

1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.myfaces.tobago.internal.taglib;
21  
22  import javax.faces.application.Application;
23  import javax.faces.component.UIComponent;
24  import javax.faces.context.FacesContext;
25  import org.apache.commons.lang.StringUtils;
26  import org.apache.myfaces.tobago.component.UIMenuItem;
27  import org.slf4j.Logger;
28  import org.slf4j.LoggerFactory;
29  
30  /** 
31   * JSP Tag class, generated from template {@code tag1.2.stg} with class 
32   * {@link org.apache.myfaces.tobago.internal.taglib.component.MenuItemTagDeclaration}.
33   */
34  public final class MenuItemTag extends TobagoELTag {
35    private static final Logger LOG = LoggerFactory.getLogger(MenuItemTag.class);
36    private javax.el.MethodExpression  actionListener;
37    private javax.el.ValueExpression  accessKey;
38    private javax.el.ValueExpression  link;
39    private javax.el.ValueExpression  labelWithAccessKey;
40    private javax.el.ValueExpression  jsfResource;
41    private javax.el.ValueExpression  resource;
42    private javax.el.ValueExpression  image;
43    private javax.el.ValueExpression  transition;
44    private javax.el.ValueExpression  label;
45    private javax.el.ValueExpression  immediate;
46    private javax.el.MethodExpression  action;
47    private javax.el.ValueExpression  target;
48    private javax.el.ValueExpression  renderedPartially;
49    private javax.el.ValueExpression  onclick;
50    private javax.el.ValueExpression  disabled;
51  
52    @Override
53    public String getComponentType() {
54      return UIMenuItem.COMPONENT_TYPE;
55    }
56    @Override
57    public String getRendererType() {
58      return "MenuCommand";
59    }
60  
61    @Override
62    protected void setProperties(final UIComponent uiComponent) {
63      super.setProperties(uiComponent);
64      final UIMenuItem component = (UIMenuItem) uiComponent;
65      final FacesContext context = FacesContext.getCurrentInstance();
66      final Application application = context.getApplication();
67      if (actionListener != null) {
68        component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
69      }
70      if (accessKey != null) {
71        if (!accessKey.isLiteralText()) {
72          component.setValueExpression("accessKey", accessKey);
73        } else {
74          component.setAccessKey(accessKey.getExpressionString().charAt(0));
75        }
76      }
77      if (link != null) {
78        component.setValueExpression("link", link);
79      }
80  
81      if (labelWithAccessKey != null) {
82        component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
83      }
84  
85      if (jsfResource != null) {
86        if (!jsfResource.isLiteralText()) {
87          component.setValueExpression("jsfResource", jsfResource);
88        } else {
89          component.setJsfResource(Boolean.parseBoolean(jsfResource.getExpressionString()));
90        }
91      }
92      if (resource != null) {
93        component.setValueExpression("resource", resource);
94      }
95  
96      if (image != null) {
97        component.setValueExpression("image", image);
98      }
99  
100     if (transition != null) {
101       if (!transition.isLiteralText()) {
102         component.setValueExpression("transition", transition);
103       } else {
104         component.setTransition(Boolean.parseBoolean(transition.getExpressionString()));
105       }
106     }
107     if (label != null) {
108       component.setValueExpression("label", label);
109     }
110 
111     if (immediate != null) {
112       if (!immediate.isLiteralText()) {
113         component.setValueExpression("immediate", immediate);
114       } else {
115         component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
116       }
117     }
118     if (action != null) {
119       component.setActionExpression(action);
120     }
121     if (target != null) {
122       component.setValueExpression("target", target);
123     }
124 
125     if (renderedPartially != null) {
126       if (!renderedPartially.isLiteralText()) {
127         component.setValueExpression("renderedPartially", renderedPartially);
128       } else {
129         component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
130       }
131     }
132     if (onclick != null) {
133       component.setValueExpression("onclick", onclick);
134     }
135 
136     if (disabled != null) {
137       if (!disabled.isLiteralText()) {
138         component.setValueExpression("disabled", disabled);
139       } else {
140         component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
141       }
142     }
143   }
144 
145   public javax.el.MethodExpression getActionListener() {
146     return actionListener;
147   }
148 
149   public void setActionListener(final javax.el.MethodExpression actionListener) {
150     this.actionListener = actionListener;
151   }
152 
153   public javax.el.ValueExpression getAccessKey() {
154     return accessKey;
155   }
156 
157   public void setAccessKey(final javax.el.ValueExpression accessKey) {
158     this.accessKey = accessKey;
159   }
160 
161   public javax.el.ValueExpression getLink() {
162     return link;
163   }
164 
165   public void setLink(final javax.el.ValueExpression link) {
166     this.link = link;
167   }
168 
169   public javax.el.ValueExpression getLabelWithAccessKey() {
170     return labelWithAccessKey;
171   }
172 
173   public void setLabelWithAccessKey(final javax.el.ValueExpression labelWithAccessKey) {
174     this.labelWithAccessKey = labelWithAccessKey;
175   }
176 
177   public javax.el.ValueExpression getJsfResource() {
178     return jsfResource;
179   }
180 
181   public void setJsfResource(final javax.el.ValueExpression jsfResource) {
182     this.jsfResource = jsfResource;
183   }
184 
185   public javax.el.ValueExpression getResource() {
186     return resource;
187   }
188 
189   public void setResource(final javax.el.ValueExpression resource) {
190     this.resource = resource;
191   }
192 
193   public javax.el.ValueExpression getImage() {
194     return image;
195   }
196 
197   public void setImage(final javax.el.ValueExpression image) {
198     this.image = image;
199   }
200 
201   public javax.el.ValueExpression getTransition() {
202     return transition;
203   }
204 
205   public void setTransition(final javax.el.ValueExpression transition) {
206     this.transition = transition;
207   }
208 
209   public javax.el.ValueExpression getLabel() {
210     return label;
211   }
212 
213   public void setLabel(final javax.el.ValueExpression label) {
214     this.label = label;
215   }
216 
217   public javax.el.ValueExpression getImmediate() {
218     return immediate;
219   }
220 
221   public void setImmediate(final javax.el.ValueExpression immediate) {
222     this.immediate = immediate;
223   }
224 
225   public javax.el.MethodExpression getAction() {
226     return action;
227   }
228 
229   public void setAction(final javax.el.MethodExpression action) {
230     this.action = action;
231   }
232 
233   public javax.el.ValueExpression getTarget() {
234     return target;
235   }
236 
237   public void setTarget(final javax.el.ValueExpression target) {
238     this.target = target;
239   }
240 
241   public javax.el.ValueExpression getRenderedPartially() {
242     return renderedPartially;
243   }
244 
245   public void setRenderedPartially(final javax.el.ValueExpression renderedPartially) {
246     this.renderedPartially = renderedPartially;
247   }
248 
249   public javax.el.ValueExpression getOnclick() {
250     return onclick;
251   }
252 
253   public void setOnclick(final javax.el.ValueExpression onclick) {
254     this.onclick = onclick;
255   }
256 
257   public javax.el.ValueExpression getDisabled() {
258     return disabled;
259   }
260 
261   public void setDisabled(final javax.el.ValueExpression disabled) {
262     this.disabled = disabled;
263   }
264 
265 
266 
267   @Override
268   public void release() {
269     super.release();
270     actionListener = null;
271     accessKey = null;
272     link = null;
273     labelWithAccessKey = null;
274     jsfResource = null;
275     resource = null;
276     image = null;
277     transition = null;
278     label = null;
279     immediate = null;
280     action = null;
281     target = null;
282     renderedPartially = null;
283     onclick = null;
284     disabled = null;
285   }
286 }