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