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.Arrays;
34  import java.util.ArrayList;
35  import java.util.Collection;
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 component.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.TextareaTagDeclaration}.
44   */
45  public class UITextarea
46      extends AbstractUITextarea implements Visual {
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 static final Collection<String> EVENT_NAMES = Arrays.asList("change", "click", "dblclick", "focus", "blur");
53  
54    @Override
55    public Collection<String> getEventNames() {
56      return EVENT_NAMES;
57    }
58  
59    @Override
60    public String getDefaultEventName() {
61      return "change";
62    }
63  
64  
65    enum PropertyKeys {
66      markup,
67      labelLayout,
68      focus,
69      tabIndex,
70      label,
71      rows,
72      readonly,
73      accessKey,
74      customClass,
75      disabled,
76      tip,
77      style,
78      sanitize,
79    }
80  
81    public String getFamily() {
82      return COMPONENT_FAMILY;
83    }
84  
85  
86    public org.apache.myfaces.tobago.context.Markup getMarkup() {
87      Object object = getStateHelper().eval(PropertyKeys.markup);
88      if (object != null) {
89        return Markup.valueOf(object);
90      }
91      return null;
92    }
93  
94    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
95      getStateHelper().put(PropertyKeys.markup, markup);
96    }
97  
98    /**
99    Defines the position of the label relative to the field.
100    The default is flexLeft, if the label is set, or none, if the label isn't set.
101 
102   */
103   public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
104     org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
105     if (labelLayout != null) {
106       return labelLayout;
107     }
108     return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
109   }
110 
111   public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
112     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
113   }
114 
115   /**
116   Flag indicating this component should receive the focus.
117   <br>Default: <code>false</code>
118   */
119   public boolean isFocus() {
120     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
121     if (bool != null) {
122       return bool;
123     }
124     return false;
125   }
126 
127   public void setFocus(boolean focus) {
128     getStateHelper().put(PropertyKeys.focus, focus);
129   }
130 
131   /**
132   Controls the navigation of the focus through the
133    input controls on a page with the Tab-Key.
134    The navigation starts from the element with
135    the lowest tabIndex value to the element with the highest value.
136    Elements that have identical tabIndex values should be navigated
137    in the order they appear in the character stream
138    Elements that are disabled or with a negative tabIndex
139    do not participate in the tabbing order.
140 
141   */
142   public java.lang.Integer getTabIndex() {
143     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
144     if (value != null) {
145       return value.intValue();
146     }
147     return null;
148   }
149 
150   public void setTabIndex(java.lang.Integer tabIndex) {
151     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
152   }
153 
154   /**
155   A localized user presentable label for this component.
156 
157   */
158   public java.lang.String getLabel() {
159     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
160   }
161 
162   public void setLabel(java.lang.String label) {
163     getStateHelper().put(PropertyKeys.label, label);
164   }
165 
166   /**
167   The row count for this component.
168 
169   */
170   public java.lang.Integer getRows() {
171     Number value  = (Number) getStateHelper().eval(PropertyKeys.rows);
172     if (value != null) {
173       return value.intValue();
174     }
175     return null;
176   }
177 
178   public void setRows(java.lang.Integer rows) {
179     getStateHelper().put(PropertyKeys.rows, rows);
180   }
181 
182   /**
183   Flag indicating that this component will prohibit changes by the user.
184   <br>Default: <code>false</code>
185   */
186   public boolean isReadonly() {
187     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
188     if (bool != null) {
189       return bool;
190     }
191     return false;
192   }
193 
194   public void setReadonly(boolean readonly) {
195     getStateHelper().put(PropertyKeys.readonly, readonly);
196   }
197 
198   /**
199   The access key of this control.
200 
201   */
202   public java.lang.Character getAccessKey() {
203     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
204   }
205 
206   public void setAccessKey(java.lang.Character accessKey) {
207     getStateHelper().put(PropertyKeys.accessKey, accessKey);
208   }
209 
210   /**
211   Sets a CSS class in its parent, if the parent supports it.
212 
213    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
214 
215    <pre>
216    &lt;tc:in&gt;
217      &lt;tc:style customClass="my-emphasized"/&gt;
218    &lt;/tc:in&gt;
219    </pre>
220 
221    One capability is, to used external CSS libs.
222    <br>
223    This feature should not be used imprudent.
224    Because it might be unstable against changes in the renderered HTML code.
225 
226   */
227   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
228     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
229   }
230 
231   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
232     getStateHelper().put(PropertyKeys.customClass, customClass);
233   }
234 
235   /**
236   Flag indicating that this element is disabled.
237   <br>Default: <code>false</code>
238   */
239   public boolean isDisabled() {
240     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
241     if (bool != null) {
242       return bool;
243     }
244     return false;
245   }
246 
247   public void setDisabled(boolean disabled) {
248     getStateHelper().put(PropertyKeys.disabled, disabled);
249   }
250 
251   /**
252   Text value to display as tooltip.
253 
254   */
255   public java.lang.String getTip() {
256     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
257   }
258 
259   public void setTip(java.lang.String tip) {
260     getStateHelper().put(PropertyKeys.tip, tip);
261   }
262 
263   /**
264   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
265 
266   */
267   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
268     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
269   }
270 
271   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
272     getStateHelper().put(PropertyKeys.style, style);
273   }
274 
275   /**
276   Should HTML content sanitized?
277    The effect of sanitizing depends on the configuration.
278    The value "auto" means, that sanitizing take place for
279    <ul>
280      <li>tc:out when escape="false" or</li>
281      <li>tc:textarea when attribute data-html-editor is set,</li>
282    </ul>
283    because that are the critical parts.
284   <br>Default: <code>auto</code><br>Allowed Values: <code>auto,never</code>
285   */
286   public org.apache.myfaces.tobago.sanitizer.SanitizeMode getSanitize() {
287     org.apache.myfaces.tobago.sanitizer.SanitizeMode sanitize = (org.apache.myfaces.tobago.sanitizer.SanitizeMode) getStateHelper().eval(PropertyKeys.sanitize);
288     if (sanitize != null) {
289       return sanitize;
290     }
291     return org.apache.myfaces.tobago.sanitizer.SanitizeMode.auto;
292   }
293 
294   public void setSanitize(org.apache.myfaces.tobago.sanitizer.SanitizeMode sanitize) {
295     getStateHelper().put(PropertyKeys.sanitize, sanitize);
296   }
297 
298 
299 }