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