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.config.Configurable;
24  import org.apache.myfaces.tobago.context.Markup;
25  import org.apache.myfaces.tobago.internal.component.AbstractUIDatePicker;
26  import org.apache.myfaces.tobago.layout.Display;
27  import org.apache.myfaces.tobago.layout.Measure;
28  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
29  import org.apache.myfaces.tobago.internal.util.StringUtils;
30  import org.apache.myfaces.tobago.internal.util.Deprecation;
31  import org.apache.myfaces.tobago.renderkit.MarginValues;
32  import org.apache.myfaces.tobago.renderkit.SpacingValues;
33  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
34  import javax.el.ELException;
35  import javax.faces.FacesException;
36  import java.util.ArrayList;
37  import java.util.List;
38  import javax.el.MethodExpression;
39  import javax.el.ValueExpression;
40  
41  /** 
42   Renders a date picker.
43    The component needs a DateFormat Pattern from a converter. The converter
44    should be an instance of DateTimeConverter and return a valid pattern from
45    the method getPattern()
46    * UIComponent class, generated from template {@code component2.0.stg} with class
47    * {@link org.apache.myfaces.tobago.internal.taglib.component.DatePickerTagDeclaration}.
48     @deprecated
49   */
50  @Deprecated
51  public class UIDatePicker
52      extends AbstractUIDatePicker implements Configurable, SupportsMarkup {
53  
54    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.DatePicker";
55  
56    public static final String COMPONENT_FAMILY = "javax.faces.Command";
57  
58    private org.apache.myfaces.tobago.context.Markup currentMarkup;
59  
60    enum PropertyKeys {
61      markup,
62      forComponent,
63      marginLeft,
64      link,
65      tabIndex,
66      minimumHeight,
67      tip,
68      height,
69      minimumWidth,
70      rowSpan,
71      left,
72      columnSpan,
73      maximumHeight,
74      top,
75      currentWidth,
76      marginTop,
77      marginRight,
78      width,
79      jsfResource,
80      resource,
81      preferredHeight,
82      currentHeight,
83      image,
84      display,
85      maximumWidth,
86      preferredWidth,
87      marginBottom,
88      verticalIndex,
89      renderedPartially,
90      onclick,
91      horizontalIndex,
92      disabled,
93    }
94  
95    public String getFamily() {
96      return COMPONENT_FAMILY;
97    }
98  
99  
100   public org.apache.myfaces.tobago.context.Markup getMarkup() {
101     Object object = getStateHelper().eval(PropertyKeys.markup);
102     if (object != null) {
103       return Markup.valueOf(object);
104     }
105     return null;
106   }
107 
108   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
109     getStateHelper().put(PropertyKeys.markup, markup);
110   }
111 
112   /**
113   Id of the component, this is related to.
114 
115   */
116   public java.lang.String getFor() {
117     return (java.lang.String) getStateHelper().eval(PropertyKeys.forComponent);
118   }
119 
120   public void setFor(java.lang.String forComponent) {
121     getStateHelper().put(PropertyKeys.forComponent, forComponent);
122   }
123 
124   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
125     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
126     if (object != null) {
127        return Measure.valueOf(object);
128     }
129     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
130   }
131 
132   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
133     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
134   }
135 
136   public java.lang.String getLink() {
137     return (java.lang.String) getStateHelper().eval(PropertyKeys.link);
138   }
139 
140   public void setLink(java.lang.String link) {
141     getStateHelper().put(PropertyKeys.link, link);
142   }
143 
144   /**
145   Controls the navigation of the focus through the
146    input controls on a page with the Tab-Key.
147    The navigation starts from the element with
148    the lowest tabIndex value to the element with the highest value.
149    Elements that have identical tabIndex values should be navigated
150    in the order they appear in the character stream
151    Elements that are disabled or with a negative tabIndex
152    do not participate in the tabbing order.
153 
154   */
155   public java.lang.Integer getTabIndex() {
156     Number value  = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
157     if (value != null) {
158       return value.intValue();
159     }
160     return null;
161   }
162 
163   public void setTabIndex(java.lang.Integer tabIndex) {
164     getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
165   }
166 
167   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
168     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
169     if (object != null) {
170        return Measure.valueOf(object);
171     }
172     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
173   }
174 
175   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
176     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
177   }
178 
179   public java.lang.String getTip() {
180     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
181   }
182 
183   public void setTip(java.lang.String tip) {
184     getStateHelper().put(PropertyKeys.tip, tip);
185   }
186 
187   /**
188   This value will usually be set by the layout manager.
189 
190   */
191   public org.apache.myfaces.tobago.layout.Measure getHeight() {
192     Object object = getStateHelper().eval(PropertyKeys.height);
193     if (object != null) {
194        return Measure.valueOf(object);
195     }
196     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
197   }
198 
199   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
200     getStateHelper().put(PropertyKeys.height, height);
201   }
202 
203   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
204     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
205     if (object != null) {
206        return Measure.valueOf(object);
207     }
208     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
209   }
210 
211   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
212     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
213   }
214 
215   public java.lang.Integer getRowSpan() {
216     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
217     if (value != null) {
218       return value.intValue();
219     }
220     return 1;
221   }
222 
223   public void setRowSpan(java.lang.Integer rowSpan) {
224     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
225   }
226 
227   /**
228   This value will usually be set by the layout manager.
229 
230   */
231   public org.apache.myfaces.tobago.layout.Measure getLeft() {
232     Object object = getStateHelper().eval(PropertyKeys.left);
233     if (object != null) {
234        return Measure.valueOf(object);
235     }
236     return null;
237   }
238 
239   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
240     getStateHelper().put(PropertyKeys.left, left);
241   }
242 
243   public java.lang.Integer getColumnSpan() {
244     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
245     if (value != null) {
246       return value.intValue();
247     }
248     return 1;
249   }
250 
251   public void setColumnSpan(java.lang.Integer columnSpan) {
252     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
253   }
254 
255   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
256     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
257     if (object != null) {
258        return Measure.valueOf(object);
259     }
260     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
261   }
262 
263   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
264     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
265   }
266 
267   /**
268   This value will usually be set by the layout manager.
269 
270   */
271   public org.apache.myfaces.tobago.layout.Measure getTop() {
272     Object object = getStateHelper().eval(PropertyKeys.top);
273     if (object != null) {
274        return Measure.valueOf(object);
275     }
276     return null;
277   }
278 
279   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
280     getStateHelper().put(PropertyKeys.top, top);
281   }
282 
283   /**
284   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
285 
286   */
287   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
288     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
289     if (object != null) {
290        return Measure.valueOf(object);
291     }
292     return getWidth();
293   }
294 
295   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
296     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
297   }
298 
299   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
300     Object object = getStateHelper().eval(PropertyKeys.marginTop);
301     if (object != null) {
302        return Measure.valueOf(object);
303     }
304     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
305   }
306 
307   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
308     getStateHelper().put(PropertyKeys.marginTop, marginTop);
309   }
310 
311   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
312     Object object = getStateHelper().eval(PropertyKeys.marginRight);
313     if (object != null) {
314        return Measure.valueOf(object);
315     }
316     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
317   }
318 
319   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
320     getStateHelper().put(PropertyKeys.marginRight, marginRight);
321   }
322 
323   /**
324   This value will usually be set by the layout manager.
325 
326   */
327   public org.apache.myfaces.tobago.layout.Measure getWidth() {
328     Object object = getStateHelper().eval(PropertyKeys.width);
329     if (object != null) {
330        return Measure.valueOf(object);
331     }
332     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
333   }
334 
335   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
336     getStateHelper().put(PropertyKeys.width, width);
337   }
338 
339   public boolean isJsfResource() {
340     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.jsfResource);
341     if (bool != null) {
342       return bool;
343     }
344     return false;
345   }
346 
347   public void setJsfResource(boolean jsfResource) {
348     getStateHelper().put(PropertyKeys.jsfResource, jsfResource);
349   }
350 
351   public java.lang.String getResource() {
352     return (java.lang.String) getStateHelper().eval(PropertyKeys.resource);
353   }
354 
355   public void setResource(java.lang.String resource) {
356     getStateHelper().put(PropertyKeys.resource, resource);
357   }
358 
359   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
360     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
361     if (object != null) {
362        return Measure.valueOf(object);
363     }
364     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
365   }
366 
367   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
368     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
369   }
370 
371   /**
372   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
373 
374   */
375   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
376     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
377     if (object != null) {
378        return Measure.valueOf(object);
379     }
380     return getHeight();
381   }
382 
383   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
384     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
385   }
386 
387   public java.lang.String getImage() {
388     return (java.lang.String) getStateHelper().eval(PropertyKeys.image);
389   }
390 
391   public void setImage(java.lang.String image) {
392     getStateHelper().put(PropertyKeys.image, image);
393   }
394 
395   /**
396   This attribute is for internal use only.
397 
398   */
399   public org.apache.myfaces.tobago.layout.Display getDisplay() {
400     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
401   }
402 
403   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
404     getStateHelper().put(PropertyKeys.display, display);
405   }
406 
407   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
408     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
409     if (object != null) {
410        return Measure.valueOf(object);
411     }
412     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
413   }
414 
415   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
416     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
417   }
418 
419   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
420     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
421     if (object != null) {
422        return Measure.valueOf(object);
423     }
424     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
425   }
426 
427   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
428     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
429   }
430 
431   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
432     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
433     if (object != null) {
434        return Measure.valueOf(object);
435     }
436     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
437   }
438 
439   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
440     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
441   }
442 
443   /**
444   This attribute is for internal use only.
445 
446   */
447   public java.lang.Integer getVerticalIndex() {
448     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
449     if (value != null) {
450       return value.intValue();
451     }
452     return null;
453   }
454 
455   public void setVerticalIndex(java.lang.Integer verticalIndex) {
456     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
457   }
458 
459   public String[] getRenderedPartially() {
460     Object strArray = getStateHelper().eval(PropertyKeys.renderedPartially);
461     if (strArray != null) {
462       if (strArray instanceof String[]) {
463         return (String[]) strArray;
464       } else if (strArray instanceof String) {
465         String[] strings = StringUtils.split((String) strArray, ", ");
466         List<String> result = new ArrayList<String>(strings.length);
467         for (String string : strings) {
468           if (string.trim().length() != 0) {
469             result.add(string.trim());
470           }
471         }
472         return result.toArray(new String[result.size()]);
473       } else if (strArray == null) {
474         return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
475       } else {
476         return new String[]{strArray.toString()};
477       }
478     }
479     return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
480   }
481 
482   public void setRenderedPartially(String[] renderedPartially) {
483     getStateHelper().put(PropertyKeys.renderedPartially, renderedPartially);
484   }
485 
486   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
487     if (currentMarkup != null) {
488       return currentMarkup;
489     }
490     return null;
491   }
492 
493   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
494     this.currentMarkup = currentMarkup;
495   }
496 
497   public java.lang.String getOnclick() {
498     return (java.lang.String) getStateHelper().eval(PropertyKeys.onclick);
499   }
500 
501   public void setOnclick(java.lang.String onclick) {
502     getStateHelper().put(PropertyKeys.onclick, onclick);
503   }
504 
505   /**
506   This attribute is for internal use only.
507 
508   */
509   public java.lang.Integer getHorizontalIndex() {
510     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
511     if (value != null) {
512       return value.intValue();
513     }
514     return null;
515   }
516 
517   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
518     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
519   }
520 
521   public boolean isDisabled() {
522     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
523     if (bool != null) {
524       return bool;
525     }
526     return false;
527   }
528 
529   public void setDisabled(boolean disabled) {
530     getStateHelper().put(PropertyKeys.disabled, disabled);
531   }
532 
533   public Object saveState(FacesContext context) {
534     currentMarkup = null;
535     return super.saveState(context);
536   }
537 
538 }