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