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.AbstractUIIn;
25  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
26  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
27  import org.apache.myfaces.tobago.internal.util.StringUtils;
28  import org.apache.myfaces.tobago.internal.util.Deprecation;
29  import org.apache.myfaces.tobago.component.Tags;
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 text input field.
42    * UIComponent class, generated from template {@code component.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.InTagDeclaration}.
44   */
45  @Generated("component.stg")
46  public class UIIn
47      extends AbstractUIIn  {
48  
49    public static final String COMPONENT_TYPE = Tags.in.componentType();
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      autocomplete,
69      labelLayout,
70      focus,
71      tabIndex,
72      label,
73      help,
74      password,
75      readonly,
76      accessKey,
77      customClass,
78      disabled,
79      tip,
80      placeholder,
81    }
82  
83    public String getFamily() {
84      return COMPONENT_FAMILY;
85    }
86  
87  
88    public org.apache.myfaces.tobago.context.Markup getMarkup() {
89      Object object = getStateHelper().eval(PropertyKeys.markup);
90      if (object != null) {
91        return Markup.valueOf(object);
92      }
93      return null;
94    }
95  
96    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
97      getStateHelper().put(PropertyKeys.markup, markup);
98    }
99  
100   public boolean isAutocomplete() {
101     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.autocomplete);
102     if (bool != null) {
103       return bool;
104     }
105     return true;
106   }
107 
108   public void setAutocomplete(boolean autocomplete) {
109     getStateHelper().put(PropertyKeys.autocomplete, autocomplete);
110   }
111 
112   /**
113   Defines the position of the label relative to the field.
114    The default is flexLeft, if the label is set, or none, if the label isn't set.
115    Set to 'skip' to avoid surrounding label container.
116    Hint for tc:out: set also compact=true to render only text (without html tags).
117 
118   */
119   public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
120     org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
121     if (labelLayout != null) {
122       return labelLayout;
123     }
124     return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
125   }
126 
127   public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
128     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
129   }
130 
131   /**
132   Flag indicating this component should receive the focus.
133   <br>Default: <code>false</code>
134   */
135   public boolean isFocus() {
136     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
137     if (bool != null) {
138       return bool;
139     }
140     return false;
141   }
142 
143   public void setFocus(boolean focus) {
144     getStateHelper().put(PropertyKeys.focus, focus);
145   }
146 
147   /**
148   Controls the navigation of the focus through the
149    input controls on a page with the Tab-Key.
150    The navigation starts from the element with
151    the lowest tabIndex value to the element with the highest value.
152    Elements that have identical tabIndex values should be navigated
153    in the order they appear in the character stream
154    Elements that are disabled or with a negative tabIndex
155    do not participate in the tabbing order.
156 
157   */
158   public java.lang.Integer getTabIndex() {
159     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
160     if (value != null) {
161       return value.intValue();
162     }
163     return null;
164   }
165 
166   public void setTabIndex(java.lang.Integer tabIndex) {
167     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
168   }
169 
170   /**
171   A localized user presentable label for this component.
172 
173   */
174   public java.lang.String getLabel() {
175     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
176   }
177 
178   public void setLabel(java.lang.String label) {
179     getStateHelper().put(PropertyKeys.label, label);
180   }
181 
182   /**
183   Text value to display as a help.
184 
185   */
186   public java.lang.String getHelp() {
187     return (java.lang.String) getStateHelper().eval(PropertyKeys.help);
188   }
189 
190   public void setHelp(java.lang.String help) {
191     getStateHelper().put(PropertyKeys.help, help);
192   }
193 
194   /**
195   Flag indicating whether or not this component should be rendered as
196    password field , so you will not see the typed charakters.
197   <br>Default: <code>false</code>
198   */
199   public boolean isPassword() {
200     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.password);
201     if (bool != null) {
202       return bool;
203     }
204     return false;
205   }
206 
207   public void setPassword(boolean password) {
208     getStateHelper().put(PropertyKeys.password, password);
209   }
210 
211   /**
212   Flag indicating that this component will prohibit changes by the user.
213   <br>Default: <code>false</code>
214   */
215   public boolean isReadonly() {
216     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
217     if (bool != null) {
218       return bool;
219     }
220     return false;
221   }
222 
223   public void setReadonly(boolean readonly) {
224     getStateHelper().put(PropertyKeys.readonly, readonly);
225   }
226 
227   /**
228   The access key of this control.
229 
230   */
231   public java.lang.Character getAccessKey() {
232     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
233   }
234 
235   public void setAccessKey(java.lang.Character accessKey) {
236     getStateHelper().put(PropertyKeys.accessKey, accessKey);
237   }
238 
239   /**
240   Sets a CSS class in its parent, if the parent supports it.
241 
242    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
243 
244    <pre>
245    &lt;tc:in&gt;
246      &lt;tc:style customClass="my-emphasized"/&gt;
247    &lt;/tc:in&gt;
248    </pre>
249 
250    One capability is, to used external CSS libs.
251    <br>
252    This feature should not be used imprudent.
253    Because it might be unstable against changes in the renderered HTML code.
254 
255   */
256   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
257     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
258   }
259 
260   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
261     getStateHelper().put(PropertyKeys.customClass, customClass);
262   }
263 
264   /**
265   Flag indicating that this element is disabled.
266   <br>Default: <code>false</code>
267   */
268   public boolean isDisabled() {
269     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
270     if (bool != null) {
271       return bool;
272     }
273     return false;
274   }
275 
276   public void setDisabled(boolean disabled) {
277     getStateHelper().put(PropertyKeys.disabled, disabled);
278   }
279 
280   /**
281   Text value to display as tooltip.
282 
283   */
284   public java.lang.String getTip() {
285     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
286   }
287 
288   public void setTip(java.lang.String tip) {
289     getStateHelper().put(PropertyKeys.tip, tip);
290   }
291 
292   /**
293   <p>
294    Displays a short text in the input field, that describes the meaning of this field.
295    </p>
296 
297   */
298   public java.lang.String getPlaceholder() {
299     return (java.lang.String) getStateHelper().eval(PropertyKeys.placeholder);
300   }
301 
302   public void setPlaceholder(java.lang.String placeholder) {
303     getStateHelper().put(PropertyKeys.placeholder, placeholder);
304   }
305 
306 
307   @Override
308   public void restoreState(FacesContext context, Object state) {
309     // FIXME HACK for mojarra SystemEventListener state restoring bug
310     pushComponentToEL(context, this);
311     super.restoreState(context, state);
312     popComponentFromEL(context);
313   }
314 
315 }