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      focus,
59      tabIndex,
60      label,
61      readonly,
62      customClass,
63      disabled,
64      tip,
65      style,
66    }
67  
68    public String getFamily() {
69      return COMPONENT_FAMILY;
70    }
71  
72  
73    public org.apache.myfaces.tobago.context.Markup getMarkup() {
74      Object object = getStateHelper().eval(PropertyKeys.markup);
75      if (object != null) {
76        return Markup.valueOf(object);
77      }
78      return null;
79    }
80  
81    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
82      getStateHelper().put(PropertyKeys.markup, markup);
83    }
84  
85    /**
86    Defines the position of the label relative to the field.
87     The default is flexLeft, if the label is set, or none, if the label isn't set.
88  
89    */
90    public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
91      org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
92      if (labelLayout != null) {
93        return labelLayout;
94      }
95      return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
96    }
97  
98    public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
99      getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
100   }
101 
102   /**
103   Flag indicating this component should receive the focus.
104   <br>Default: <code>false</code>
105   */
106   public boolean isFocus() {
107     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
108     if (bool != null) {
109       return bool;
110     }
111     return false;
112   }
113 
114   public void setFocus(boolean focus) {
115     getStateHelper().put(PropertyKeys.focus, focus);
116   }
117 
118   /**
119   Controls the navigation of the focus through the
120    input controls on a page with the Tab-Key.
121    The navigation starts from the element with
122    the lowest tabIndex value to the element with the highest value.
123    Elements that have identical tabIndex values should be navigated
124    in the order they appear in the character stream
125    Elements that are disabled or with a negative tabIndex
126    do not participate in the tabbing order.
127 
128   */
129   public java.lang.Integer getTabIndex() {
130     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
131     if (value != null) {
132       return value.intValue();
133     }
134     return null;
135   }
136 
137   public void setTabIndex(java.lang.Integer tabIndex) {
138     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
139   }
140 
141   /**
142   Text value to display as label.
143    If text contains an underscore the next character is used as accesskey (if configured so and possible).
144 
145   */
146   public java.lang.String getLabel() {
147     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
148   }
149 
150   public void setLabel(java.lang.String label) {
151     getStateHelper().put(PropertyKeys.label, label);
152   }
153 
154   /**
155   Flag indicating that this component will prohibit changes by the user.
156   <br>Default: <code>false</code>
157   */
158   public boolean isReadonly() {
159     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
160     if (bool != null) {
161       return bool;
162     }
163     return false;
164   }
165 
166   public void setReadonly(boolean readonly) {
167     getStateHelper().put(PropertyKeys.readonly, readonly);
168   }
169 
170   /**
171   Sets a CSS class in its parent, if the parent supports it.
172 
173    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
174 
175    <pre>
176    &lt;tc:in&gt;
177      &lt;tc:style customClass="my-emphasized"/&gt;
178    &lt;/tc:in&gt;
179    </pre>
180 
181    One capability is, to used external CSS libs.
182    <br>
183    This feature should not be used imprudent.
184    Because it might be unstable against changes in the renderered HTML code.
185 
186   */
187   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
188     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
189   }
190 
191   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
192     getStateHelper().put(PropertyKeys.customClass, customClass);
193   }
194 
195   /**
196   Flag indicating that this element is disabled.
197   <br>Default: <code>false</code>
198   */
199   public boolean isDisabled() {
200     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
201     if (bool != null) {
202       return bool;
203     }
204     return false;
205   }
206 
207   public void setDisabled(boolean disabled) {
208     getStateHelper().put(PropertyKeys.disabled, disabled);
209   }
210 
211   /**
212   Text value to display as tooltip.
213 
214   */
215   public java.lang.String getTip() {
216     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
217   }
218 
219   public void setTip(java.lang.String tip) {
220     getStateHelper().put(PropertyKeys.tip, tip);
221   }
222 
223   /**
224   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
225 
226   */
227   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
228     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
229   }
230 
231   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
232     getStateHelper().put(PropertyKeys.style, style);
233   }
234 
235 
236 }