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