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