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