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