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.el.MethodExpression;
23  import javax.faces.context.FacesContext;
24  import org.apache.myfaces.tobago.context.Markup;
25  import org.apache.myfaces.tobago.internal.component.AbstractUIIn;
26  import org.apache.myfaces.tobago.layout.Display;
27  import org.apache.myfaces.tobago.layout.Measure;
28  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
29  import org.apache.myfaces.tobago.internal.util.StringUtils;
30  import org.apache.myfaces.tobago.internal.util.Deprecation;
31  import org.apache.myfaces.tobago.renderkit.MarginValues;
32  import org.apache.myfaces.tobago.renderkit.SpacingValues;
33  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
34  import javax.el.ELException;
35  import javax.faces.FacesException;
36  import java.util.ArrayList;
37  import java.util.List;
38  import javax.el.MethodExpression;
39  import javax.el.ValueExpression;
40  
41  /** 
42   Renders a text input field.
43    * UIComponent class, generated from template {@code component2.0.stg} with class
44    * {@link org.apache.myfaces.tobago.internal.taglib.component.InTagDeclaration}.
45   */
46  public class UIIn
47      extends AbstractUIIn implements SupportsMarkup {
48  
49    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.In";
50  
51    public static final String COMPONENT_FAMILY = "javax.faces.Input";
52  
53    private org.apache.myfaces.tobago.context.Markup currentMarkup;
54  
55    enum PropertyKeys {
56      markup,
57      marginLeft,
58      tabIndex,
59      minimumHeight,
60      password,
61      tip,
62      suggestMethod,
63      suggestDelay,
64      height,
65      minimumWidth,
66      rowSpan,
67      left,
68      focus,
69      columnSpan,
70      suggestMinChars,
71      top,
72      maximumHeight,
73      currentWidth,
74      marginTop,
75      placeholder,
76      width,
77      marginRight,
78      preferredHeight,
79      currentHeight,
80      label,
81      display,
82      maximumWidth,
83      autocomplete,
84      onchange,
85      preferredWidth,
86      marginBottom,
87      verticalIndex,
88      horizontalIndex,
89      readonly,
90      disabled,
91    }
92  
93    public String getFamily() {
94      return COMPONENT_FAMILY;
95    }
96  
97  
98    public org.apache.myfaces.tobago.context.Markup getMarkup() {
99      Object object = getStateHelper().eval(PropertyKeys.markup);
100     if (object != null) {
101       return Markup.valueOf(object);
102     }
103     return null;
104   }
105 
106   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
107     getStateHelper().put(PropertyKeys.markup, markup);
108   }
109 
110   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
111     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
112     if (object != null) {
113        return Measure.valueOf(object);
114     }
115     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
116   }
117 
118   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
119     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
120   }
121 
122   /**
123   Controls the navigation of the focus through the
124    input controls on a page with the Tab-Key.
125    The navigation starts from the element with
126    the lowest tabIndex value to the element with the highest value.
127    Elements that have identical tabIndex values should be navigated
128    in the order they appear in the character stream
129    Elements that are disabled or with a negative tabIndex
130    do not participate in the tabbing order.
131 
132   */
133   public java.lang.Integer getTabIndex() {
134     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
135     if (value != null) {
136       return value.intValue();
137     }
138     return null;
139   }
140 
141   public void setTabIndex(java.lang.Integer tabIndex) {
142     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
143   }
144 
145   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
146     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
147     if (object != null) {
148        return Measure.valueOf(object);
149     }
150     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
151   }
152 
153   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
154     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
155   }
156 
157   /**
158   Flag indicating whether or not this component should be rendered as
159    password field , so you will not see the typed charakters.
160   <br />Default: <code>false</code>
161   */
162   public boolean isPassword() {
163     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.password);
164     if (bool != null) {
165       return bool;
166     }
167     return false;
168   }
169 
170   public void setPassword(boolean password) {
171     getStateHelper().put(PropertyKeys.password, password);
172   }
173 
174   /**
175   Text value to display as tooltip.
176 
177   */
178   public java.lang.String getTip() {
179     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
180   }
181 
182   public void setTip(java.lang.String tip) {
183     getStateHelper().put(PropertyKeys.tip, tip);
184   }
185 
186   /**
187    * @deprecated since 2.0.0
188    */
189   @Deprecated
190   public javax.faces.el.MethodBinding getSuggestMethod() {
191     javax.el.MethodExpression expression = getSuggestMethodExpression();
192     if (expression instanceof MethodBindingToMethodExpression) {
193       return ((MethodBindingToMethodExpression)expression).getMethodBinding();
194     }
195     if (expression != null) {
196        return new MethodExpressionToMethodBinding(expression);
197     }
198     return null;
199   }
200 
201   /**
202    * @deprecated since 2.0.0
203    */
204   @Deprecated
205   public void setSuggestMethod(javax.faces.el.MethodBinding suggestMethod) {
206     if (suggestMethod != null) {
207       setSuggestMethodExpression(new MethodBindingToMethodExpression(suggestMethod));
208     } else {
209       setSuggestMethodExpression(null);
210     }
211   }
212 
213   public javax.el.MethodExpression getSuggestMethodExpression() {
214     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.suggestMethod);
215   }
216 
217   public void setSuggestMethodExpression(javax.el.MethodExpression suggestMethod) {
218     getStateHelper().put(PropertyKeys.suggestMethod, suggestMethod);
219   }
220 
221 
222   /**
223   Time in milli seconds before the list will be requested.
224   <br />Default: <code>300</code>
225   @deprecated*/
226   @Deprecated
227   public java.lang.Integer getSuggestDelay() {
228     Number value  = (Number) getStateHelper().eval(PropertyKeys.suggestDelay);
229     if (value != null) {
230       return value.intValue();
231     }
232     return 300;
233   }
234 
235   @Deprecated
236   public void setSuggestDelay(java.lang.Integer suggestDelay) {
237       Deprecation.LOG.error("The attribute 'suggestDelay' of 'UIIn' is deprecated. "
238           + "Please refer the documentation for further information.");
239     getStateHelper().put(PropertyKeys.suggestDelay, suggestDelay);
240   }
241 
242   /**
243   This value will usually be set by the layout manager.
244 
245   */
246   public org.apache.myfaces.tobago.layout.Measure getHeight() {
247     Object object = getStateHelper().eval(PropertyKeys.height);
248     if (object != null) {
249        return Measure.valueOf(object);
250     }
251     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
252   }
253 
254   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
255     getStateHelper().put(PropertyKeys.height, height);
256   }
257 
258   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
259     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
260     if (object != null) {
261        return Measure.valueOf(object);
262     }
263     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
264   }
265 
266   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
267     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
268   }
269 
270   public java.lang.Integer getRowSpan() {
271     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
272     if (value != null) {
273       return value.intValue();
274     }
275     return 1;
276   }
277 
278   public void setRowSpan(java.lang.Integer rowSpan) {
279     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
280   }
281 
282   /**
283   This value will usually be set by the layout manager.
284 
285   */
286   public org.apache.myfaces.tobago.layout.Measure getLeft() {
287     Object object = getStateHelper().eval(PropertyKeys.left);
288     if (object != null) {
289        return Measure.valueOf(object);
290     }
291     return null;
292   }
293 
294   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
295     getStateHelper().put(PropertyKeys.left, left);
296   }
297 
298   /**
299   Flag indicating this component should receive the focus.
300   <br />Default: <code>false</code>
301   */
302   public boolean isFocus() {
303     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
304     if (bool != null) {
305       return bool;
306     }
307     return false;
308   }
309 
310   public void setFocus(boolean focus) {
311     getStateHelper().put(PropertyKeys.focus, focus);
312   }
313 
314   public java.lang.Integer getColumnSpan() {
315     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
316     if (value != null) {
317       return value.intValue();
318     }
319     return 1;
320   }
321 
322   public void setColumnSpan(java.lang.Integer columnSpan) {
323     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
324   }
325 
326   /**
327   Minimum number of chars to type before the list will be requested.
328   <br />Default: <code>1</code>
329   @deprecated*/
330   @Deprecated
331   public java.lang.Integer getSuggestMinChars() {
332     Number value  = (Number) getStateHelper().eval(PropertyKeys.suggestMinChars);
333     if (value != null) {
334       return value.intValue();
335     }
336     return 1;
337   }
338 
339   @Deprecated
340   public void setSuggestMinChars(java.lang.Integer suggestMinChars) {
341       Deprecation.LOG.error("The attribute 'suggestMinChars' of 'UIIn' is deprecated. "
342           + "Please refer the documentation for further information.");
343     getStateHelper().put(PropertyKeys.suggestMinChars, suggestMinChars);
344   }
345 
346   /**
347   This value will usually be set by the layout manager.
348 
349   */
350   public org.apache.myfaces.tobago.layout.Measure getTop() {
351     Object object = getStateHelper().eval(PropertyKeys.top);
352     if (object != null) {
353        return Measure.valueOf(object);
354     }
355     return null;
356   }
357 
358   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
359     getStateHelper().put(PropertyKeys.top, top);
360   }
361 
362   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
363     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
364     if (object != null) {
365        return Measure.valueOf(object);
366     }
367     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
368   }
369 
370   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
371     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
372   }
373 
374   /**
375   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
376 
377   */
378   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
379     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
380     if (object != null) {
381        return Measure.valueOf(object);
382     }
383     return getWidth();
384   }
385 
386   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
387     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
388   }
389 
390   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
391     Object object = getStateHelper().eval(PropertyKeys.marginTop);
392     if (object != null) {
393        return Measure.valueOf(object);
394     }
395     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
396   }
397 
398   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
399     getStateHelper().put(PropertyKeys.marginTop, marginTop);
400   }
401 
402   /**
403   Displays a short text in the input field, that describes the meaning of this field.
404    This is part of HTML 5, the theme should emulate the behaviour, when the browser doesn't support it.
405    <p/>
406    The text will not be displayed, when the input field is readonly or disabled.
407 
408   */
409   public java.lang.String getPlaceholder() {
410     return (java.lang.String) getStateHelper().eval(PropertyKeys.placeholder);
411   }
412 
413   public void setPlaceholder(java.lang.String placeholder) {
414     getStateHelper().put(PropertyKeys.placeholder, placeholder);
415   }
416 
417   /**
418   This value will usually be set by the layout manager.
419 
420   */
421   public org.apache.myfaces.tobago.layout.Measure getWidth() {
422     Object object = getStateHelper().eval(PropertyKeys.width);
423     if (object != null) {
424        return Measure.valueOf(object);
425     }
426     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
427   }
428 
429   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
430     getStateHelper().put(PropertyKeys.width, width);
431   }
432 
433   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
434     Object object = getStateHelper().eval(PropertyKeys.marginRight);
435     if (object != null) {
436        return Measure.valueOf(object);
437     }
438     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
439   }
440 
441   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
442     getStateHelper().put(PropertyKeys.marginRight, marginRight);
443   }
444 
445   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
446     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
447     if (object != null) {
448        return Measure.valueOf(object);
449     }
450     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
451   }
452 
453   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
454     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
455   }
456 
457   /**
458   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
459 
460   */
461   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
462     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
463     if (object != null) {
464        return Measure.valueOf(object);
465     }
466     return getHeight();
467   }
468 
469   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
470     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
471   }
472 
473   /**
474   A localized user presentable name for this component.
475 
476   */
477   public java.lang.String getLabel() {
478     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
479   }
480 
481   public void setLabel(java.lang.String label) {
482     getStateHelper().put(PropertyKeys.label, label);
483   }
484 
485   /**
486   This attribute is for internal use only.
487 
488   */
489   public org.apache.myfaces.tobago.layout.Display getDisplay() {
490     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
491   }
492 
493   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
494     getStateHelper().put(PropertyKeys.display, display);
495   }
496 
497   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
498     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
499     if (object != null) {
500        return Measure.valueOf(object);
501     }
502     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
503   }
504 
505   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
506     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
507   }
508 
509   public boolean isAutocomplete() {
510     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.autocomplete);
511     if (bool != null) {
512       return bool;
513     }
514     return true;
515   }
516 
517   public void setAutocomplete(boolean autocomplete) {
518     getStateHelper().put(PropertyKeys.autocomplete, autocomplete);
519   }
520 
521   /**
522   Client side script function to add to this component's onchange handler.
523 
524   @deprecated*/
525   @Deprecated
526   public java.lang.String getOnchange() {
527     return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
528   }
529 
530   @Deprecated
531   public void setOnchange(java.lang.String onchange) {
532       Deprecation.LOG.error("The attribute 'onchange' of 'UIIn' is deprecated. "
533           + "Please refer the documentation for further information.");
534     getStateHelper().put(PropertyKeys.onchange, onchange);
535   }
536 
537   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
538     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
539     if (object != null) {
540        return Measure.valueOf(object);
541     }
542     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
543   }
544 
545   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
546     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
547   }
548 
549   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
550     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
551     if (object != null) {
552        return Measure.valueOf(object);
553     }
554     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
555   }
556 
557   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
558     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
559   }
560 
561   /**
562   This attribute is for internal use only.
563 
564   */
565   public java.lang.Integer getVerticalIndex() {
566     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
567     if (value != null) {
568       return value.intValue();
569     }
570     return null;
571   }
572 
573   public void setVerticalIndex(java.lang.Integer verticalIndex) {
574     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
575   }
576 
577   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
578     if (currentMarkup != null) {
579       return currentMarkup;
580     }
581     return null;
582   }
583 
584   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
585     this.currentMarkup = currentMarkup;
586   }
587 
588   /**
589   This attribute is for internal use only.
590 
591   */
592   public java.lang.Integer getHorizontalIndex() {
593     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
594     if (value != null) {
595       return value.intValue();
596     }
597     return null;
598   }
599 
600   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
601     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
602   }
603 
604   /**
605   Flag indicating that this component will prohibit changes by the user.
606   <br />Default: <code>false</code>
607   */
608   public boolean isReadonly() {
609     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
610     if (bool != null) {
611       return bool;
612     }
613     return false;
614   }
615 
616   public void setReadonly(boolean readonly) {
617     getStateHelper().put(PropertyKeys.readonly, readonly);
618   }
619 
620   /**
621   Flag indicating that this element is disabled.
622   <br />Default: <code>false</code>
623   */
624   public boolean isDisabled() {
625     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
626     if (bool != null) {
627       return bool;
628     }
629     return false;
630   }
631 
632   public void setDisabled(boolean disabled) {
633     getStateHelper().put(PropertyKeys.disabled, disabled);
634   }
635 
636   public Object saveState(FacesContext context) {
637     currentMarkup = null;
638     return super.saveState(context);
639   }
640 
641 }