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.layout.Display;
26  import org.apache.myfaces.tobago.layout.Measure;
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 org.apache.myfaces.tobago.renderkit.MarginValues;
31  import org.apache.myfaces.tobago.renderkit.SpacingValues;
32  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.ArrayList;
36  import java.util.List;
37  import javax.el.MethodExpression;
38  import javax.el.ValueExpression;
39  
40  /** 
41   Renders a date input field.
42    * UIComponent class, generated from template {@code component2.0.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.DateTagDeclaration}.
44   */
45  public class UIDate
46      extends AbstractUIDate implements SupportsMarkup {
47  
48    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Date";
49  
50    public static final String COMPONENT_FAMILY = "javax.faces.Input";
51  
52    private org.apache.myfaces.tobago.context.Markup currentMarkup;
53  
54    enum PropertyKeys {
55      markup,
56      marginLeft,
57      tabIndex,
58      minimumHeight,
59      tip,
60      height,
61      minimumWidth,
62      rowSpan,
63      focus,
64      left,
65      columnSpan,
66      top,
67      maximumHeight,
68      currentWidth,
69      marginTop,
70      placeholder,
71      width,
72      marginRight,
73      currentHeight,
74      preferredHeight,
75      label,
76      display,
77      maximumWidth,
78      onchange,
79      preferredWidth,
80      marginBottom,
81      verticalIndex,
82      horizontalIndex,
83      readonly,
84      disabled,
85    }
86  
87    public String getFamily() {
88      return COMPONENT_FAMILY;
89    }
90  
91  
92    public org.apache.myfaces.tobago.context.Markup getMarkup() {
93      Object object = getStateHelper().eval(PropertyKeys.markup);
94      if (object != null) {
95        return Markup.valueOf(object);
96      }
97      return null;
98    }
99  
100   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
101     getStateHelper().put(PropertyKeys.markup, markup);
102   }
103 
104   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
105     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
106     if (object != null) {
107        return Measure.valueOf(object);
108     }
109     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
110   }
111 
112   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
113     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
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   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
140     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
141     if (object != null) {
142        return Measure.valueOf(object);
143     }
144     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
145   }
146 
147   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
148     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
149   }
150 
151   /**
152   Text value to display as tooltip.
153 
154   */
155   public java.lang.String getTip() {
156     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
157   }
158 
159   public void setTip(java.lang.String tip) {
160     getStateHelper().put(PropertyKeys.tip, tip);
161   }
162 
163   /**
164   This value will usually be set by the layout manager.
165 
166   */
167   public org.apache.myfaces.tobago.layout.Measure getHeight() {
168     Object object = getStateHelper().eval(PropertyKeys.height);
169     if (object != null) {
170        return Measure.valueOf(object);
171     }
172     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
173   }
174 
175   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
176     getStateHelper().put(PropertyKeys.height, height);
177   }
178 
179   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
180     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
181     if (object != null) {
182        return Measure.valueOf(object);
183     }
184     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
185   }
186 
187   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
188     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
189   }
190 
191   public java.lang.Integer getRowSpan() {
192     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
193     if (value != null) {
194       return value.intValue();
195     }
196     return 1;
197   }
198 
199   public void setRowSpan(java.lang.Integer rowSpan) {
200     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
201   }
202 
203   /**
204   Flag indicating this component should receive the focus.
205   <br />Default: <code>false</code>
206   */
207   public boolean isFocus() {
208     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
209     if (bool != null) {
210       return bool;
211     }
212     return false;
213   }
214 
215   public void setFocus(boolean focus) {
216     getStateHelper().put(PropertyKeys.focus, focus);
217   }
218 
219   /**
220   This value will usually be set by the layout manager.
221 
222   */
223   public org.apache.myfaces.tobago.layout.Measure getLeft() {
224     Object object = getStateHelper().eval(PropertyKeys.left);
225     if (object != null) {
226        return Measure.valueOf(object);
227     }
228     return null;
229   }
230 
231   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
232     getStateHelper().put(PropertyKeys.left, left);
233   }
234 
235   public java.lang.Integer getColumnSpan() {
236     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
237     if (value != null) {
238       return value.intValue();
239     }
240     return 1;
241   }
242 
243   public void setColumnSpan(java.lang.Integer columnSpan) {
244     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
245   }
246 
247   /**
248   This value will usually be set by the layout manager.
249 
250   */
251   public org.apache.myfaces.tobago.layout.Measure getTop() {
252     Object object = getStateHelper().eval(PropertyKeys.top);
253     if (object != null) {
254        return Measure.valueOf(object);
255     }
256     return null;
257   }
258 
259   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
260     getStateHelper().put(PropertyKeys.top, top);
261   }
262 
263   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
264     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
265     if (object != null) {
266        return Measure.valueOf(object);
267     }
268     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
269   }
270 
271   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
272     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
273   }
274 
275   /**
276   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
277 
278   */
279   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
280     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
281     if (object != null) {
282        return Measure.valueOf(object);
283     }
284     return getWidth();
285   }
286 
287   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
288     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
289   }
290 
291   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
292     Object object = getStateHelper().eval(PropertyKeys.marginTop);
293     if (object != null) {
294        return Measure.valueOf(object);
295     }
296     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
297   }
298 
299   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
300     getStateHelper().put(PropertyKeys.marginTop, marginTop);
301   }
302 
303   /**
304   Displays a short text in the input field, that describes the meaning of this field.
305    This is part of HTML 5, the theme should emulate the behaviour, when the browser doesn't support it.
306    <p/>
307    The text will not be displayed, when the input field is readonly or disabled.
308 
309   */
310   public java.lang.String getPlaceholder() {
311     return (java.lang.String) getStateHelper().eval(PropertyKeys.placeholder);
312   }
313 
314   public void setPlaceholder(java.lang.String placeholder) {
315     getStateHelper().put(PropertyKeys.placeholder, placeholder);
316   }
317 
318   /**
319   This value will usually be set by the layout manager.
320 
321   */
322   public org.apache.myfaces.tobago.layout.Measure getWidth() {
323     Object object = getStateHelper().eval(PropertyKeys.width);
324     if (object != null) {
325        return Measure.valueOf(object);
326     }
327     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
328   }
329 
330   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
331     getStateHelper().put(PropertyKeys.width, width);
332   }
333 
334   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
335     Object object = getStateHelper().eval(PropertyKeys.marginRight);
336     if (object != null) {
337        return Measure.valueOf(object);
338     }
339     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
340   }
341 
342   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
343     getStateHelper().put(PropertyKeys.marginRight, marginRight);
344   }
345 
346   /**
347   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
348 
349   */
350   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
351     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
352     if (object != null) {
353        return Measure.valueOf(object);
354     }
355     return getHeight();
356   }
357 
358   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
359     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
360   }
361 
362   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
363     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
364     if (object != null) {
365        return Measure.valueOf(object);
366     }
367     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
368   }
369 
370   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
371     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
372   }
373 
374   /**
375   Text value to display as label.
376    If text contains an underscore the next character is used as accesskey (if configured so and possible).
377 
378   */
379   public java.lang.String getLabel() {
380     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
381   }
382 
383   public void setLabel(java.lang.String label) {
384     getStateHelper().put(PropertyKeys.label, label);
385   }
386 
387   /**
388   This attribute is for internal use only.
389 
390   */
391   public org.apache.myfaces.tobago.layout.Display getDisplay() {
392     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
393   }
394 
395   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
396     getStateHelper().put(PropertyKeys.display, display);
397   }
398 
399   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
400     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
401     if (object != null) {
402        return Measure.valueOf(object);
403     }
404     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
405   }
406 
407   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
408     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
409   }
410 
411   /**
412   Client side script function to add to this component's onchange handler.
413 
414   @deprecated*/
415   @Deprecated
416   public java.lang.String getOnchange() {
417     return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
418   }
419 
420   @Deprecated
421   public void setOnchange(java.lang.String onchange) {
422       Deprecation.LOG.error("The attribute 'onchange' of 'UIDate' is deprecated. "
423           + "Please refer the documentation for further information.");
424     getStateHelper().put(PropertyKeys.onchange, onchange);
425   }
426 
427   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
428     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
429     if (object != null) {
430        return Measure.valueOf(object);
431     }
432     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
433   }
434 
435   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
436     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
437   }
438 
439   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
440     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
441     if (object != null) {
442        return Measure.valueOf(object);
443     }
444     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
445   }
446 
447   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
448     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
449   }
450 
451   /**
452   This attribute is for internal use only.
453 
454   */
455   public java.lang.Integer getVerticalIndex() {
456     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
457     if (value != null) {
458       return value.intValue();
459     }
460     return null;
461   }
462 
463   public void setVerticalIndex(java.lang.Integer verticalIndex) {
464     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
465   }
466 
467   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
468     if (currentMarkup != null) {
469       return currentMarkup;
470     }
471     return null;
472   }
473 
474   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
475     this.currentMarkup = currentMarkup;
476   }
477 
478   /**
479   This attribute is for internal use only.
480 
481   */
482   public java.lang.Integer getHorizontalIndex() {
483     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
484     if (value != null) {
485       return value.intValue();
486     }
487     return null;
488   }
489 
490   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
491     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
492   }
493 
494   /**
495   Flag indicating that this component will prohibit changes by the user.
496   <br />Default: <code>false</code>
497   */
498   public boolean isReadonly() {
499     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
500     if (bool != null) {
501       return bool;
502     }
503     return false;
504   }
505 
506   public void setReadonly(boolean readonly) {
507     getStateHelper().put(PropertyKeys.readonly, readonly);
508   }
509 
510   /**
511   Flag indicating that this element is disabled.
512   <br />Default: <code>false</code>
513   */
514   public boolean isDisabled() {
515     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
516     if (bool != null) {
517       return bool;
518     }
519     return false;
520   }
521 
522   public void setDisabled(boolean disabled) {
523     getStateHelper().put(PropertyKeys.disabled, disabled);
524   }
525 
526   public Object saveState(FacesContext context) {
527     currentMarkup = null;
528     return super.saveState(context);
529   }
530 
531 }