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.AbstractUIInput;
26  import org.apache.myfaces.tobago.layout.Display;
27  import org.apache.myfaces.tobago.layout.Measure;
28  import org.apache.commons.lang.ArrayUtils;
29  import org.apache.commons.lang.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 AbstractUIInput implements InputSuggest2, 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      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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
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 1.6.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 1.6.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   */
226   public java.lang.Integer getSuggestDelay() {
227     Number value  = (Number) getStateHelper().eval(PropertyKeys.suggestDelay);
228     if (value != null) {
229       return value.intValue();
230     }
231     return 300;
232   }
233 
234   public void setSuggestDelay(java.lang.Integer suggestDelay) {
235     getStateHelper().put(PropertyKeys.suggestDelay, suggestDelay);
236   }
237 
238   /**
239   This value will usually be set by the layout manager.
240 
241   */
242   public org.apache.myfaces.tobago.layout.Measure getHeight() {
243     Object object = getStateHelper().eval(PropertyKeys.height);
244     if (object != null) {
245        return Measure.valueOf(object);
246     }
247     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
248   }
249 
250   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
251     getStateHelper().put(PropertyKeys.height, height);
252   }
253 
254   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
255     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
256     if (object != null) {
257        return Measure.valueOf(object);
258     }
259     return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
260   }
261 
262   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
263     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
264   }
265 
266   /**
267   Flag indicating this component should rendered as an inline element.
268   <br />Default: <code>false</code>
269   @deprecated*/
270   @Deprecated
271   public boolean isInline() {
272     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.inline);
273     if (bool != null) {
274       return bool;
275     }
276     return false;
277   }
278 
279   @Deprecated
280   public void setInline(boolean inline) {
281       Deprecation.LOG.error("The attribute 'inline' of 'UIIn' is deprecated. "
282           + "Please refer the documentation for further information.");
283     getStateHelper().put(PropertyKeys.inline, inline);
284   }
285 
286   public java.lang.Integer getRowSpan() {
287     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
288     if (value != null) {
289       return value.intValue();
290     }
291     return 1;
292   }
293 
294   public void setRowSpan(java.lang.Integer rowSpan) {
295     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
296   }
297 
298   /**
299   This value will usually be set by the layout manager.
300 
301   */
302   public org.apache.myfaces.tobago.layout.Measure getLeft() {
303     Object object = getStateHelper().eval(PropertyKeys.left);
304     if (object != null) {
305        return Measure.valueOf(object);
306     }
307     return null;
308   }
309 
310   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
311     getStateHelper().put(PropertyKeys.left, left);
312   }
313 
314   /**
315   Flag indicating this component should receive the focus.
316   <br />Default: <code>false</code>
317   */
318   public boolean isFocus() {
319     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
320     if (bool != null) {
321       return bool;
322     }
323     return false;
324   }
325 
326   public void setFocus(boolean focus) {
327     getStateHelper().put(PropertyKeys.focus, focus);
328   }
329 
330   public java.lang.Integer getColumnSpan() {
331     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
332     if (value != null) {
333       return value.intValue();
334     }
335     return 1;
336   }
337 
338   public void setColumnSpan(java.lang.Integer columnSpan) {
339     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
340   }
341 
342   /**
343   Minimum number of chars to type before the list will be requested.
344   <br />Default: <code>1</code>
345   */
346   public java.lang.Integer getSuggestMinChars() {
347     Number value  = (Number) getStateHelper().eval(PropertyKeys.suggestMinChars);
348     if (value != null) {
349       return value.intValue();
350     }
351     return 1;
352   }
353 
354   public void setSuggestMinChars(java.lang.Integer suggestMinChars) {
355     getStateHelper().put(PropertyKeys.suggestMinChars, suggestMinChars);
356   }
357 
358   /**
359   This value will usually be set by the layout manager.
360 
361   */
362   public org.apache.myfaces.tobago.layout.Measure getTop() {
363     Object object = getStateHelper().eval(PropertyKeys.top);
364     if (object != null) {
365        return Measure.valueOf(object);
366     }
367     return null;
368   }
369 
370   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
371     getStateHelper().put(PropertyKeys.top, top);
372   }
373 
374   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
375     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
376     if (object != null) {
377        return Measure.valueOf(object);
378     }
379     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
380   }
381 
382   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
383     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
384   }
385 
386   /**
387   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
388 
389   */
390   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
391     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
392     if (object != null) {
393        return Measure.valueOf(object);
394     }
395     return getWidth();
396   }
397 
398   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
399     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
400   }
401 
402   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
403     Object object = getStateHelper().eval(PropertyKeys.marginTop);
404     if (object != null) {
405        return Measure.valueOf(object);
406     }
407     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
408   }
409 
410   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
411     getStateHelper().put(PropertyKeys.marginTop, marginTop);
412   }
413 
414   /**
415   This value will usually be set by the layout manager.
416 
417   */
418   public org.apache.myfaces.tobago.layout.Measure getWidth() {
419     Object object = getStateHelper().eval(PropertyKeys.width);
420     if (object != null) {
421        return Measure.valueOf(object);
422     }
423     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
424   }
425 
426   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
427     getStateHelper().put(PropertyKeys.width, width);
428   }
429 
430   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
431     Object object = getStateHelper().eval(PropertyKeys.marginRight);
432     if (object != null) {
433        return Measure.valueOf(object);
434     }
435     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
436   }
437 
438   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
439     getStateHelper().put(PropertyKeys.marginRight, marginRight);
440   }
441 
442   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
443     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
444     if (object != null) {
445        return Measure.valueOf(object);
446     }
447     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
448   }
449 
450   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
451     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
452   }
453 
454   /**
455   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
456 
457   */
458   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
459     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
460     if (object != null) {
461        return Measure.valueOf(object);
462     }
463     return getHeight();
464   }
465 
466   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
467     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
468   }
469 
470   /**
471   A localized user presentable name for this component.
472 
473   */
474   public java.lang.String getLabel() {
475     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
476   }
477 
478   public void setLabel(java.lang.String label) {
479     getStateHelper().put(PropertyKeys.label, label);
480   }
481 
482   /**
483   This attribute is for internal use only.
484 
485   */
486   public org.apache.myfaces.tobago.layout.Display getDisplay() {
487     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
488   }
489 
490   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
491     getStateHelper().put(PropertyKeys.display, display);
492   }
493 
494   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
495     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
496     if (object != null) {
497        return Measure.valueOf(object);
498     }
499     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
500   }
501 
502   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
503     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
504   }
505 
506   public boolean isAutocomplete() {
507     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.autocomplete);
508     if (bool != null) {
509       return bool;
510     }
511     return true;
512   }
513 
514   public void setAutocomplete(boolean autocomplete) {
515     getStateHelper().put(PropertyKeys.autocomplete, autocomplete);
516   }
517 
518   /**
519   Clientside script function to add to this component's onchange handler.
520 
521   */
522   public java.lang.String getOnchange() {
523     return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
524   }
525 
526   public void setOnchange(java.lang.String onchange) {
527     getStateHelper().put(PropertyKeys.onchange, onchange);
528   }
529 
530   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
531     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
532     if (object != null) {
533        return Measure.valueOf(object);
534     }
535     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
536   }
537 
538   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
539     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
540   }
541 
542   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
543     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
544     if (object != null) {
545        return Measure.valueOf(object);
546     }
547     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
548   }
549 
550   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
551     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
552   }
553 
554   /**
555   This attribute is for internal use only.
556 
557   */
558   public java.lang.Integer getVerticalIndex() {
559     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
560     if (value != null) {
561       return value.intValue();
562     }
563     return null;
564   }
565 
566   public void setVerticalIndex(java.lang.Integer verticalIndex) {
567     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
568   }
569 
570   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
571     if (currentMarkup != null) {
572       return currentMarkup;
573     }
574     return null;
575   }
576 
577   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
578     this.currentMarkup = currentMarkup;
579   }
580 
581   /**
582   This attribute is for internal use only.
583 
584   */
585   public java.lang.Integer getHorizontalIndex() {
586     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
587     if (value != null) {
588       return value.intValue();
589     }
590     return null;
591   }
592 
593   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
594     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
595   }
596 
597   /**
598   Flag indicating that this component will prohibit changes by the user.
599   <br />Default: <code>false</code>
600   */
601   public boolean isReadonly() {
602     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
603     if (bool != null) {
604       return bool;
605     }
606     return false;
607   }
608 
609   public void setReadonly(boolean readonly) {
610     getStateHelper().put(PropertyKeys.readonly, readonly);
611   }
612 
613   /**
614   Flag indicating that this element is disabled.
615   <br />Default: <code>false</code>
616   */
617   public boolean isDisabled() {
618     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
619     if (bool != null) {
620       return bool;
621     }
622     return false;
623   }
624 
625   public void setDisabled(boolean disabled) {
626     getStateHelper().put(PropertyKeys.disabled, disabled);
627   }
628 
629   public Object saveState(FacesContext context) {
630     currentMarkup = null;
631     return super.saveState(context);
632   }
633 
634 
635 }