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.AbstractUIPage;
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 page element.
42    * UIComponent class, generated from template {@code component2.0.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.PageTagDeclaration}.
44   */
45  public class UIPage
46      extends AbstractUIPage implements SupportsMarkup {
47  
48    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Page";
49  
50    public static final String COMPONENT_FAMILY = "javax.faces.Form";
51  
52    private org.apache.myfaces.tobago.context.Markup currentMarkup;
53  
54    enum PropertyKeys {
55      markup,
56      marginLeft,
57      state,
58      minimumHeight,
59      focusId,
60      borderLeft,
61      height,
62      minimumWidth,
63      overflowX,
64      rowSpan,
65      overflowY,
66      left,
67      columnSpan,
68      borderRight,
69      paddingBottom,
70      maximumHeight,
71      top,
72      currentWidth,
73      paddingTop,
74      marginTop,
75      marginRight,
76      width,
77      preferredHeight,
78      currentHeight,
79      borderBottom,
80      label,
81      display,
82      maximumWidth,
83      paddingLeft,
84      paddingRight,
85      preferredWidth,
86      marginBottom,
87      borderTop,
88      verticalIndex,
89      applicationIcon,
90      horizontalIndex,
91    }
92  
93    public String getFamily() {
94      return COMPONENT_FAMILY;
95    }
96  
97  
98    public org.apache.myfaces.tobago.context.Markup getMarkup() {
99      Object object = getStateHelper().eval(PropertyKeys.markup);
100     if (object != null) {
101       return Markup.valueOf(object);
102     }
103     return null;
104   }
105 
106   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
107     getStateHelper().put(PropertyKeys.markup, markup);
108   }
109 
110   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
111     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
112     if (object != null) {
113        return Measure.valueOf(object);
114     }
115     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
116   }
117 
118   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
119     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
120   }
121 
122   /**
123   <strong>ValueBindingExpression</strong> pointing to a object to save the
124    component's state.
125 
126   @deprecated*/
127   @Deprecated
128   public java.lang.Object getState() {
129     return getStateHelper().eval(PropertyKeys.state);
130   }
131 
132   @Deprecated
133   public void setState(java.lang.Object state) {
134       Deprecation.LOG.error("The attribute 'state' of 'UIPage' is deprecated. "
135           + "Please refer the documentation for further information.");
136     getStateHelper().put(PropertyKeys.state, state);
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   Contains the id of the component which should have the focus after
153    loading the page.
154    Set to empty string for disabling setting of focus.
155    Default (null) enables the "auto focus" feature.
156 
157   */
158   public java.lang.String getFocusId() {
159     return (java.lang.String) getStateHelper().eval(PropertyKeys.focusId);
160   }
161 
162   public void setFocusId(java.lang.String focusId) {
163     getStateHelper().put(PropertyKeys.focusId, focusId);
164   }
165 
166   /**
167   This attribute is for internal use only.
168 
169   */
170   public org.apache.myfaces.tobago.layout.Measure getBorderLeft() {
171     Object object = getStateHelper().eval(PropertyKeys.borderLeft);
172     if (object != null) {
173        return Measure.valueOf(object);
174     }
175     return getRendererType() != null ? ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
176    getRenderer(getFacesContext())).getBorderLeft(getFacesContext(), this) : Measure.ZERO;
177   }
178 
179   public void setBorderLeft(org.apache.myfaces.tobago.layout.Measure borderLeft) {
180     getStateHelper().put(PropertyKeys.borderLeft, borderLeft);
181   }
182 
183   /**
184   The height of the component in the UI.
185    This value will usually be set by the layout manager, but can be set explicitly here.
186 
187   */
188   public org.apache.myfaces.tobago.layout.Measure getHeight() {
189     Object object = getStateHelper().eval(PropertyKeys.height);
190     if (object != null) {
191        return Measure.valueOf(object);
192     }
193     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
194   }
195 
196   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
197     getStateHelper().put(PropertyKeys.height, height);
198   }
199 
200   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
201     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
202     if (object != null) {
203        return Measure.valueOf(object);
204     }
205     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
206   }
207 
208   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
209     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
210   }
211 
212   /**
213   This attribute is for internal use only.
214 
215   */
216   public boolean isOverflowX() {
217     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.overflowX);
218     if (bool != null) {
219       return bool;
220     }
221     return false;
222   }
223 
224   public void setOverflowX(boolean overflowX) {
225     getStateHelper().put(PropertyKeys.overflowX, overflowX);
226   }
227 
228   public java.lang.Integer getRowSpan() {
229     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
230     if (value != null) {
231       return value.intValue();
232     }
233     return 1;
234   }
235 
236   public void setRowSpan(java.lang.Integer rowSpan) {
237     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
238   }
239 
240   /**
241   This attribute is for internal use only.
242 
243   */
244   public boolean isOverflowY() {
245     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.overflowY);
246     if (bool != null) {
247       return bool;
248     }
249     return false;
250   }
251 
252   public void setOverflowY(boolean overflowY) {
253     getStateHelper().put(PropertyKeys.overflowY, overflowY);
254   }
255 
256   /**
257   This value will usually be set by the layout manager.
258 
259   */
260   public org.apache.myfaces.tobago.layout.Measure getLeft() {
261     Object object = getStateHelper().eval(PropertyKeys.left);
262     if (object != null) {
263        return Measure.valueOf(object);
264     }
265     return null;
266   }
267 
268   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
269     getStateHelper().put(PropertyKeys.left, left);
270   }
271 
272   public java.lang.Integer getColumnSpan() {
273     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
274     if (value != null) {
275       return value.intValue();
276     }
277     return 1;
278   }
279 
280   public void setColumnSpan(java.lang.Integer columnSpan) {
281     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
282   }
283 
284   /**
285   This attribute is for internal use only.
286 
287   */
288   public org.apache.myfaces.tobago.layout.Measure getBorderRight() {
289     Object object = getStateHelper().eval(PropertyKeys.borderRight);
290     if (object != null) {
291        return Measure.valueOf(object);
292     }
293     return getRendererType() != null ? ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
294   getRenderer(getFacesContext())).getBorderRight(getFacesContext(), this) : Measure.ZERO;
295   }
296 
297   public void setBorderRight(org.apache.myfaces.tobago.layout.Measure borderRight) {
298     getStateHelper().put(PropertyKeys.borderRight, borderRight);
299   }
300 
301   /**
302   This attribute is for internal use only.
303 
304   */
305   public org.apache.myfaces.tobago.layout.Measure getPaddingBottom() {
306     Object object = getStateHelper().eval(PropertyKeys.paddingBottom);
307     if (object != null) {
308        return Measure.valueOf(object);
309     }
310     return getRendererType() != null ? ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
311   getRenderer(getFacesContext())).getPaddingBottom(getFacesContext(), this) : Measure.ZERO;
312   }
313 
314   public void setPaddingBottom(org.apache.myfaces.tobago.layout.Measure paddingBottom) {
315     getStateHelper().put(PropertyKeys.paddingBottom, paddingBottom);
316   }
317 
318   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
319     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
320     if (object != null) {
321        return Measure.valueOf(object);
322     }
323     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
324   }
325 
326   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
327     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
328   }
329 
330   /**
331   This value will usually be set by the layout manager.
332 
333   */
334   public org.apache.myfaces.tobago.layout.Measure getTop() {
335     Object object = getStateHelper().eval(PropertyKeys.top);
336     if (object != null) {
337        return Measure.valueOf(object);
338     }
339     return null;
340   }
341 
342   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
343     getStateHelper().put(PropertyKeys.top, top);
344   }
345 
346   /**
347   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
348 
349   */
350   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
351     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
352     if (object != null) {
353        return Measure.valueOf(object);
354     }
355     return getWidth();
356   }
357 
358   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
359     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
360   }
361 
362   /**
363   This attribute is for internal use only.
364 
365   */
366   public org.apache.myfaces.tobago.layout.Measure getPaddingTop() {
367     Object object = getStateHelper().eval(PropertyKeys.paddingTop);
368     if (object != null) {
369        return Measure.valueOf(object);
370     }
371     return getRendererType() != null ? ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
372   getRenderer(getFacesContext())).getPaddingTop(getFacesContext(), this) : Measure.ZERO;
373   }
374 
375   public void setPaddingTop(org.apache.myfaces.tobago.layout.Measure paddingTop) {
376     getStateHelper().put(PropertyKeys.paddingTop, paddingTop);
377   }
378 
379   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
380     Object object = getStateHelper().eval(PropertyKeys.marginTop);
381     if (object != null) {
382        return Measure.valueOf(object);
383     }
384     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
385   }
386 
387   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
388     getStateHelper().put(PropertyKeys.marginTop, marginTop);
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   The width of the component in the UI.
405    This value will usually be set by the layout manager, but can be set explicitly here.
406 
407   */
408   public org.apache.myfaces.tobago.layout.Measure getWidth() {
409     Object object = getStateHelper().eval(PropertyKeys.width);
410     if (object != null) {
411        return Measure.valueOf(object);
412     }
413     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
414   }
415 
416   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
417     getStateHelper().put(PropertyKeys.width, width);
418   }
419 
420   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
421     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
422     if (object != null) {
423        return Measure.valueOf(object);
424     }
425     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
426   }
427 
428   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
429     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
430   }
431 
432   /**
433   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
434 
435   */
436   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
437     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
438     if (object != null) {
439        return Measure.valueOf(object);
440     }
441     return getHeight();
442   }
443 
444   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
445     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
446   }
447 
448   /**
449   This attribute is for internal use only.
450 
451   */
452   public org.apache.myfaces.tobago.layout.Measure getBorderBottom() {
453     Object object = getStateHelper().eval(PropertyKeys.borderBottom);
454     if (object != null) {
455        return Measure.valueOf(object);
456     }
457     return getRendererType() != null ? ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
458   getRenderer(getFacesContext())).getBorderBottom(getFacesContext(), this) : Measure.ZERO;
459   }
460 
461   public void setBorderBottom(org.apache.myfaces.tobago.layout.Measure borderBottom) {
462     getStateHelper().put(PropertyKeys.borderBottom, borderBottom);
463   }
464 
465   /**
466   Text value to display as label.
467    If text contains an underscore the next character is used as accesskey (if configured so and possible).
468 
469   */
470   public java.lang.String getLabel() {
471     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
472   }
473 
474   public void setLabel(java.lang.String label) {
475     getStateHelper().put(PropertyKeys.label, label);
476   }
477 
478   /**
479   This attribute is for internal use only.
480 
481   */
482   public org.apache.myfaces.tobago.layout.Display getDisplay() {
483     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
484   }
485 
486   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
487     getStateHelper().put(PropertyKeys.display, display);
488   }
489 
490   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
491     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
492     if (object != null) {
493        return Measure.valueOf(object);
494     }
495     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
496   }
497 
498   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
499     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
500   }
501 
502   /**
503   This attribute is for internal use only.
504 
505   */
506   public org.apache.myfaces.tobago.layout.Measure getPaddingLeft() {
507     Object object = getStateHelper().eval(PropertyKeys.paddingLeft);
508     if (object != null) {
509        return Measure.valueOf(object);
510     }
511     return getRendererType() != null ? ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
512   getRenderer(getFacesContext())).getPaddingLeft(getFacesContext(), this) : Measure.ZERO;
513   }
514 
515   public void setPaddingLeft(org.apache.myfaces.tobago.layout.Measure paddingLeft) {
516     getStateHelper().put(PropertyKeys.paddingLeft, paddingLeft);
517   }
518 
519   /**
520   This attribute is for internal use only.
521 
522   */
523   public org.apache.myfaces.tobago.layout.Measure getPaddingRight() {
524     Object object = getStateHelper().eval(PropertyKeys.paddingRight);
525     if (object != null) {
526        return Measure.valueOf(object);
527     }
528     return getRendererType() != null ? ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
529   getRenderer(getFacesContext())).getPaddingRight(getFacesContext(), this) : Measure.ZERO;
530   }
531 
532   public void setPaddingRight(org.apache.myfaces.tobago.layout.Measure paddingRight) {
533     getStateHelper().put(PropertyKeys.paddingRight, paddingRight);
534   }
535 
536   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
537     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
538     if (object != null) {
539        return Measure.valueOf(object);
540     }
541     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
542   }
543 
544   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
545     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
546   }
547 
548   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
549     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
550     if (object != null) {
551        return Measure.valueOf(object);
552     }
553     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
554   }
555 
556   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
557     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
558   }
559 
560   /**
561   This attribute is for internal use only.
562 
563   */
564   public org.apache.myfaces.tobago.layout.Measure getBorderTop() {
565     Object object = getStateHelper().eval(PropertyKeys.borderTop);
566     if (object != null) {
567        return Measure.valueOf(object);
568     }
569     return getRendererType() != null ? ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
570   getRenderer(getFacesContext())).getBorderTop(getFacesContext(), this) : Measure.ZERO;
571   }
572 
573   public void setBorderTop(org.apache.myfaces.tobago.layout.Measure borderTop) {
574     getStateHelper().put(PropertyKeys.borderTop, borderTop);
575   }
576 
577   /**
578   This attribute is for internal use only.
579 
580   */
581   public java.lang.Integer getVerticalIndex() {
582     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
583     if (value != null) {
584       return value.intValue();
585     }
586     return null;
587   }
588 
589   public void setVerticalIndex(java.lang.Integer verticalIndex) {
590     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
591   }
592 
593   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
594     if (currentMarkup != null) {
595       return currentMarkup;
596     }
597     return null;
598   }
599 
600   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
601     this.currentMarkup = currentMarkup;
602   }
603 
604   /**
605   Absolute URL to an image or image name to lookup in tobago resource path
606    representing the application. In HTML it is used as a favicon.
607 
608   */
609   public java.lang.String getApplicationIcon() {
610     return (java.lang.String) getStateHelper().eval(PropertyKeys.applicationIcon);
611   }
612 
613   public void setApplicationIcon(java.lang.String applicationIcon) {
614     getStateHelper().put(PropertyKeys.applicationIcon, applicationIcon);
615   }
616 
617   /**
618   This attribute is for internal use only.
619 
620   */
621   public java.lang.Integer getHorizontalIndex() {
622     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
623     if (value != null) {
624       return value.intValue();
625     }
626     return null;
627   }
628 
629   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
630     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
631   }
632 
633   public Object saveState(FacesContext context) {
634     currentMarkup = null;
635     return super.saveState(context);
636   }
637 
638 }