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