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