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.AbstractUIDate;
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   Renders a date input field.
39    <p>
40    For a time input field set you'll need to set the &lt;f:convertDateTime type="time"&gt; inside the &lt;tc:date&gt;.
41    <p>
42    If there is no converter given, a default instance of {
43    * UIComponent class, generated from template {@code component.stg} with class
44    * {@link org.apache.myfaces.tobago.internal.taglib.component.DateTagDeclaration}.
45   */
46  public class UIDate
47      extends AbstractUIDate implements Visual {
48  
49    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Date";
50  
51    public static final String COMPONENT_FAMILY = "javax.faces.Input";
52  
53  
54    enum PropertyKeys {
55      markup,
56      labelLayout,
57      focus,
58      tabIndex,
59      label,
60      readonly,
61      accessKey,
62      customClass,
63      style,
64      disabled,
65      tip,
66      placeholder,
67    }
68  
69    public String getFamily() {
70      return COMPONENT_FAMILY;
71    }
72  
73  
74    public org.apache.myfaces.tobago.context.Markup getMarkup() {
75      Object object = getStateHelper().eval(PropertyKeys.markup);
76      if (object != null) {
77        return Markup.valueOf(object);
78      }
79      return null;
80    }
81  
82    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
83      getStateHelper().put(PropertyKeys.markup, markup);
84    }
85  
86    /**
87    Defines the position of the label relative to the field.
88     The default is flexLeft, if the label is set, or none, if the label isn't set.
89  
90    */
91    public org.apache.myfaces.tobago.component.LabelLayout getLabelLayout() {
92      org.apache.myfaces.tobago.component.LabelLayout labelLayout = (org.apache.myfaces.tobago.component.LabelLayout) getStateHelper().eval(PropertyKeys.labelLayout);
93      if (labelLayout != null) {
94        return labelLayout;
95      }
96      return getLabel() != null ? org.apache.myfaces.tobago.component.LabelLayout.flexLeft : org.apache.myfaces.tobago.component.LabelLayout.none;
97    }
98  
99    public void setLabelLayout(org.apache.myfaces.tobago.component.LabelLayout labelLayout) {
100     getStateHelper().put(PropertyKeys.labelLayout, labelLayout);
101   }
102 
103   /**
104   Flag indicating this component should receive the focus.
105   <br>Default: <code>false</code>
106   */
107   public boolean isFocus() {
108     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
109     if (bool != null) {
110       return bool;
111     }
112     return false;
113   }
114 
115   public void setFocus(boolean focus) {
116     getStateHelper().put(PropertyKeys.focus, focus);
117   }
118 
119   /**
120   Controls the navigation of the focus through the
121    input controls on a page with the Tab-Key.
122    The navigation starts from the element with
123    the lowest tabIndex value to the element with the highest value.
124    Elements that have identical tabIndex values should be navigated
125    in the order they appear in the character stream
126    Elements that are disabled or with a negative tabIndex
127    do not participate in the tabbing order.
128 
129   */
130   public java.lang.Integer getTabIndex() {
131     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
132     if (value != null) {
133       return value.intValue();
134     }
135     return null;
136   }
137 
138   public void setTabIndex(java.lang.Integer tabIndex) {
139     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
140   }
141 
142   /**
143   Text value to display as label.
144    If text contains an underscore the next character is used as accesskey (if configured so and possible).
145 
146   */
147   public java.lang.String getLabel() {
148     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
149   }
150 
151   public void setLabel(java.lang.String label) {
152     getStateHelper().put(PropertyKeys.label, label);
153   }
154 
155   /**
156   Flag indicating that this component will prohibit changes by the user.
157   <br>Default: <code>false</code>
158   */
159   public boolean isReadonly() {
160     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
161     if (bool != null) {
162       return bool;
163     }
164     return false;
165   }
166 
167   public void setReadonly(boolean readonly) {
168     getStateHelper().put(PropertyKeys.readonly, readonly);
169   }
170 
171   /**
172   The access key of this control.
173 
174   */
175   public java.lang.Character getAccessKey() {
176     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
177   }
178 
179   public void setAccessKey(java.lang.Character accessKey) {
180     getStateHelper().put(PropertyKeys.accessKey, accessKey);
181   }
182 
183   /**
184   Sets a CSS class in its parent, if the parent supports it.
185 
186    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
187 
188    <pre>
189    &lt;tc:in&gt;
190      &lt;tc:style customClass="my-emphasized"/&gt;
191    &lt;/tc:in&gt;
192    </pre>
193 
194    One capability is, to used external CSS libs.
195    <br>
196    This feature should not be used imprudent.
197    Because it might be unstable against changes in the renderered HTML code.
198 
199   */
200   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
201     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
202   }
203 
204   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
205     getStateHelper().put(PropertyKeys.customClass, customClass);
206   }
207 
208   /**
209   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
210 
211   */
212   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
213     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
214   }
215 
216   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
217     getStateHelper().put(PropertyKeys.style, style);
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   <p>
250    Displays a short text in the input field, that describes the meaning of this field.
251    This is part of HTML 5, the theme should emulate the behaviour, when the browser doesn't support it.
252    </p>
253    <p>
254    The text will not be displayed, when the input field is readonly or disabled.
255    </p>
256 
257   */
258   public java.lang.String getPlaceholder() {
259     return (java.lang.String) getStateHelper().eval(PropertyKeys.placeholder);
260   }
261 
262   public void setPlaceholder(java.lang.String placeholder) {
263     getStateHelper().put(PropertyKeys.placeholder, placeholder);
264   }
265 
266 
267 }