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.UICommand;
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.CommandTagDeclaration}.
33   */
34  public final class CommandTag extends TobagoELTag {
35    private static final Logger LOG = LoggerFactory.getLogger(CommandTag.class);
36    private javax.el.MethodExpression  actionListener;
37    private javax.el.ValueExpression  markup;
38    private javax.el.ValueExpression  link;
39    private javax.el.MethodExpression  action;
40    private javax.el.ValueExpression  value;
41    private javax.el.ValueExpression  jsfResource;
42    private javax.el.ValueExpression  resource;
43    private javax.el.ValueExpression  transition;
44    private javax.el.ValueExpression  immediate;
45    private javax.el.ValueExpression  omit;
46    private javax.el.ValueExpression  renderedPartially;
47    private javax.el.ValueExpression  target;
48    private javax.el.ValueExpression  onclick;
49    private javax.el.ValueExpression  disabled;
50  
51    @Override
52    public String getComponentType() {
53      return UICommand.COMPONENT_TYPE;
54    }
55    @Override
56    public String getRendererType() {
57      return "Command";
58    }
59  
60    @Override
61    protected void setProperties(final UIComponent uiComponent) {
62      super.setProperties(uiComponent);
63      final UICommand component = (UICommand) uiComponent;
64      final FacesContext context = FacesContext.getCurrentInstance();
65      final Application application = context.getApplication();
66      if (actionListener != null) {
67        component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
68      }
69      if (markup != null) {
70        if (!markup.isLiteralText()) {
71          component.setValueExpression("markup", markup);
72        } else {
73          component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
74        }
75      }
76      if (link != null) {
77        component.setValueExpression("link", link);
78      }
79  
80      if (action != null) {
81        component.setActionExpression(action);
82      }
83      if (value != null) {
84        component.setValueExpression("value", value);
85      }
86  
87      if (jsfResource != null) {
88        if (!jsfResource.isLiteralText()) {
89          component.setValueExpression("jsfResource", jsfResource);
90        } else {
91          component.setJsfResource(Boolean.parseBoolean(jsfResource.getExpressionString()));
92        }
93      }
94      if (resource != null) {
95        component.setValueExpression("resource", resource);
96      }
97  
98      if (transition != null) {
99        if (!transition.isLiteralText()) {
100         component.setValueExpression("transition", transition);
101       } else {
102         component.setTransition(Boolean.parseBoolean(transition.getExpressionString()));
103       }
104     }
105     if (immediate != null) {
106       if (!immediate.isLiteralText()) {
107         component.setValueExpression("immediate", immediate);
108       } else {
109         component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
110       }
111     }
112     if (omit != null) {
113       if (!omit.isLiteralText()) {
114         component.setValueExpression("omit", omit);
115       } else {
116         component.setOmit(Boolean.parseBoolean(omit.getExpressionString()));
117       }
118     }
119     if (renderedPartially != null) {
120       if (!renderedPartially.isLiteralText()) {
121         component.setValueExpression("renderedPartially", renderedPartially);
122       } else {
123         component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
124       }
125     }
126     if (target != null) {
127       component.setValueExpression("target", target);
128     }
129 
130     if (onclick != null) {
131       component.setValueExpression("onclick", onclick);
132     }
133 
134     if (disabled != null) {
135       if (!disabled.isLiteralText()) {
136         component.setValueExpression("disabled", disabled);
137       } else {
138         component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
139       }
140     }
141   }
142 
143   public javax.el.MethodExpression getActionListener() {
144     return actionListener;
145   }
146 
147   public void setActionListener(final javax.el.MethodExpression actionListener) {
148     this.actionListener = actionListener;
149   }
150 
151   public javax.el.ValueExpression getMarkup() {
152     return markup;
153   }
154 
155   public void setMarkup(final javax.el.ValueExpression markup) {
156     this.markup = markup;
157   }
158 
159   public javax.el.ValueExpression getLink() {
160     return link;
161   }
162 
163   public void setLink(final javax.el.ValueExpression link) {
164     this.link = link;
165   }
166 
167   public javax.el.MethodExpression getAction() {
168     return action;
169   }
170 
171   public void setAction(final javax.el.MethodExpression action) {
172     this.action = action;
173   }
174 
175   public javax.el.ValueExpression getValue() {
176     return value;
177   }
178 
179   public void setValue(final javax.el.ValueExpression value) {
180     this.value = value;
181   }
182 
183   public javax.el.ValueExpression getJsfResource() {
184     return jsfResource;
185   }
186 
187   public void setJsfResource(final javax.el.ValueExpression jsfResource) {
188     this.jsfResource = jsfResource;
189   }
190 
191   public javax.el.ValueExpression getResource() {
192     return resource;
193   }
194 
195   public void setResource(final javax.el.ValueExpression resource) {
196     this.resource = resource;
197   }
198 
199   public javax.el.ValueExpression getTransition() {
200     return transition;
201   }
202 
203   public void setTransition(final javax.el.ValueExpression transition) {
204     this.transition = transition;
205   }
206 
207   public javax.el.ValueExpression getImmediate() {
208     return immediate;
209   }
210 
211   public void setImmediate(final javax.el.ValueExpression immediate) {
212     this.immediate = immediate;
213   }
214 
215   public javax.el.ValueExpression getOmit() {
216     return omit;
217   }
218 
219   public void setOmit(final javax.el.ValueExpression omit) {
220     this.omit = omit;
221   }
222 
223   public javax.el.ValueExpression getRenderedPartially() {
224     return renderedPartially;
225   }
226 
227   public void setRenderedPartially(final javax.el.ValueExpression renderedPartially) {
228     this.renderedPartially = renderedPartially;
229   }
230 
231   public javax.el.ValueExpression getTarget() {
232     return target;
233   }
234 
235   public void setTarget(final javax.el.ValueExpression target) {
236     this.target = target;
237   }
238 
239   public javax.el.ValueExpression getOnclick() {
240     return onclick;
241   }
242 
243   public void setOnclick(final javax.el.ValueExpression onclick) {
244     this.onclick = onclick;
245   }
246 
247   public javax.el.ValueExpression getDisabled() {
248     return disabled;
249   }
250 
251   public void setDisabled(final javax.el.ValueExpression disabled) {
252     this.disabled = disabled;
253   }
254 
255 
256 
257   @Override
258   public void release() {
259     super.release();
260     actionListener = null;
261     markup = null;
262     link = null;
263     action = null;
264     value = null;
265     jsfResource = null;
266     resource = null;
267     transition = null;
268     immediate = null;
269     omit = null;
270     renderedPartially = null;
271     target = null;
272     onclick = null;
273     disabled = null;
274   }
275 }