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.myfaces.tobago.component.UIButton;
26  import org.apache.myfaces.tobago.internal.util.StringUtils;
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.ButtonTagDeclaration}.
33   */
34  public final class ButtonTag extends TobagoELTag {
35    private static final Logger LOG = LoggerFactory.getLogger(ButtonTag.class);
36    private javax.el.MethodExpression  actionListener;
37    private javax.el.ValueExpression  accessKey;
38    private javax.el.ValueExpression  markup;
39    private javax.el.ValueExpression  link;
40    private javax.el.ValueExpression  labelWithAccessKey;
41    private javax.el.ValueExpression  defaultCommand;
42    private javax.el.ValueExpression  tabIndex;
43    private javax.el.ValueExpression  tip;
44    private javax.el.ValueExpression  inline;
45    private javax.el.MethodExpression  action;
46    private javax.el.ValueExpression  jsfResource;
47    private javax.el.ValueExpression  resource;
48    private javax.el.ValueExpression  transition;
49    private javax.el.ValueExpression  image;
50    private javax.el.ValueExpression  label;
51    private javax.el.ValueExpression  immediate;
52    private javax.el.ValueExpression  omit;
53    private javax.el.ValueExpression  renderedPartially;
54    private javax.el.ValueExpression  target;
55    private javax.el.ValueExpression  onclick;
56    private javax.el.ValueExpression  disabled;
57  
58    @Override
59    public String getComponentType() {
60      return UIButton.COMPONENT_TYPE;
61    }
62    @Override
63    public String getRendererType() {
64      return "Button";
65    }
66  
67    @Override
68    protected void setProperties(final UIComponent uiComponent) {
69      super.setProperties(uiComponent);
70      final UIButton component = (UIButton) uiComponent;
71      final FacesContext context = FacesContext.getCurrentInstance();
72      final Application application = context.getApplication();
73      if (actionListener != null) {
74        component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
75      }
76      if (accessKey != null) {
77        if (!accessKey.isLiteralText()) {
78          component.setValueExpression("accessKey", accessKey);
79        } else {
80          component.setAccessKey(accessKey.getExpressionString().charAt(0));
81        }
82      }
83      if (markup != null) {
84        if (!markup.isLiteralText()) {
85          component.setValueExpression("markup", markup);
86        } else {
87          component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
88        }
89      }
90      if (link != null) {
91        component.setValueExpression("link", link);
92      }
93  
94      if (labelWithAccessKey != null) {
95        component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
96      }
97  
98      if (defaultCommand != null) {
99        if (!defaultCommand.isLiteralText()) {
100         component.setValueExpression("defaultCommand", defaultCommand);
101       } else {
102         component.setDefaultCommand(Boolean.parseBoolean(defaultCommand.getExpressionString()));
103       }
104     }
105     if (tabIndex != null) {
106       if (!tabIndex.isLiteralText()) {
107         component.setValueExpression("tabIndex", tabIndex);
108       } else {
109         component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
110       }
111     }
112     if (tip != null) {
113       component.setValueExpression("tip", tip);
114     }
115 
116     if (inline != null) {
117       if (!inline.isLiteralText()) {
118         component.setValueExpression("inline", inline);
119       } else {
120         component.setInline(Boolean.parseBoolean(inline.getExpressionString()));
121       }
122     }
123     if (action != null) {
124       component.setActionExpression(action);
125     }
126     if (jsfResource != null) {
127       if (!jsfResource.isLiteralText()) {
128         component.setValueExpression("jsfResource", jsfResource);
129       } else {
130         component.setJsfResource(Boolean.parseBoolean(jsfResource.getExpressionString()));
131       }
132     }
133     if (resource != null) {
134       component.setValueExpression("resource", resource);
135     }
136 
137     if (transition != null) {
138       if (!transition.isLiteralText()) {
139         component.setValueExpression("transition", transition);
140       } else {
141         component.setTransition(Boolean.parseBoolean(transition.getExpressionString()));
142       }
143     }
144     if (image != null) {
145       component.setValueExpression("image", image);
146     }
147 
148     if (label != null) {
149       component.setValueExpression("label", label);
150     }
151 
152     if (immediate != null) {
153       if (!immediate.isLiteralText()) {
154         component.setValueExpression("immediate", immediate);
155       } else {
156         component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
157       }
158     }
159     if (omit != null) {
160       if (!omit.isLiteralText()) {
161         component.setValueExpression("omit", omit);
162       } else {
163         component.setOmit(Boolean.parseBoolean(omit.getExpressionString()));
164       }
165     }
166     if (renderedPartially != null) {
167       if (!renderedPartially.isLiteralText()) {
168         component.setValueExpression("renderedPartially", renderedPartially);
169       } else {
170         component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
171       }
172     }
173     if (target != null) {
174       component.setValueExpression("target", target);
175     }
176 
177     if (onclick != null) {
178       component.setValueExpression("onclick", onclick);
179     }
180 
181     if (disabled != null) {
182       if (!disabled.isLiteralText()) {
183         component.setValueExpression("disabled", disabled);
184       } else {
185         component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
186       }
187     }
188   }
189 
190   public javax.el.MethodExpression getActionListener() {
191     return actionListener;
192   }
193 
194   public void setActionListener(final javax.el.MethodExpression actionListener) {
195     this.actionListener = actionListener;
196   }
197 
198   public javax.el.ValueExpression getAccessKey() {
199     return accessKey;
200   }
201 
202   public void setAccessKey(final javax.el.ValueExpression accessKey) {
203     this.accessKey = accessKey;
204   }
205 
206   public javax.el.ValueExpression getMarkup() {
207     return markup;
208   }
209 
210   public void setMarkup(final javax.el.ValueExpression markup) {
211     this.markup = markup;
212   }
213 
214   public javax.el.ValueExpression getLink() {
215     return link;
216   }
217 
218   public void setLink(final javax.el.ValueExpression link) {
219     this.link = link;
220   }
221 
222   public javax.el.ValueExpression getLabelWithAccessKey() {
223     return labelWithAccessKey;
224   }
225 
226   public void setLabelWithAccessKey(final javax.el.ValueExpression labelWithAccessKey) {
227     this.labelWithAccessKey = labelWithAccessKey;
228   }
229 
230   public javax.el.ValueExpression getDefaultCommand() {
231     return defaultCommand;
232   }
233 
234   public void setDefaultCommand(final javax.el.ValueExpression defaultCommand) {
235     this.defaultCommand = defaultCommand;
236   }
237 
238   public javax.el.ValueExpression getTabIndex() {
239     return tabIndex;
240   }
241 
242   public void setTabIndex(final javax.el.ValueExpression tabIndex) {
243     this.tabIndex = tabIndex;
244   }
245 
246   public javax.el.ValueExpression getTip() {
247     return tip;
248   }
249 
250   public void setTip(final javax.el.ValueExpression tip) {
251     this.tip = tip;
252   }
253 
254   public javax.el.ValueExpression getInline() {
255     return inline;
256   }
257 
258   public void setInline(final javax.el.ValueExpression inline) {
259     this.inline = inline;
260   }
261 
262   public javax.el.MethodExpression getAction() {
263     return action;
264   }
265 
266   public void setAction(final javax.el.MethodExpression action) {
267     this.action = action;
268   }
269 
270   public javax.el.ValueExpression getJsfResource() {
271     return jsfResource;
272   }
273 
274   public void setJsfResource(final javax.el.ValueExpression jsfResource) {
275     this.jsfResource = jsfResource;
276   }
277 
278   public javax.el.ValueExpression getResource() {
279     return resource;
280   }
281 
282   public void setResource(final javax.el.ValueExpression resource) {
283     this.resource = resource;
284   }
285 
286   public javax.el.ValueExpression getTransition() {
287     return transition;
288   }
289 
290   public void setTransition(final javax.el.ValueExpression transition) {
291     this.transition = transition;
292   }
293 
294   public javax.el.ValueExpression getImage() {
295     return image;
296   }
297 
298   public void setImage(final javax.el.ValueExpression image) {
299     this.image = image;
300   }
301 
302   public javax.el.ValueExpression getLabel() {
303     return label;
304   }
305 
306   public void setLabel(final javax.el.ValueExpression label) {
307     this.label = label;
308   }
309 
310   public javax.el.ValueExpression getImmediate() {
311     return immediate;
312   }
313 
314   public void setImmediate(final javax.el.ValueExpression immediate) {
315     this.immediate = immediate;
316   }
317 
318   public javax.el.ValueExpression getOmit() {
319     return omit;
320   }
321 
322   public void setOmit(final javax.el.ValueExpression omit) {
323     this.omit = omit;
324   }
325 
326   public javax.el.ValueExpression getRenderedPartially() {
327     return renderedPartially;
328   }
329 
330   public void setRenderedPartially(final javax.el.ValueExpression renderedPartially) {
331     this.renderedPartially = renderedPartially;
332   }
333 
334   public javax.el.ValueExpression getTarget() {
335     return target;
336   }
337 
338   public void setTarget(final javax.el.ValueExpression target) {
339     this.target = target;
340   }
341 
342   public javax.el.ValueExpression getOnclick() {
343     return onclick;
344   }
345 
346   public void setOnclick(final javax.el.ValueExpression onclick) {
347     this.onclick = onclick;
348   }
349 
350   public javax.el.ValueExpression getDisabled() {
351     return disabled;
352   }
353 
354   public void setDisabled(final javax.el.ValueExpression disabled) {
355     this.disabled = disabled;
356   }
357 
358 
359 
360   @Override
361   public void release() {
362     super.release();
363     actionListener = null;
364     accessKey = null;
365     markup = null;
366     link = null;
367     labelWithAccessKey = null;
368     defaultCommand = null;
369     tabIndex = null;
370     tip = null;
371     inline = null;
372     action = null;
373     jsfResource = null;
374     resource = null;
375     transition = null;
376     image = null;
377     label = null;
378     immediate = null;
379     omit = null;
380     renderedPartially = null;
381     target = null;
382     onclick = null;
383     disabled = null;
384   }
385 }