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.AbstractUIInput;
25  import org.apache.myfaces.tobago.layout.Display;
26  import org.apache.myfaces.tobago.layout.Measure;
27  import org.apache.commons.lang.ArrayUtils;
28  import org.apache.commons.lang.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 AbstractUIInput 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       Deprecation.LOG.error("The attribute 'accessKey' of 'UITextarea' is deprecated. "
113           + "Please refer the documentation for further information.");
114     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
115   }
116 
117   @Deprecated
118   public void setAccessKey(java.lang.Character accessKey) {
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
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       Deprecation.LOG.error("The attribute 'labelWithAccessKey' of 'UITextarea' is deprecated. "
143           + "Please refer the documentation for further information.");
144     return (java.lang.String) getStateHelper().eval(PropertyKeys.labelWithAccessKey);
145   }
146 
147   @Deprecated
148   public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) {
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
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 ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
426   }
427 
428   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
429     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
430   }
431 
432   /**
433   Clientside script function to add to this component's onchange handler.
434 
435   */
436   public java.lang.String getOnchange() {
437     return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
438   }
439 
440   public void setOnchange(java.lang.String onchange) {
441     getStateHelper().put(PropertyKeys.onchange, onchange);
442   }
443 
444   /**
445   The row count for this component.
446 
447   */
448   public java.lang.String getRows() {
449     return (java.lang.String) getStateHelper().eval(PropertyKeys.rows);
450   }
451 
452   public void setRows(java.lang.String rows) {
453     getStateHelper().put(PropertyKeys.rows, rows);
454   }
455 
456   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
457     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
458     if (object != null) {
459        return Measure.valueOf(object);
460     }
461     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
462   }
463 
464   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
465     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
466   }
467 
468   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
469     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
470     if (object != null) {
471        return Measure.valueOf(object);
472     }
473     return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
474   }
475 
476   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
477     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
478   }
479 
480   /**
481   This attribute is for internal use only.
482 
483   */
484   public java.lang.Integer getVerticalIndex() {
485     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
486     if (value != null) {
487       return value.intValue();
488     }
489     return null;
490   }
491 
492   public void setVerticalIndex(java.lang.Integer verticalIndex) {
493     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
494   }
495 
496   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
497     if (currentMarkup != null) {
498       return currentMarkup;
499     }
500     return null;
501   }
502 
503   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
504     this.currentMarkup = currentMarkup;
505   }
506 
507   /**
508   This attribute is for internal use only.
509 
510   */
511   public java.lang.Integer getHorizontalIndex() {
512     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
513     if (value != null) {
514       return value.intValue();
515     }
516     return null;
517   }
518 
519   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
520     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
521   }
522 
523   /**
524   Flag indicating that this component will prohibit changes by the user.
525   <br />Default: <code>false</code>
526   */
527   public boolean isReadonly() {
528     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
529     if (bool != null) {
530       return bool;
531     }
532     return false;
533   }
534 
535   public void setReadonly(boolean readonly) {
536     getStateHelper().put(PropertyKeys.readonly, readonly);
537   }
538 
539   /**
540   Flag indicating that this element is disabled.
541   <br />Default: <code>false</code>
542   */
543   public boolean isDisabled() {
544     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
545     if (bool != null) {
546       return bool;
547     }
548     return false;
549   }
550 
551   public void setDisabled(boolean disabled) {
552     getStateHelper().put(PropertyKeys.disabled, disabled);
553   }
554 
555   public Object saveState(FacesContext context) {
556     currentMarkup = null;
557     return super.saveState(context);
558   }
559 
560 
561 }