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.component;
21  
22  import javax.faces.context.FacesContext;
23  import org.apache.myfaces.tobago.context.Markup;
24  import org.apache.myfaces.tobago.internal.component.AbstractUISelectOneListbox;
25  import org.apache.myfaces.tobago.layout.Display;
26  import org.apache.myfaces.tobago.layout.Measure;
27  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
28  import org.apache.myfaces.tobago.internal.util.StringUtils;
29  import org.apache.myfaces.tobago.internal.util.Deprecation;
30  import org.apache.myfaces.tobago.renderkit.MarginValues;
31  import org.apache.myfaces.tobago.renderkit.SpacingValues;
32  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.ArrayList;
36  import java.util.List;
37  import javax.el.MethodExpression;
38  import javax.el.ValueExpression;
39  
40  /** 
41   Render a single selection option listbox.
42    * UIComponent class, generated from template {@code component2.0.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectOneListboxTagDeclaration}.
44   */
45  public class UISelectOneListbox
46      extends AbstractUISelectOneListbox implements SupportsMarkup {
47  
48    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SelectOneListbox";
49  
50    public static final String COMPONENT_FAMILY = "javax.faces.SelectOne";
51  
52    private org.apache.myfaces.tobago.context.Markup currentMarkup;
53  
54    enum PropertyKeys {
55      accessKey,
56      markup,
57      marginLeft,
58      labelWithAccessKey,
59      tabIndex,
60      minimumHeight,
61      tip,
62      height,
63      minimumWidth,
64      rowSpan,
65      focus,
66      left,
67      columnSpan,
68      top,
69      maximumHeight,
70      currentWidth,
71      marginTop,
72      width,
73      marginRight,
74      currentHeight,
75      preferredHeight,
76      label,
77      display,
78      maximumWidth,
79      onchange,
80      preferredWidth,
81      marginBottom,
82      verticalIndex,
83      horizontalIndex,
84      readonly,
85      disabled,
86    }
87  
88    public String getFamily() {
89      return COMPONENT_FAMILY;
90    }
91  
92  
93    /**
94    Deprecated! Has not longer any function.
95  
96    @deprecated*/
97    @Deprecated
98    public java.lang.Character getAccessKey() {
99      return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
100   }
101 
102   @Deprecated
103   public void setAccessKey(java.lang.Character accessKey) {
104       Deprecation.LOG.error("The attribute 'accessKey' of 'UISelectOneListbox' is deprecated. "
105           + "Please refer the documentation for further information.");
106     getStateHelper().put(PropertyKeys.accessKey, accessKey);
107   }
108 
109   public org.apache.myfaces.tobago.context.Markup getMarkup() {
110     Object object = getStateHelper().eval(PropertyKeys.markup);
111     if (object != null) {
112       return Markup.valueOf(object);
113     }
114     return null;
115   }
116 
117   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
118     getStateHelper().put(PropertyKeys.markup, markup);
119   }
120 
121   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
122     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
123     if (object != null) {
124        return Measure.valueOf(object);
125     }
126     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
127   }
128 
129   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
130     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
131   }
132 
133   /**
134   Deprecated! Use 'label' instead.
135    Text value to display as label.
136    If text contains an underscore the next character overwrites 'accesskey'.
137 
138   @deprecated*/
139   @Deprecated
140   public java.lang.String getLabelWithAccessKey() {
141     return (java.lang.String) getStateHelper().eval(PropertyKeys.labelWithAccessKey);
142   }
143 
144   @Deprecated
145   public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) {
146       Deprecation.LOG.error("The attribute 'labelWithAccessKey' of 'UISelectOneListbox' is deprecated. "
147           + "Please refer the documentation for further information.");
148     getStateHelper().put(PropertyKeys.labelWithAccessKey, labelWithAccessKey);
149   }
150 
151   /**
152   Controls the navigation of the focus through the
153    input controls on a page with the Tab-Key.
154    The navigation starts from the element with
155    the lowest tabIndex value to the element with the highest value.
156    Elements that have identical tabIndex values should be navigated
157    in the order they appear in the character stream
158    Elements that are disabled or with a negative tabIndex
159    do not participate in the tabbing order.
160 
161   */
162   public java.lang.Integer getTabIndex() {
163     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
164     if (value != null) {
165       return value.intValue();
166     }
167     return null;
168   }
169 
170   public void setTabIndex(java.lang.Integer tabIndex) {
171     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
172   }
173 
174   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
175     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
176     if (object != null) {
177        return Measure.valueOf(object);
178     }
179     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
180   }
181 
182   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
183     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
184   }
185 
186   /**
187   Text value to display as tooltip.
188 
189   */
190   public java.lang.String getTip() {
191     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
192   }
193 
194   public void setTip(java.lang.String tip) {
195     getStateHelper().put(PropertyKeys.tip, tip);
196   }
197 
198   /**
199   This value will usually be set by the layout manager.
200 
201   */
202   public org.apache.myfaces.tobago.layout.Measure getHeight() {
203     Object object = getStateHelper().eval(PropertyKeys.height);
204     if (object != null) {
205        return Measure.valueOf(object);
206     }
207     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
208   }
209 
210   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
211     getStateHelper().put(PropertyKeys.height, height);
212   }
213 
214   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
215     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
216     if (object != null) {
217        return Measure.valueOf(object);
218     }
219     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
220   }
221 
222   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
223     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
224   }
225 
226   public java.lang.Integer getRowSpan() {
227     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
228     if (value != null) {
229       return value.intValue();
230     }
231     return 1;
232   }
233 
234   public void setRowSpan(java.lang.Integer rowSpan) {
235     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
236   }
237 
238   /**
239   Flag indicating this component should receive the focus.
240   <br />Default: <code>false</code>
241   */
242   public boolean isFocus() {
243     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
244     if (bool != null) {
245       return bool;
246     }
247     return false;
248   }
249 
250   public void setFocus(boolean focus) {
251     getStateHelper().put(PropertyKeys.focus, focus);
252   }
253 
254   /**
255   This value will usually be set by the layout manager.
256 
257   */
258   public org.apache.myfaces.tobago.layout.Measure getLeft() {
259     Object object = getStateHelper().eval(PropertyKeys.left);
260     if (object != null) {
261        return Measure.valueOf(object);
262     }
263     return null;
264   }
265 
266   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
267     getStateHelper().put(PropertyKeys.left, left);
268   }
269 
270   public java.lang.Integer getColumnSpan() {
271     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
272     if (value != null) {
273       return value.intValue();
274     }
275     return 1;
276   }
277 
278   public void setColumnSpan(java.lang.Integer columnSpan) {
279     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
280   }
281 
282   /**
283   This value will usually be set by the layout manager.
284 
285   */
286   public org.apache.myfaces.tobago.layout.Measure getTop() {
287     Object object = getStateHelper().eval(PropertyKeys.top);
288     if (object != null) {
289        return Measure.valueOf(object);
290     }
291     return null;
292   }
293 
294   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
295     getStateHelper().put(PropertyKeys.top, top);
296   }
297 
298   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
299     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
300     if (object != null) {
301        return Measure.valueOf(object);
302     }
303     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
304   }
305 
306   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
307     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
308   }
309 
310   /**
311   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
312 
313   */
314   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
315     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
316     if (object != null) {
317        return Measure.valueOf(object);
318     }
319     return getWidth();
320   }
321 
322   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
323     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
324   }
325 
326   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
327     Object object = getStateHelper().eval(PropertyKeys.marginTop);
328     if (object != null) {
329        return Measure.valueOf(object);
330     }
331     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
332   }
333 
334   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
335     getStateHelper().put(PropertyKeys.marginTop, marginTop);
336   }
337 
338   /**
339   This value will usually be set by the layout manager.
340 
341   */
342   public org.apache.myfaces.tobago.layout.Measure getWidth() {
343     Object object = getStateHelper().eval(PropertyKeys.width);
344     if (object != null) {
345        return Measure.valueOf(object);
346     }
347     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
348   }
349 
350   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
351     getStateHelper().put(PropertyKeys.width, width);
352   }
353 
354   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
355     Object object = getStateHelper().eval(PropertyKeys.marginRight);
356     if (object != null) {
357        return Measure.valueOf(object);
358     }
359     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
360   }
361 
362   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
363     getStateHelper().put(PropertyKeys.marginRight, marginRight);
364   }
365 
366   /**
367   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
368 
369   */
370   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
371     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
372     if (object != null) {
373        return Measure.valueOf(object);
374     }
375     return getHeight();
376   }
377 
378   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
379     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
380   }
381 
382   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
383     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
384     if (object != null) {
385        return Measure.valueOf(object);
386     }
387     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
388   }
389 
390   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
391     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
392   }
393 
394   /**
395   Text value to display as label.
396    If text contains an underscore the next character is used as accesskey.
397 
398   */
399   public java.lang.String getLabel() {
400     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
401   }
402 
403   public void setLabel(java.lang.String label) {
404     getStateHelper().put(PropertyKeys.label, label);
405   }
406 
407   /**
408   This attribute is for internal use only.
409 
410   */
411   public org.apache.myfaces.tobago.layout.Display getDisplay() {
412     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
413   }
414 
415   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
416     getStateHelper().put(PropertyKeys.display, display);
417   }
418 
419   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
420     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
421     if (object != null) {
422        return Measure.valueOf(object);
423     }
424     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
425   }
426 
427   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
428     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
429   }
430 
431   /**
432   Client side script function to add to this component's onchange handler.
433 
434   @deprecated*/
435   @Deprecated
436   public java.lang.String getOnchange() {
437     return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
438   }
439 
440   @Deprecated
441   public void setOnchange(java.lang.String onchange) {
442       Deprecation.LOG.error("The attribute 'onchange' of 'UISelectOneListbox' is deprecated. "
443           + "Please refer the documentation for further information.");
444     getStateHelper().put(PropertyKeys.onchange, onchange);
445   }
446 
447   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
448     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
449     if (object != null) {
450        return Measure.valueOf(object);
451     }
452     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
453   }
454 
455   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
456     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
457   }
458 
459   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
460     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
461     if (object != null) {
462        return Measure.valueOf(object);
463     }
464     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
465   }
466 
467   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
468     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
469   }
470 
471   /**
472   This attribute is for internal use only.
473 
474   */
475   public java.lang.Integer getVerticalIndex() {
476     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
477     if (value != null) {
478       return value.intValue();
479     }
480     return null;
481   }
482 
483   public void setVerticalIndex(java.lang.Integer verticalIndex) {
484     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
485   }
486 
487   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
488     if (currentMarkup != null) {
489       return currentMarkup;
490     }
491     return null;
492   }
493 
494   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
495     this.currentMarkup = currentMarkup;
496   }
497 
498   /**
499   This attribute is for internal use only.
500 
501   */
502   public java.lang.Integer getHorizontalIndex() {
503     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
504     if (value != null) {
505       return value.intValue();
506     }
507     return null;
508   }
509 
510   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
511     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
512   }
513 
514   /**
515   Flag indicating that this component will prohibit changes by the user.
516   <br />Default: <code>false</code>
517   */
518   public boolean isReadonly() {
519     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
520     if (bool != null) {
521       return bool;
522     }
523     return false;
524   }
525 
526   public void setReadonly(boolean readonly) {
527     getStateHelper().put(PropertyKeys.readonly, readonly);
528   }
529 
530   /**
531   Flag indicating that this element is disabled.
532   <br />Default: <code>false</code>
533   */
534   public boolean isDisabled() {
535     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
536     if (bool != null) {
537       return bool;
538     }
539     return false;
540   }
541 
542   public void setDisabled(boolean disabled) {
543     getStateHelper().put(PropertyKeys.disabled, disabled);
544   }
545 
546   public Object saveState(FacesContext context) {
547     currentMarkup = null;
548     return super.saveState(context);
549   }
550 
551 
552 }