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.renderkit.css.CustomClass;
26  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
27  import org.apache.myfaces.tobago.internal.util.StringUtils;
28  import org.apache.myfaces.tobago.internal.util.Deprecation;
29  import javax.annotation.Generated;
30  import javax.el.ELException;
31  import javax.faces.FacesException;
32  import java.util.Arrays;
33  import java.util.ArrayList;
34  import java.util.Collection;
35  import java.util.List;
36  import javax.el.MethodExpression;
37  import javax.el.ValueExpression;
38  
39  /** 
40   Renders a checkbox.
41    * UIComponent class, generated from template {@code component.stg} with class
42    * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectBooleanCheckboxTagDeclaration}.
43   */
44  @Generated("component.stg")
45  public class UISelectBooleanCheckbox
46      extends AbstractUISelectBooleanCheckbox implements Visual {
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 static final Collection<String> EVENT_NAMES = Arrays.asList("change", "click", "dblclick", "focus", "blur");
53  
54    @Override
55    public Collection<String> getEventNames() {
56      return EVENT_NAMES;
57    }
58  
59    @Override
60    public String getDefaultEventName() {
61      return "change";
62    }
63  
64  
65    enum PropertyKeys {
66      markup,
67      labelLayout,
68      focus,
69      tabIndex,
70      label,
71      itemLabel,
72      readonly,
73      accessKey,
74      customClass,
75      disabled,
76      tip,
77    }
78  
79    public String getFamily() {
80      return COMPONENT_FAMILY;
81    }
82  
83  
84    public org.apache.myfaces.tobago.context.Markup getMarkup() {
85      Object object = getStateHelper().eval(PropertyKeys.markup);
86      if (object != null) {
87        return Markup.valueOf(object);
88      }
89      return null;
90    }
91  
92    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
93      getStateHelper().put(PropertyKeys.markup, markup);
94    }
95  
96    /**
97    Defines the position of the label relative to the field.
98     The default is flexLeft, if the label is set, or none, if the label isn't set.
99     Set to 'skip' to avoid surrounding label container.
100    Hint for tc:out: set also compact=true to render only text (without html tags).
101 
102   */
103   public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
104     org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
105     if (labelLayout != null) {
106       return labelLayout;
107     }
108     return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
109   }
110 
111   public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
112     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
113   }
114 
115   /**
116   Flag indicating this component should receive the focus.
117   <br>Default: <code>false</code>
118   */
119   public boolean isFocus() {
120     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
121     if (bool != null) {
122       return bool;
123     }
124     return false;
125   }
126 
127   public void setFocus(boolean focus) {
128     getStateHelper().put(PropertyKeys.focus, focus);
129   }
130 
131   /**
132   Controls the navigation of the focus through the
133    input controls on a page with the Tab-Key.
134    The navigation starts from the element with
135    the lowest tabIndex value to the element with the highest value.
136    Elements that have identical tabIndex values should be navigated
137    in the order they appear in the character stream
138    Elements that are disabled or with a negative tabIndex
139    do not participate in the tabbing order.
140 
141   */
142   public java.lang.Integer getTabIndex() {
143     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
144     if (value != null) {
145       return value.intValue();
146     }
147     return null;
148   }
149 
150   public void setTabIndex(java.lang.Integer tabIndex) {
151     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
152   }
153 
154   /**
155   A localized user presentable label for this component.
156 
157   */
158   public java.lang.String getLabel() {
159     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
160   }
161 
162   public void setLabel(java.lang.String label) {
163     getStateHelper().put(PropertyKeys.label, label);
164   }
165 
166   /**
167   Label to be displayed to the user for this option.
168 
169   */
170   public java.lang.String getItemLabel() {
171     return (java.lang.String) getStateHelper().eval(PropertyKeys.itemLabel);
172   }
173 
174   public void setItemLabel(java.lang.String itemLabel) {
175     getStateHelper().put(PropertyKeys.itemLabel, itemLabel);
176   }
177 
178   /**
179   Flag indicating that this component will prohibit changes by the user.
180   <br>Default: <code>false</code>
181   */
182   public boolean isReadonly() {
183     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
184     if (bool != null) {
185       return bool;
186     }
187     return false;
188   }
189 
190   public void setReadonly(boolean readonly) {
191     getStateHelper().put(PropertyKeys.readonly, readonly);
192   }
193 
194   /**
195   The access key of this control.
196 
197   */
198   public java.lang.Character getAccessKey() {
199     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
200   }
201 
202   public void setAccessKey(java.lang.Character accessKey) {
203     getStateHelper().put(PropertyKeys.accessKey, accessKey);
204   }
205 
206   /**
207   Sets a CSS class in its parent, if the parent supports it.
208 
209    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
210 
211    <pre>
212    &lt;tc:in&gt;
213      &lt;tc:style customClass="my-emphasized"/&gt;
214    &lt;/tc:in&gt;
215    </pre>
216 
217    One capability is, to used external CSS libs.
218    <br>
219    This feature should not be used imprudent.
220    Because it might be unstable against changes in the renderered HTML code.
221 
222   */
223   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
224     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
225   }
226 
227   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
228     getStateHelper().put(PropertyKeys.customClass, customClass);
229   }
230 
231   /**
232   Flag indicating that this element is disabled.
233   <br>Default: <code>false</code>
234   */
235   public boolean isDisabled() {
236     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
237     if (bool != null) {
238       return bool;
239     }
240     return false;
241   }
242 
243   public void setDisabled(boolean disabled) {
244     getStateHelper().put(PropertyKeys.disabled, disabled);
245   }
246 
247   /**
248   Text value to display as tooltip.
249 
250   */
251   public java.lang.String getTip() {
252     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
253   }
254 
255   public void setTip(java.lang.String tip) {
256     getStateHelper().put(PropertyKeys.tip, tip);
257   }
258 
259 
260   @Override
261   public void restoreState(FacesContext context, Object state) {
262     // FIXME HACK for mojarra SystemEventListener state restoring bug
263     pushComponentToEL(context, this);
264     super.restoreState(context, state);
265     popComponentFromEL(context);
266   }
267 
268 }