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