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