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