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