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