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