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.renderkit.css.CustomClass;
26  import org.apache.myfaces.tobago.renderkit.css.Style;
27  import org.apache.myfaces.tobago.sanitizer.SanitizeMode;
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 javax.el.ELException;
32  import javax.faces.FacesException;
33  import java.util.ArrayList;
34  import java.util.List;
35  import javax.el.MethodExpression;
36  import javax.el.ValueExpression;
37  
38  /** 
39   Renders a multi line text input control.
40    * UIComponent class, generated from template {@code component.stg} with class
41    * {@link org.apache.myfaces.tobago.internal.taglib.component.TextareaTagDeclaration}.
42   */
43  public class UITextarea
44      extends AbstractUITextarea implements Visual {
45  
46    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Textarea";
47  
48    public static final String COMPONENT_FAMILY = "javax.faces.Input";
49  
50  
51    enum PropertyKeys {
52      markup,
53      labelLayout,
54      focus,
55      tabIndex,
56      label,
57      rows,
58      readonly,
59      accessKey,
60      customClass,
61      disabled,
62      tip,
63      style,
64      sanitize,
65    }
66  
67    public String getFamily() {
68      return COMPONENT_FAMILY;
69    }
70  
71  
72    public org.apache.myfaces.tobago.context.Markup getMarkup() {
73      Object object = getStateHelper().eval(PropertyKeys.markup);
74      if (object != null) {
75        return Markup.valueOf(object);
76      }
77      return null;
78    }
79  
80    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
81      getStateHelper().put(PropertyKeys.markup, markup);
82    }
83  
84    /**
85    Defines the position of the label relative to the field.
86     The default is flexLeft, if the label is set, or none, if the label isn't set.
87  
88    */
89    public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
90      org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
91      if (labelLayout != null) {
92        return labelLayout;
93      }
94      return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
95    }
96  
97    public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
98      getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
99    }
100 
101   /**
102   Flag indicating this component should receive the focus.
103   <br>Default: <code>false</code>
104   */
105   public boolean isFocus() {
106     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
107     if (bool != null) {
108       return bool;
109     }
110     return false;
111   }
112 
113   public void setFocus(boolean focus) {
114     getStateHelper().put(PropertyKeys.focus, focus);
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   /**
141   Text value to display as label.
142    If text contains an underscore the next character is used as accesskey (if configured so and possible).
143 
144   */
145   public java.lang.String getLabel() {
146     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
147   }
148 
149   public void setLabel(java.lang.String label) {
150     getStateHelper().put(PropertyKeys.label, label);
151   }
152 
153   /**
154   The row count for this component.
155 
156   */
157   public java.lang.Integer getRows() {
158     Number value  = (Number) getStateHelper().eval(PropertyKeys.rows);
159     if (value != null) {
160       return value.intValue();
161     }
162     return null;
163   }
164 
165   public void setRows(java.lang.Integer rows) {
166     getStateHelper().put(PropertyKeys.rows, rows);
167   }
168 
169   /**
170   Flag indicating that this component will prohibit changes by the user.
171   <br>Default: <code>false</code>
172   */
173   public boolean isReadonly() {
174     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
175     if (bool != null) {
176       return bool;
177     }
178     return false;
179   }
180 
181   public void setReadonly(boolean readonly) {
182     getStateHelper().put(PropertyKeys.readonly, readonly);
183   }
184 
185   /**
186   The access key of this control.
187 
188   */
189   public java.lang.Character getAccessKey() {
190     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
191   }
192 
193   public void setAccessKey(java.lang.Character accessKey) {
194     getStateHelper().put(PropertyKeys.accessKey, accessKey);
195   }
196 
197   /**
198   Sets a CSS class in its parent, if the parent supports it.
199 
200    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
201 
202    <pre>
203    &lt;tc:in&gt;
204      &lt;tc:style customClass="my-emphasized"/&gt;
205    &lt;/tc:in&gt;
206    </pre>
207 
208    One capability is, to used external CSS libs.
209    <br>
210    This feature should not be used imprudent.
211    Because it might be unstable against changes in the renderered HTML code.
212 
213   */
214   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
215     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
216   }
217 
218   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
219     getStateHelper().put(PropertyKeys.customClass, customClass);
220   }
221 
222   /**
223   Flag indicating that this element is disabled.
224   <br>Default: <code>false</code>
225   */
226   public boolean isDisabled() {
227     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
228     if (bool != null) {
229       return bool;
230     }
231     return false;
232   }
233 
234   public void setDisabled(boolean disabled) {
235     getStateHelper().put(PropertyKeys.disabled, disabled);
236   }
237 
238   /**
239   Text value to display as tooltip.
240 
241   */
242   public java.lang.String getTip() {
243     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
244   }
245 
246   public void setTip(java.lang.String tip) {
247     getStateHelper().put(PropertyKeys.tip, tip);
248   }
249 
250   /**
251   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
252 
253   */
254   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
255     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
256   }
257 
258   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
259     getStateHelper().put(PropertyKeys.style, style);
260   }
261 
262   /**
263   Should HTML content sanitized?
264    The effect of sanitizing depends on the configuration.
265    The value "auto" means, that sanitizing take place for
266    <ul>
267      <li>tc:out when escape="false" or</li>
268      <li>tc:textarea when attribute data-html-editor is set,</li>
269    </ul>
270    because that are the critical parts.
271   <br>Default: <code>auto</code><br>Allowed Values: <code>auto,never</code>
272   */
273   public org.apache.myfaces.tobago.sanitizer.SanitizeMode getSanitize() {
274     org.apache.myfaces.tobago.sanitizer.SanitizeMode sanitize = (org.apache.myfaces.tobago.sanitizer.SanitizeMode) getStateHelper().eval(PropertyKeys.sanitize);
275     if (sanitize != null) {
276       return sanitize;
277     }
278     return org.apache.myfaces.tobago.sanitizer.SanitizeMode.auto;
279   }
280 
281   public void setSanitize(org.apache.myfaces.tobago.sanitizer.SanitizeMode sanitize) {
282     getStateHelper().put(PropertyKeys.sanitize, sanitize);
283   }
284 
285 
286 }