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.renderkit.css.Style;
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 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  public class UISelectBooleanCheckbox
45      extends AbstractUISelectBooleanCheckbox implements Visual {
46  
47    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SelectBooleanCheckbox";
48  
49    public static final String COMPONENT_FAMILY = "javax.faces.SelectBoolean";
50  
51    private static final Collection<String> EVENT_NAMES = Arrays.asList("change", "click", "dblclick", "focus", "blur");
52  
53    @Override
54    public Collection<String> getEventNames() {
55      return EVENT_NAMES;
56    }
57  
58    @Override
59    public String getDefaultEventName() {
60      return "change";
61    }
62  
63  
64    enum PropertyKeys {
65      markup,
66      labelLayout,
67      focus,
68      tabIndex,
69      label,
70      itemLabel,
71      readonly,
72      accessKey,
73      customClass,
74      disabled,
75      tip,
76      style,
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  
100   */
101   public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
102     org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
103     if (labelLayout != null) {
104       return labelLayout;
105     }
106     return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
107   }
108 
109   public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
110     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
111   }
112 
113   /**
114   Flag indicating this component should receive the focus.
115   <br>Default: <code>false</code>
116   */
117   public boolean isFocus() {
118     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
119     if (bool != null) {
120       return bool;
121     }
122     return false;
123   }
124 
125   public void setFocus(boolean focus) {
126     getStateHelper().put(PropertyKeys.focus, focus);
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   /**
153   A localized user presentable label for this component.
154 
155   */
156   public java.lang.String getLabel() {
157     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
158   }
159 
160   public void setLabel(java.lang.String label) {
161     getStateHelper().put(PropertyKeys.label, label);
162   }
163 
164   /**
165   Label to be displayed to the user for this option.
166 
167   */
168   public java.lang.String getItemLabel() {
169     return (java.lang.String) getStateHelper().eval(PropertyKeys.itemLabel);
170   }
171 
172   public void setItemLabel(java.lang.String itemLabel) {
173     getStateHelper().put(PropertyKeys.itemLabel, itemLabel);
174   }
175 
176   /**
177   Flag indicating that this component will prohibit changes by the user.
178   <br>Default: <code>false</code>
179   */
180   public boolean isReadonly() {
181     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
182     if (bool != null) {
183       return bool;
184     }
185     return false;
186   }
187 
188   public void setReadonly(boolean readonly) {
189     getStateHelper().put(PropertyKeys.readonly, readonly);
190   }
191 
192   /**
193   The access key of this control.
194 
195   */
196   public java.lang.Character getAccessKey() {
197     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
198   }
199 
200   public void setAccessKey(java.lang.Character accessKey) {
201     getStateHelper().put(PropertyKeys.accessKey, accessKey);
202   }
203 
204   /**
205   Sets a CSS class in its parent, if the parent supports it.
206 
207    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
208 
209    <pre>
210    &lt;tc:in&gt;
211      &lt;tc:style customClass="my-emphasized"/&gt;
212    &lt;/tc:in&gt;
213    </pre>
214 
215    One capability is, to used external CSS libs.
216    <br>
217    This feature should not be used imprudent.
218    Because it might be unstable against changes in the renderered HTML code.
219 
220   */
221   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
222     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
223   }
224 
225   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
226     getStateHelper().put(PropertyKeys.customClass, customClass);
227   }
228 
229   /**
230   Flag indicating that this element is disabled.
231   <br>Default: <code>false</code>
232   */
233   public boolean isDisabled() {
234     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
235     if (bool != null) {
236       return bool;
237     }
238     return false;
239   }
240 
241   public void setDisabled(boolean disabled) {
242     getStateHelper().put(PropertyKeys.disabled, disabled);
243   }
244 
245   /**
246   Text value to display as tooltip.
247 
248   */
249   public java.lang.String getTip() {
250     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
251   }
252 
253   public void setTip(java.lang.String tip) {
254     getStateHelper().put(PropertyKeys.tip, tip);
255   }
256 
257   /**
258   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
259 
260   */
261   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
262     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
263   }
264 
265   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
266     getStateHelper().put(PropertyKeys.style, style);
267   }
268 
269 
270 }