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.UIFile;
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.FileTagDeclaration}.
33   */
34  public final class FileTag extends TobagoELTag {
35    private static final Logger LOG = LoggerFactory.getLogger(FileTag.class);
36    private javax.el.ValueExpression  validatorMessage;
37    private javax.el.ValueExpression  markup;
38    private javax.el.ValueExpression  accessKey;
39    private javax.el.ValueExpression  labelWithAccessKey;
40    private javax.el.MethodExpression  validator;
41    private javax.el.ValueExpression  tabIndex;
42    private javax.el.ValueExpression  tip;
43    private javax.el.MethodExpression  valueChangeListener;
44    private javax.el.ValueExpression  value;
45    private javax.el.ValueExpression  focus;
46    private javax.el.ValueExpression  required;
47    private javax.el.ValueExpression  converterMessage;
48    private javax.el.ValueExpression  label;
49    private javax.el.ValueExpression  requiredMessage;
50    private javax.el.ValueExpression  onchange;
51    private javax.el.ValueExpression  readonly;
52    private javax.el.ValueExpression  disabled;
53  
54    @Override
55    public String getComponentType() {
56      return UIFile.COMPONENT_TYPE;
57    }
58    @Override
59    public String getRendererType() {
60      return "File";
61    }
62  
63    @Override
64    protected void setProperties(final UIComponent uiComponent) {
65      super.setProperties(uiComponent);
66      final UIFile component = (UIFile) uiComponent;
67      final FacesContext context = FacesContext.getCurrentInstance();
68      final Application application = context.getApplication();
69      if (validatorMessage != null) {
70        component.setValueExpression("validatorMessage", validatorMessage);
71      }
72  
73      if (markup != null) {
74        if (!markup.isLiteralText()) {
75          component.setValueExpression("markup", markup);
76        } else {
77          component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
78        }
79      }
80      if (accessKey != null) {
81        if (!accessKey.isLiteralText()) {
82          component.setValueExpression("accessKey", accessKey);
83        } else {
84          component.setAccessKey(accessKey.getExpressionString().charAt(0));
85        }
86      }
87      if (labelWithAccessKey != null) {
88        component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
89      }
90  
91      if (validator != null) {
92        component.addValidator(new javax.faces.validator.MethodExpressionValidator(validator));
93      }
94      if (tabIndex != null) {
95        if (!tabIndex.isLiteralText()) {
96          component.setValueExpression("tabIndex", tabIndex);
97        } else {
98          component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
99        }
100     }
101     if (tip != null) {
102       component.setValueExpression("tip", tip);
103     }
104 
105     if (valueChangeListener != null) {
106       component.addValueChangeListener(new javax.faces.event.MethodExpressionValueChangeListener(valueChangeListener));
107     }
108     if (value != null) {
109       if (!value.isLiteralText()) {
110         component.setValueExpression("value", value);
111       /*} else {
112         component.setValue(value.getExpressionString());*/
113       }
114     }
115     if (focus != null) {
116       if (!focus.isLiteralText()) {
117         component.setValueExpression("focus", focus);
118       } else {
119         component.setFocus(Boolean.parseBoolean(focus.getExpressionString()));
120       }
121     }
122     if (required != null) {
123       if (!required.isLiteralText()) {
124         component.setValueExpression("required", required);
125       } else {
126         component.setRequired(Boolean.parseBoolean(required.getExpressionString()));
127       }
128     }
129     if (converterMessage != null) {
130       component.setValueExpression("converterMessage", converterMessage);
131     }
132 
133     if (label != null) {
134       component.setValueExpression("label", label);
135     }
136 
137     if (requiredMessage != null) {
138       component.setValueExpression("requiredMessage", requiredMessage);
139     }
140 
141     if (onchange != null) {
142       component.setValueExpression("onchange", onchange);
143     }
144 
145     if (readonly != null) {
146       if (!readonly.isLiteralText()) {
147         component.setValueExpression("readonly", readonly);
148       } else {
149         component.setReadonly(Boolean.parseBoolean(readonly.getExpressionString()));
150       }
151     }
152     if (disabled != null) {
153       if (!disabled.isLiteralText()) {
154         component.setValueExpression("disabled", disabled);
155       } else {
156         component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
157       }
158     }
159   }
160 
161   public javax.el.ValueExpression getValidatorMessage() {
162     return validatorMessage;
163   }
164 
165   public void setValidatorMessage(final javax.el.ValueExpression validatorMessage) {
166     this.validatorMessage = validatorMessage;
167   }
168 
169   public javax.el.ValueExpression getMarkup() {
170     return markup;
171   }
172 
173   public void setMarkup(final javax.el.ValueExpression markup) {
174     this.markup = markup;
175   }
176 
177   public javax.el.ValueExpression getAccessKey() {
178     return accessKey;
179   }
180 
181   public void setAccessKey(final javax.el.ValueExpression accessKey) {
182     this.accessKey = accessKey;
183   }
184 
185   public javax.el.ValueExpression getLabelWithAccessKey() {
186     return labelWithAccessKey;
187   }
188 
189   public void setLabelWithAccessKey(final javax.el.ValueExpression labelWithAccessKey) {
190     this.labelWithAccessKey = labelWithAccessKey;
191   }
192 
193   public javax.el.MethodExpression getValidator() {
194     return validator;
195   }
196 
197   public void setValidator(final javax.el.MethodExpression validator) {
198     this.validator = validator;
199   }
200 
201   public javax.el.ValueExpression getTabIndex() {
202     return tabIndex;
203   }
204 
205   public void setTabIndex(final javax.el.ValueExpression tabIndex) {
206     this.tabIndex = tabIndex;
207   }
208 
209   public javax.el.ValueExpression getTip() {
210     return tip;
211   }
212 
213   public void setTip(final javax.el.ValueExpression tip) {
214     this.tip = tip;
215   }
216 
217   public javax.el.MethodExpression getValueChangeListener() {
218     return valueChangeListener;
219   }
220 
221   public void setValueChangeListener(final javax.el.MethodExpression valueChangeListener) {
222     this.valueChangeListener = valueChangeListener;
223   }
224 
225   public javax.el.ValueExpression getValue() {
226     return value;
227   }
228 
229   public void setValue(final javax.el.ValueExpression value) {
230     this.value = value;
231   }
232 
233   public javax.el.ValueExpression getFocus() {
234     return focus;
235   }
236 
237   public void setFocus(final javax.el.ValueExpression focus) {
238     this.focus = focus;
239   }
240 
241   public javax.el.ValueExpression getRequired() {
242     return required;
243   }
244 
245   public void setRequired(final javax.el.ValueExpression required) {
246     this.required = required;
247   }
248 
249   public javax.el.ValueExpression getConverterMessage() {
250     return converterMessage;
251   }
252 
253   public void setConverterMessage(final javax.el.ValueExpression converterMessage) {
254     this.converterMessage = converterMessage;
255   }
256 
257   public javax.el.ValueExpression getLabel() {
258     return label;
259   }
260 
261   public void setLabel(final javax.el.ValueExpression label) {
262     this.label = label;
263   }
264 
265   public javax.el.ValueExpression getRequiredMessage() {
266     return requiredMessage;
267   }
268 
269   public void setRequiredMessage(final javax.el.ValueExpression requiredMessage) {
270     this.requiredMessage = requiredMessage;
271   }
272 
273   public javax.el.ValueExpression getOnchange() {
274     return onchange;
275   }
276 
277   public void setOnchange(final javax.el.ValueExpression onchange) {
278     this.onchange = onchange;
279   }
280 
281   public javax.el.ValueExpression getReadonly() {
282     return readonly;
283   }
284 
285   public void setReadonly(final javax.el.ValueExpression readonly) {
286     this.readonly = readonly;
287   }
288 
289   public javax.el.ValueExpression getDisabled() {
290     return disabled;
291   }
292 
293   public void setDisabled(final javax.el.ValueExpression disabled) {
294     this.disabled = disabled;
295   }
296 
297 
298 
299   @Override
300   public void release() {
301     super.release();
302     validatorMessage = null;
303     markup = null;
304     accessKey = null;
305     labelWithAccessKey = null;
306     validator = null;
307     tabIndex = null;
308     tip = null;
309     valueChangeListener = null;
310     value = null;
311     focus = null;
312     required = null;
313     converterMessage = null;
314     label = null;
315     requiredMessage = null;
316     onchange = null;
317     readonly = null;
318     disabled = null;
319   }
320 }