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      accessKey,
57      marginLeft,
58      labelWithAccessKey,
59      tabIndex,
60      minimumHeight,
61      tip,
62      height,
63      minimumWidth,
64      inline,
65      rowSpan,
66      focus,
67      left,
68      columnSpan,
69      top,
70      maximumHeight,
71      currentWidth,
72      marginTop,
73      placeholder,
74      width,
75      marginRight,
76      currentHeight,
77      preferredHeight,
78      label,
79      display,
80      maximumWidth,
81      onchange,
82      preferredWidth,
83      marginBottom,
84      verticalIndex,
85      horizontalIndex,
86      readonly,
87      disabled,
88    }
89  
90    public String getFamily() {
91      return COMPONENT_FAMILY;
92    }
93  
94  
95    public org.apache.myfaces.tobago.context.Markup getMarkup() {
96      Object object = getStateHelper().eval(PropertyKeys.markup);
97      if (object != null) {
98        return Markup.valueOf(object);
99      }
100     return null;
101   }
102 
103   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
104     getStateHelper().put(PropertyKeys.markup, markup);
105   }
106 
107   /**
108   Deprecated! Has not longer any function.
109 
110   @deprecated*/
111   @Deprecated
112   public java.lang.Character getAccessKey() {
113     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
114   }
115 
116   @Deprecated
117   public void setAccessKey(java.lang.Character accessKey) {
118       Deprecation.LOG.error("The attribute 'accessKey' of 'UIDate' is deprecated. "
119           + "Please refer the documentation for further information.");
120     getStateHelper().put(PropertyKeys.accessKey, accessKey);
121   }
122 
123   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
124     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
125     if (object != null) {
126        return Measure.valueOf(object);
127     }
128     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
129   }
130 
131   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
132     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
133   }
134 
135   /**
136   Deprecated! Use 'label' instead.
137    Text value to display as label.
138    If text contains an underscore the next character overwrites 'accesskey'.
139 
140   @deprecated*/
141   @Deprecated
142   public java.lang.String getLabelWithAccessKey() {
143     return (java.lang.String) getStateHelper().eval(PropertyKeys.labelWithAccessKey);
144   }
145 
146   @Deprecated
147   public void setLabelWithAccessKey(java.lang.String labelWithAccessKey) {
148       Deprecation.LOG.error("The attribute 'labelWithAccessKey' of 'UIDate' is deprecated. "
149           + "Please refer the documentation for further information.");
150     getStateHelper().put(PropertyKeys.labelWithAccessKey, labelWithAccessKey);
151   }
152 
153   /**
154   Controls the navigation of the focus through the
155    input controls on a page with the Tab-Key.
156    The navigation starts from the element with
157    the lowest tabIndex value to the element with the highest value.
158    Elements that have identical tabIndex values should be navigated
159    in the order they appear in the character stream
160    Elements that are disabled or with a negative tabIndex
161    do not participate in the tabbing order.
162 
163   */
164   public java.lang.Integer getTabIndex() {
165     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
166     if (value != null) {
167       return value.intValue();
168     }
169     return null;
170   }
171 
172   public void setTabIndex(java.lang.Integer tabIndex) {
173     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
174   }
175 
176   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
177     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
178     if (object != null) {
179        return Measure.valueOf(object);
180     }
181     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
182   }
183 
184   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
185     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
186   }
187 
188   /**
189   Text value to display as tooltip.
190 
191   */
192   public java.lang.String getTip() {
193     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
194   }
195 
196   public void setTip(java.lang.String tip) {
197     getStateHelper().put(PropertyKeys.tip, tip);
198   }
199 
200   /**
201   This value will usually be set by the layout manager.
202 
203   */
204   public org.apache.myfaces.tobago.layout.Measure getHeight() {
205     Object object = getStateHelper().eval(PropertyKeys.height);
206     if (object != null) {
207        return Measure.valueOf(object);
208     }
209     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
210   }
211 
212   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
213     getStateHelper().put(PropertyKeys.height, height);
214   }
215 
216   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
217     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
218     if (object != null) {
219        return Measure.valueOf(object);
220     }
221     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
222   }
223 
224   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
225     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
226   }
227 
228   /**
229   Flag indicating this component should rendered as an inline element.
230   <br />Default: <code>false</code>
231   @deprecated*/
232   @Deprecated
233   public boolean isInline() {
234     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.inline);
235     if (bool != null) {
236       return bool;
237     }
238     return false;
239   }
240 
241   @Deprecated
242   public void setInline(boolean inline) {
243       Deprecation.LOG.error("The attribute 'inline' of 'UIDate' is deprecated. "
244           + "Please refer the documentation for further information.");
245     getStateHelper().put(PropertyKeys.inline, inline);
246   }
247 
248   public java.lang.Integer getRowSpan() {
249     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
250     if (value != null) {
251       return value.intValue();
252     }
253     return 1;
254   }
255 
256   public void setRowSpan(java.lang.Integer rowSpan) {
257     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
258   }
259 
260   /**
261   Flag indicating this component should receive the focus.
262   <br />Default: <code>false</code>
263   */
264   public boolean isFocus() {
265     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
266     if (bool != null) {
267       return bool;
268     }
269     return false;
270   }
271 
272   public void setFocus(boolean focus) {
273     getStateHelper().put(PropertyKeys.focus, focus);
274   }
275 
276   /**
277   This value will usually be set by the layout manager.
278 
279   */
280   public org.apache.myfaces.tobago.layout.Measure getLeft() {
281     Object object = getStateHelper().eval(PropertyKeys.left);
282     if (object != null) {
283        return Measure.valueOf(object);
284     }
285     return null;
286   }
287 
288   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
289     getStateHelper().put(PropertyKeys.left, left);
290   }
291 
292   public java.lang.Integer getColumnSpan() {
293     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
294     if (value != null) {
295       return value.intValue();
296     }
297     return 1;
298   }
299 
300   public void setColumnSpan(java.lang.Integer columnSpan) {
301     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
302   }
303 
304   /**
305   This value will usually be set by the layout manager.
306 
307   */
308   public org.apache.myfaces.tobago.layout.Measure getTop() {
309     Object object = getStateHelper().eval(PropertyKeys.top);
310     if (object != null) {
311        return Measure.valueOf(object);
312     }
313     return null;
314   }
315 
316   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
317     getStateHelper().put(PropertyKeys.top, top);
318   }
319 
320   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
321     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
322     if (object != null) {
323        return Measure.valueOf(object);
324     }
325     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
326   }
327 
328   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
329     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
330   }
331 
332   /**
333   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
334 
335   */
336   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
337     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
338     if (object != null) {
339        return Measure.valueOf(object);
340     }
341     return getWidth();
342   }
343 
344   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
345     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
346   }
347 
348   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
349     Object object = getStateHelper().eval(PropertyKeys.marginTop);
350     if (object != null) {
351        return Measure.valueOf(object);
352     }
353     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
354   }
355 
356   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
357     getStateHelper().put(PropertyKeys.marginTop, marginTop);
358   }
359 
360   /**
361   Displays a short text in the input field, that describes the meaning of this field.
362    This is part of HTML 5, the theme should emulate the behaviour, when the browser doesn't support it.
363    <p/>
364    The text will not be displayed, when the input field is readonly or disabled.
365 
366   */
367   public java.lang.String getPlaceholder() {
368     return (java.lang.String) getStateHelper().eval(PropertyKeys.placeholder);
369   }
370 
371   public void setPlaceholder(java.lang.String placeholder) {
372     getStateHelper().put(PropertyKeys.placeholder, placeholder);
373   }
374 
375   /**
376   This value will usually be set by the layout manager.
377 
378   */
379   public org.apache.myfaces.tobago.layout.Measure getWidth() {
380     Object object = getStateHelper().eval(PropertyKeys.width);
381     if (object != null) {
382        return Measure.valueOf(object);
383     }
384     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
385   }
386 
387   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
388     getStateHelper().put(PropertyKeys.width, width);
389   }
390 
391   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
392     Object object = getStateHelper().eval(PropertyKeys.marginRight);
393     if (object != null) {
394        return Measure.valueOf(object);
395     }
396     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
397   }
398 
399   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
400     getStateHelper().put(PropertyKeys.marginRight, marginRight);
401   }
402 
403   /**
404   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
405 
406   */
407   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
408     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
409     if (object != null) {
410        return Measure.valueOf(object);
411     }
412     return getHeight();
413   }
414 
415   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
416     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
417   }
418 
419   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
420     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
421     if (object != null) {
422        return Measure.valueOf(object);
423     }
424     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
425   }
426 
427   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
428     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
429   }
430 
431   /**
432   Text value to display as label.
433    If text contains an underscore the next character is used as accesskey.
434 
435   */
436   public java.lang.String getLabel() {
437     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
438   }
439 
440   public void setLabel(java.lang.String label) {
441     getStateHelper().put(PropertyKeys.label, label);
442   }
443 
444   /**
445   This attribute is for internal use only.
446 
447   */
448   public org.apache.myfaces.tobago.layout.Display getDisplay() {
449     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
450   }
451 
452   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
453     getStateHelper().put(PropertyKeys.display, display);
454   }
455 
456   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
457     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
458     if (object != null) {
459        return Measure.valueOf(object);
460     }
461     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
462   }
463 
464   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
465     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
466   }
467 
468   /**
469   Client side script function to add to this component's onchange handler.
470 
471   @deprecated*/
472   @Deprecated
473   public java.lang.String getOnchange() {
474     return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
475   }
476 
477   @Deprecated
478   public void setOnchange(java.lang.String onchange) {
479       Deprecation.LOG.error("The attribute 'onchange' of 'UIDate' is deprecated. "
480           + "Please refer the documentation for further information.");
481     getStateHelper().put(PropertyKeys.onchange, onchange);
482   }
483 
484   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
485     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
486     if (object != null) {
487        return Measure.valueOf(object);
488     }
489     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
490   }
491 
492   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
493     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
494   }
495 
496   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
497     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
498     if (object != null) {
499        return Measure.valueOf(object);
500     }
501     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
502   }
503 
504   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
505     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
506   }
507 
508   /**
509   This attribute is for internal use only.
510 
511   */
512   public java.lang.Integer getVerticalIndex() {
513     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
514     if (value != null) {
515       return value.intValue();
516     }
517     return null;
518   }
519 
520   public void setVerticalIndex(java.lang.Integer verticalIndex) {
521     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
522   }
523 
524   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
525     if (currentMarkup != null) {
526       return currentMarkup;
527     }
528     return null;
529   }
530 
531   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
532     this.currentMarkup = currentMarkup;
533   }
534 
535   /**
536   This attribute is for internal use only.
537 
538   */
539   public java.lang.Integer getHorizontalIndex() {
540     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
541     if (value != null) {
542       return value.intValue();
543     }
544     return null;
545   }
546 
547   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
548     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
549   }
550 
551   /**
552   Flag indicating that this component will prohibit changes by the user.
553   <br />Default: <code>false</code>
554   */
555   public boolean isReadonly() {
556     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
557     if (bool != null) {
558       return bool;
559     }
560     return false;
561   }
562 
563   public void setReadonly(boolean readonly) {
564     getStateHelper().put(PropertyKeys.readonly, readonly);
565   }
566 
567   /**
568   Flag indicating that this element is disabled.
569   <br />Default: <code>false</code>
570   */
571   public boolean isDisabled() {
572     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
573     if (bool != null) {
574       return bool;
575     }
576     return false;
577   }
578 
579   public void setDisabled(boolean disabled) {
580     getStateHelper().put(PropertyKeys.disabled, disabled);
581   }
582 
583   public Object saveState(FacesContext context) {
584     currentMarkup = null;
585     return super.saveState(context);
586   }
587 
588 
589 }