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