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.AbstractUISelectOneChoice;
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   Render a single selection dropdown list.
41    * UIComponent class, generated from template {@code component.stg} with class
42    * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectOneChoiceTagDeclaration}.
43   */
44  public class UISelectOneChoice
45      extends AbstractUISelectOneChoice implements Visual {
46  
47    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SelectOneChoice";
48  
49    public static final String COMPONENT_FAMILY = "javax.faces.SelectOne";
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      readonly,
71      customClass,
72      style,
73      disabled,
74      tip,
75    }
76  
77    public String getFamily() {
78      return COMPONENT_FAMILY;
79    }
80  
81  
82    public org.apache.myfaces.tobago.context.Markup getMarkup() {
83      Object object = getStateHelper().eval(PropertyKeys.markup);
84      if (object != null) {
85        return Markup.valueOf(object);
86      }
87      return null;
88    }
89  
90    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
91      getStateHelper().put(PropertyKeys.markup, markup);
92    }
93  
94    /**
95    Defines the position of the label relative to the field.
96     The default is flexLeft, if the label is set, or none, if the label isn't set.
97  
98    */
99    public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
100     org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
101     if (labelLayout != null) {
102       return labelLayout;
103     }
104     return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
105   }
106 
107   public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
108     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
109   }
110 
111   /**
112   Flag indicating this component should receive the focus.
113   <br>Default: <code>false</code>
114   */
115   public boolean isFocus() {
116     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
117     if (bool != null) {
118       return bool;
119     }
120     return false;
121   }
122 
123   public void setFocus(boolean focus) {
124     getStateHelper().put(PropertyKeys.focus, focus);
125   }
126 
127   /**
128   Controls the navigation of the focus through the
129    input controls on a page with the Tab-Key.
130    The navigation starts from the element with
131    the lowest tabIndex value to the element with the highest value.
132    Elements that have identical tabIndex values should be navigated
133    in the order they appear in the character stream
134    Elements that are disabled or with a negative tabIndex
135    do not participate in the tabbing order.
136 
137   */
138   public java.lang.Integer getTabIndex() {
139     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
140     if (value != null) {
141       return value.intValue();
142     }
143     return null;
144   }
145 
146   public void setTabIndex(java.lang.Integer tabIndex) {
147     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
148   }
149 
150   /**
151   A localized user presentable label for this component.
152 
153   */
154   public java.lang.String getLabel() {
155     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
156   }
157 
158   public void setLabel(java.lang.String label) {
159     getStateHelper().put(PropertyKeys.label, label);
160   }
161 
162   /**
163   Flag indicating that this component will prohibit changes by the user.
164   <br>Default: <code>false</code>
165   */
166   public boolean isReadonly() {
167     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
168     if (bool != null) {
169       return bool;
170     }
171     return false;
172   }
173 
174   public void setReadonly(boolean readonly) {
175     getStateHelper().put(PropertyKeys.readonly, readonly);
176   }
177 
178   /**
179   Sets a CSS class in its parent, if the parent supports it.
180 
181    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
182 
183    <pre>
184    &lt;tc:in&gt;
185      &lt;tc:style customClass="my-emphasized"/&gt;
186    &lt;/tc:in&gt;
187    </pre>
188 
189    One capability is, to used external CSS libs.
190    <br>
191    This feature should not be used imprudent.
192    Because it might be unstable against changes in the renderered HTML code.
193 
194   */
195   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
196     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
197   }
198 
199   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
200     getStateHelper().put(PropertyKeys.customClass, customClass);
201   }
202 
203   /**
204   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
205 
206   */
207   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
208     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
209   }
210 
211   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
212     getStateHelper().put(PropertyKeys.style, style);
213   }
214 
215   /**
216   Flag indicating that this element is disabled.
217   <br>Default: <code>false</code>
218   */
219   public boolean isDisabled() {
220     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
221     if (bool != null) {
222       return bool;
223     }
224     return false;
225   }
226 
227   public void setDisabled(boolean disabled) {
228     getStateHelper().put(PropertyKeys.disabled, disabled);
229   }
230 
231   /**
232   Text value to display as tooltip.
233 
234   */
235   public java.lang.String getTip() {
236     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
237   }
238 
239   public void setTip(java.lang.String tip) {
240     getStateHelper().put(PropertyKeys.tip, tip);
241   }
242 
243 
244 }