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