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