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.AbstractUIFile;
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 javax.el.ELException;
30  import javax.faces.FacesException;
31  import java.util.Arrays;
32  import java.util.ArrayList;
33  import java.util.Collection;
34  import java.util.List;
35  import javax.el.MethodExpression;
36  import javax.el.ValueExpression;
37  
38  /** 
39   <p>
40    Renders a file input field.
41    </p>
42    <p>
43    For content constraints please use <a href="validateFileItem.html">tc:validateFileItem</a>.
44    </p>
45    * UIComponent class, generated from template {@code component.stg} with class
46    * {@link org.apache.myfaces.tobago.internal.taglib.component.FileTagDeclaration}.
47   */
48  public class UIFile
49      extends AbstractUIFile implements Visual {
50  
51    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.File";
52  
53    public static final String COMPONENT_FAMILY = "javax.faces.Input";
54  
55    private static final Collection<String> EVENT_NAMES = Arrays.asList("change", "click", "dblclick", "focus", "blur");
56  
57    @Override
58    public Collection<String> getEventNames() {
59      return EVENT_NAMES;
60    }
61  
62    @Override
63    public String getDefaultEventName() {
64      return "change";
65    }
66  
67  
68    enum PropertyKeys {
69      markup,
70      labelLayout,
71      multiple,
72      focus,
73      tabIndex,
74      label,
75      readonly,
76      accessKey,
77      customClass,
78      disabled,
79      tip,
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   public boolean isMultiple() {
119     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.multiple);
120     if (bool != null) {
121       return bool;
122     }
123     return false;
124   }
125 
126   public void setMultiple(boolean multiple) {
127     getStateHelper().put(PropertyKeys.multiple, multiple);
128   }
129 
130   /**
131   Flag indicating this component should receive the focus.
132   <br>Default: <code>false</code>
133   */
134   public boolean isFocus() {
135     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
136     if (bool != null) {
137       return bool;
138     }
139     return false;
140   }
141 
142   public void setFocus(boolean focus) {
143     getStateHelper().put(PropertyKeys.focus, focus);
144   }
145 
146   /**
147   Controls the navigation of the focus through the
148    input controls on a page with the Tab-Key.
149    The navigation starts from the element with
150    the lowest tabIndex value to the element with the highest value.
151    Elements that have identical tabIndex values should be navigated
152    in the order they appear in the character stream
153    Elements that are disabled or with a negative tabIndex
154    do not participate in the tabbing order.
155 
156   */
157   public java.lang.Integer getTabIndex() {
158     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
159     if (value != null) {
160       return value.intValue();
161     }
162     return null;
163   }
164 
165   public void setTabIndex(java.lang.Integer tabIndex) {
166     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
167   }
168 
169   /**
170   A localized user presentable label for this component.
171 
172   */
173   public java.lang.String getLabel() {
174     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
175   }
176 
177   public void setLabel(java.lang.String label) {
178     getStateHelper().put(PropertyKeys.label, label);
179   }
180 
181   /**
182   Flag indicating that this component will prohibit changes by the user.
183   <br>Default: <code>false</code>
184   */
185   public boolean isReadonly() {
186     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
187     if (bool != null) {
188       return bool;
189     }
190     return false;
191   }
192 
193   public void setReadonly(boolean readonly) {
194     getStateHelper().put(PropertyKeys.readonly, readonly);
195   }
196 
197   /**
198   The access key of this control.
199 
200   */
201   public java.lang.Character getAccessKey() {
202     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
203   }
204 
205   public void setAccessKey(java.lang.Character accessKey) {
206     getStateHelper().put(PropertyKeys.accessKey, accessKey);
207   }
208 
209   /**
210   Sets a CSS class in its parent, if the parent supports it.
211 
212    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
213 
214    <pre>
215    &lt;tc:in&gt;
216      &lt;tc:style customClass="my-emphasized"/&gt;
217    &lt;/tc:in&gt;
218    </pre>
219 
220    One capability is, to used external CSS libs.
221    <br>
222    This feature should not be used imprudent.
223    Because it might be unstable against changes in the renderered HTML code.
224 
225   */
226   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
227     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
228   }
229 
230   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
231     getStateHelper().put(PropertyKeys.customClass, customClass);
232   }
233 
234   /**
235   Flag indicating that this element is disabled.
236   <br>Default: <code>false</code>
237   */
238   public boolean isDisabled() {
239     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
240     if (bool != null) {
241       return bool;
242     }
243     return false;
244   }
245 
246   public void setDisabled(boolean disabled) {
247     getStateHelper().put(PropertyKeys.disabled, disabled);
248   }
249 
250   /**
251   Text value to display as tooltip.
252 
253   */
254   public java.lang.String getTip() {
255     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
256   }
257 
258   public void setTip(java.lang.String tip) {
259     getStateHelper().put(PropertyKeys.tip, tip);
260   }
261 
262 
263 }