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