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.renderkit.css.Style;
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 text input field.
41    * UIComponent class, generated from template {@code component.stg} with class
42    * {@link org.apache.myfaces.tobago.internal.taglib.component.InTagDeclaration}.
43   */
44  public class UIIn
45      extends AbstractUIIn implements Visual {
46  
47    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.In";
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      autocomplete,
67      labelLayout,
68      focus,
69      tabIndex,
70      label,
71      password,
72      readonly,
73      accessKey,
74      customClass,
75      disabled,
76      tip,
77      style,
78      placeholder,
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    public boolean isAutocomplete() {
99      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.autocomplete);
100     if (bool != null) {
101       return bool;
102     }
103     return true;
104   }
105 
106   public void setAutocomplete(boolean autocomplete) {
107     getStateHelper().put(PropertyKeys.autocomplete, autocomplete);
108   }
109 
110   /**
111   Defines the position of the label relative to the field.
112    The default is flexLeft, if the label is set, or none, if the label isn't set.
113 
114   */
115   public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
116     org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
117     if (labelLayout != null) {
118       return labelLayout;
119     }
120     return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
121   }
122 
123   public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
124     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
125   }
126 
127   /**
128   Flag indicating this component should receive the focus.
129   <br>Default: <code>false</code>
130   */
131   public boolean isFocus() {
132     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
133     if (bool != null) {
134       return bool;
135     }
136     return false;
137   }
138 
139   public void setFocus(boolean focus) {
140     getStateHelper().put(PropertyKeys.focus, focus);
141   }
142 
143   /**
144   Controls the navigation of the focus through the
145    input controls on a page with the Tab-Key.
146    The navigation starts from the element with
147    the lowest tabIndex value to the element with the highest value.
148    Elements that have identical tabIndex values should be navigated
149    in the order they appear in the character stream
150    Elements that are disabled or with a negative tabIndex
151    do not participate in the tabbing order.
152 
153   */
154   public java.lang.Integer getTabIndex() {
155     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
156     if (value != null) {
157       return value.intValue();
158     }
159     return null;
160   }
161 
162   public void setTabIndex(java.lang.Integer tabIndex) {
163     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
164   }
165 
166   /**
167   A localized user presentable label for this component.
168 
169   */
170   public java.lang.String getLabel() {
171     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
172   }
173 
174   public void setLabel(java.lang.String label) {
175     getStateHelper().put(PropertyKeys.label, label);
176   }
177 
178   /**
179   Flag indicating whether or not this component should be rendered as
180    password field , so you will not see the typed charakters.
181   <br>Default: <code>false</code>
182   */
183   public boolean isPassword() {
184     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.password);
185     if (bool != null) {
186       return bool;
187     }
188     return false;
189   }
190 
191   public void setPassword(boolean password) {
192     getStateHelper().put(PropertyKeys.password, password);
193   }
194 
195   /**
196   Flag indicating that this component will prohibit changes by the user.
197   <br>Default: <code>false</code>
198   */
199   public boolean isReadonly() {
200     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
201     if (bool != null) {
202       return bool;
203     }
204     return false;
205   }
206 
207   public void setReadonly(boolean readonly) {
208     getStateHelper().put(PropertyKeys.readonly, readonly);
209   }
210 
211   /**
212   The access key of this control.
213 
214   */
215   public java.lang.Character getAccessKey() {
216     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
217   }
218 
219   public void setAccessKey(java.lang.Character accessKey) {
220     getStateHelper().put(PropertyKeys.accessKey, accessKey);
221   }
222 
223   /**
224   Sets a CSS class in its parent, if the parent supports it.
225 
226    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
227 
228    <pre>
229    &lt;tc:in&gt;
230      &lt;tc:style customClass="my-emphasized"/&gt;
231    &lt;/tc:in&gt;
232    </pre>
233 
234    One capability is, to used external CSS libs.
235    <br>
236    This feature should not be used imprudent.
237    Because it might be unstable against changes in the renderered HTML code.
238 
239   */
240   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
241     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
242   }
243 
244   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
245     getStateHelper().put(PropertyKeys.customClass, customClass);
246   }
247 
248   /**
249   Flag indicating that this element is disabled.
250   <br>Default: <code>false</code>
251   */
252   public boolean isDisabled() {
253     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
254     if (bool != null) {
255       return bool;
256     }
257     return false;
258   }
259 
260   public void setDisabled(boolean disabled) {
261     getStateHelper().put(PropertyKeys.disabled, disabled);
262   }
263 
264   /**
265   Text value to display as tooltip.
266 
267   */
268   public java.lang.String getTip() {
269     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
270   }
271 
272   public void setTip(java.lang.String tip) {
273     getStateHelper().put(PropertyKeys.tip, tip);
274   }
275 
276   /**
277   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
278 
279   */
280   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
281     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
282   }
283 
284   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
285     getStateHelper().put(PropertyKeys.style, style);
286   }
287 
288   /**
289   <p>
290    Displays a short text in the input field, that describes the meaning of this field.
291    This is part of HTML 5, the theme should emulate the behaviour, when the browser doesn't support it.
292    </p>
293    <p>
294    The text will not be displayed, when the input field is readonly or disabled.
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 }