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