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.AbstractUISelectMany;
25  import org.apache.myfaces.tobago.layout.Display;
26  import org.apache.myfaces.tobago.layout.Measure;
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 org.apache.myfaces.tobago.renderkit.MarginValues;
31  import org.apache.myfaces.tobago.renderkit.SpacingValues;
32  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.ArrayList;
36  import java.util.List;
37  import javax.el.MethodExpression;
38  import javax.el.ValueExpression;
39  
40  /** 
41   Render a multi selection option listbox.
42    * UIComponent class, generated from template {@code component2.0.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectManyListboxTagDeclaration}.
44   */
45  public class UISelectManyListbox
46      extends AbstractUISelectMany implements SupportsMarkup {
47  
48    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SelectManyListbox";
49  
50    public static final String COMPONENT_FAMILY = "javax.faces.SelectMany";
51  
52    private org.apache.myfaces.tobago.context.Markup currentMarkup;
53  
54    enum PropertyKeys {
55      markup,
56      marginLeft,
57      tabIndex,
58      minimumHeight,
59      tip,
60      height,
61      minimumWidth,
62      rowSpan,
63      left,
64      focus,
65      columnSpan,
66      top,
67      maximumHeight,
68      currentWidth,
69      marginTop,
70      width,
71      marginRight,
72      currentHeight,
73      preferredHeight,
74      display,
75      label,
76      maximumWidth,
77      onchange,
78      preferredWidth,
79      marginBottom,
80      verticalIndex,
81      horizontalIndex,
82      readonly,
83      disabled,
84    }
85  
86    public String getFamily() {
87      return COMPONENT_FAMILY;
88    }
89  
90  
91    public org.apache.myfaces.tobago.context.Markup getMarkup() {
92      Object object = getStateHelper().eval(PropertyKeys.markup);
93      if (object != null) {
94        return Markup.valueOf(object);
95      }
96      return null;
97    }
98  
99    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
100     getStateHelper().put(PropertyKeys.markup, markup);
101   }
102 
103   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
104     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
105     if (object != null) {
106        return Measure.valueOf(object);
107     }
108     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
109   }
110 
111   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
112     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
113   }
114 
115   /**
116   Controls the navigation of the focus through the
117    input controls on a page with the Tab-Key.
118    The navigation starts from the element with
119    the lowest tabIndex value to the element with the highest value.
120    Elements that have identical tabIndex values should be navigated
121    in the order they appear in the character stream
122    Elements that are disabled or with a negative tabIndex
123    do not participate in the tabbing order.
124 
125   */
126   public java.lang.Integer getTabIndex() {
127     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
128     if (value != null) {
129       return value.intValue();
130     }
131     return null;
132   }
133 
134   public void setTabIndex(java.lang.Integer tabIndex) {
135     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
136   }
137 
138   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
139     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
140     if (object != null) {
141        return Measure.valueOf(object);
142     }
143     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
144   }
145 
146   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
147     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
148   }
149 
150   /**
151   Text value to display as tooltip.
152 
153   */
154   public java.lang.String getTip() {
155     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
156   }
157 
158   public void setTip(java.lang.String tip) {
159     getStateHelper().put(PropertyKeys.tip, tip);
160   }
161 
162   /**
163   This value will usually be set by the layout manager.
164 
165   */
166   public org.apache.myfaces.tobago.layout.Measure getHeight() {
167     Object object = getStateHelper().eval(PropertyKeys.height);
168     if (object != null) {
169        return Measure.valueOf(object);
170     }
171     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
172   }
173 
174   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
175     getStateHelper().put(PropertyKeys.height, height);
176   }
177 
178   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
179     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
180     if (object != null) {
181        return Measure.valueOf(object);
182     }
183     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
184   }
185 
186   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
187     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
188   }
189 
190   public java.lang.Integer getRowSpan() {
191     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
192     if (value != null) {
193       return value.intValue();
194     }
195     return 1;
196   }
197 
198   public void setRowSpan(java.lang.Integer rowSpan) {
199     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
200   }
201 
202   /**
203   This value will usually be set by the layout manager.
204 
205   */
206   public org.apache.myfaces.tobago.layout.Measure getLeft() {
207     Object object = getStateHelper().eval(PropertyKeys.left);
208     if (object != null) {
209        return Measure.valueOf(object);
210     }
211     return null;
212   }
213 
214   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
215     getStateHelper().put(PropertyKeys.left, left);
216   }
217 
218   /**
219   Flag indicating this component should receive the focus.
220   <br />Default: <code>false</code>
221   */
222   public boolean isFocus() {
223     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
224     if (bool != null) {
225       return bool;
226     }
227     return false;
228   }
229 
230   public void setFocus(boolean focus) {
231     getStateHelper().put(PropertyKeys.focus, focus);
232   }
233 
234   public java.lang.Integer getColumnSpan() {
235     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
236     if (value != null) {
237       return value.intValue();
238     }
239     return 1;
240   }
241 
242   public void setColumnSpan(java.lang.Integer columnSpan) {
243     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
244   }
245 
246   /**
247   This value will usually be set by the layout manager.
248 
249   */
250   public org.apache.myfaces.tobago.layout.Measure getTop() {
251     Object object = getStateHelper().eval(PropertyKeys.top);
252     if (object != null) {
253        return Measure.valueOf(object);
254     }
255     return null;
256   }
257 
258   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
259     getStateHelper().put(PropertyKeys.top, top);
260   }
261 
262   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
263     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
264     if (object != null) {
265        return Measure.valueOf(object);
266     }
267     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
268   }
269 
270   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
271     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
272   }
273 
274   /**
275   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
276 
277   */
278   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
279     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
280     if (object != null) {
281        return Measure.valueOf(object);
282     }
283     return getWidth();
284   }
285 
286   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
287     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
288   }
289 
290   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
291     Object object = getStateHelper().eval(PropertyKeys.marginTop);
292     if (object != null) {
293        return Measure.valueOf(object);
294     }
295     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
296   }
297 
298   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
299     getStateHelper().put(PropertyKeys.marginTop, marginTop);
300   }
301 
302   /**
303   This value will usually be set by the layout manager.
304 
305   */
306   public org.apache.myfaces.tobago.layout.Measure getWidth() {
307     Object object = getStateHelper().eval(PropertyKeys.width);
308     if (object != null) {
309        return Measure.valueOf(object);
310     }
311     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
312   }
313 
314   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
315     getStateHelper().put(PropertyKeys.width, width);
316   }
317 
318   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
319     Object object = getStateHelper().eval(PropertyKeys.marginRight);
320     if (object != null) {
321        return Measure.valueOf(object);
322     }
323     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
324   }
325 
326   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
327     getStateHelper().put(PropertyKeys.marginRight, marginRight);
328   }
329 
330   /**
331   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
332 
333   */
334   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
335     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
336     if (object != null) {
337        return Measure.valueOf(object);
338     }
339     return getHeight();
340   }
341 
342   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
343     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
344   }
345 
346   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
347     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
348     if (object != null) {
349        return Measure.valueOf(object);
350     }
351     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
352   }
353 
354   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
355     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
356   }
357 
358   /**
359   This attribute is for internal use only.
360 
361   */
362   public org.apache.myfaces.tobago.layout.Display getDisplay() {
363     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
364   }
365 
366   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
367     getStateHelper().put(PropertyKeys.display, display);
368   }
369 
370   /**
371   Text value to display as label.
372    If text contains an underscore the next character is used as accesskey (if configured so and possible).
373 
374   */
375   public java.lang.String getLabel() {
376     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
377   }
378 
379   public void setLabel(java.lang.String label) {
380     getStateHelper().put(PropertyKeys.label, label);
381   }
382 
383   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
384     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
385     if (object != null) {
386        return Measure.valueOf(object);
387     }
388     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
389   }
390 
391   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
392     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
393   }
394 
395   /**
396   Client side script function to add to this component's onchange handler.
397 
398   @deprecated*/
399   @Deprecated
400   public java.lang.String getOnchange() {
401     return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
402   }
403 
404   @Deprecated
405   public void setOnchange(java.lang.String onchange) {
406       Deprecation.LOG.error("The attribute 'onchange' of 'UISelectManyListbox' is deprecated. "
407           + "Please refer the documentation for further information.");
408     getStateHelper().put(PropertyKeys.onchange, onchange);
409   }
410 
411   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
412     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
413     if (object != null) {
414        return Measure.valueOf(object);
415     }
416     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
417   }
418 
419   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
420     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
421   }
422 
423   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
424     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
425     if (object != null) {
426        return Measure.valueOf(object);
427     }
428     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
429   }
430 
431   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
432     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
433   }
434 
435   /**
436   This attribute is for internal use only.
437 
438   */
439   public java.lang.Integer getVerticalIndex() {
440     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
441     if (value != null) {
442       return value.intValue();
443     }
444     return null;
445   }
446 
447   public void setVerticalIndex(java.lang.Integer verticalIndex) {
448     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
449   }
450 
451   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
452     if (currentMarkup != null) {
453       return currentMarkup;
454     }
455     return null;
456   }
457 
458   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
459     this.currentMarkup = currentMarkup;
460   }
461 
462   /**
463   This attribute is for internal use only.
464 
465   */
466   public java.lang.Integer getHorizontalIndex() {
467     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
468     if (value != null) {
469       return value.intValue();
470     }
471     return null;
472   }
473 
474   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
475     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
476   }
477 
478   /**
479   Flag indicating that this component will prohibit changes by the user.
480   <br />Default: <code>false</code>
481   */
482   public boolean isReadonly() {
483     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
484     if (bool != null) {
485       return bool;
486     }
487     return false;
488   }
489 
490   public void setReadonly(boolean readonly) {
491     getStateHelper().put(PropertyKeys.readonly, readonly);
492   }
493 
494   /**
495   Flag indicating that this element is disabled.
496   <br />Default: <code>false</code>
497   */
498   public boolean isDisabled() {
499     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
500     if (bool != null) {
501       return bool;
502     }
503     return false;
504   }
505 
506   public void setDisabled(boolean disabled) {
507     getStateHelper().put(PropertyKeys.disabled, disabled);
508   }
509 
510   public Object saveState(FacesContext context) {
511     currentMarkup = null;
512     return super.saveState(context);
513   }
514 
515 }