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