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