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.commons.lang.ArrayUtils;
28  import org.apache.commons.lang.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      maximumHeight,
69      top,
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        Deprecation.LOG.error("The attribute 'accessKey' of 'UISelectOneListbox' is deprecated. "
100           + "Please refer the documentation for further information.");
101     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
102   }
103 
104   @Deprecated
105   public void setAccessKey(java.lang.Character accessKey) {
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
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       Deprecation.LOG.error("The attribute 'labelWithAccessKey' of 'UISelectOneListbox' is deprecated. "
142           + "Please refer the documentation for further information.");
143     return (java.lang.String) getStateHelper().eval(PropertyKeys.labelWithAccessKey);
144   }
145 
146   @Deprecated
147   public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) {
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
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 ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
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   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
283     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
284     if (object != null) {
285        return Measure.valueOf(object);
286     }
287     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
288   }
289 
290   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
291     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
292   }
293 
294   /**
295   This value will usually be set by the layout manager.
296 
297   */
298   public org.apache.myfaces.tobago.layout.Measure getTop() {
299     Object object = getStateHelper().eval(PropertyKeys.top);
300     if (object != null) {
301        return Measure.valueOf(object);
302     }
303     return null;
304   }
305 
306   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
307     getStateHelper().put(PropertyKeys.top, top);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
425   }
426 
427   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
428     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
429   }
430 
431   /**
432   Clientside script function to add to this component's onchange handler.
433 
434   */
435   public java.lang.String getOnchange() {
436     return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
437   }
438 
439   public void setOnchange(java.lang.String onchange) {
440     getStateHelper().put(PropertyKeys.onchange, onchange);
441   }
442 
443   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
444     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
445     if (object != null) {
446        return Measure.valueOf(object);
447     }
448     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
449   }
450 
451   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
452     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
453   }
454 
455   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
456     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
457     if (object != null) {
458        return Measure.valueOf(object);
459     }
460     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
461   }
462 
463   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
464     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
465   }
466 
467   /**
468   This attribute is for internal use only.
469 
470   */
471   public java.lang.Integer getVerticalIndex() {
472     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
473     if (value != null) {
474       return value.intValue();
475     }
476     return null;
477   }
478 
479   public void setVerticalIndex(java.lang.Integer verticalIndex) {
480     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
481   }
482 
483   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
484     if (currentMarkup != null) {
485       return currentMarkup;
486     }
487     return null;
488   }
489 
490   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
491     this.currentMarkup = currentMarkup;
492   }
493 
494   /**
495   This attribute is for internal use only.
496 
497   */
498   public java.lang.Integer getHorizontalIndex() {
499     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
500     if (value != null) {
501       return value.intValue();
502     }
503     return null;
504   }
505 
506   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
507     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
508   }
509 
510   /**
511   Flag indicating that this component will prohibit changes by the user.
512   <br />Default: <code>false</code>
513   */
514   public boolean isReadonly() {
515     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
516     if (bool != null) {
517       return bool;
518     }
519     return false;
520   }
521 
522   public void setReadonly(boolean readonly) {
523     getStateHelper().put(PropertyKeys.readonly, readonly);
524   }
525 
526   /**
527   Flag indicating that this element is disabled.
528   <br />Default: <code>false</code>
529   */
530   public boolean isDisabled() {
531     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
532     if (bool != null) {
533       return bool;
534     }
535     return false;
536   }
537 
538   public void setDisabled(boolean disabled) {
539     getStateHelper().put(PropertyKeys.disabled, disabled);
540   }
541 
542   public Object saveState(FacesContext context) {
543     currentMarkup = null;
544     return super.saveState(context);
545   }
546 
547 
548 }