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