001    // ---------- Attention: Generated code, please do not modify! -----------  
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one or more
005     * contributor license agreements.  See the NOTICE file distributed with
006     * this work for additional information regarding copyright ownership.
007     * The ASF licenses this file to You under the Apache License, Version 2.0
008     * (the "License"); you may not use this file except in compliance with
009     * the License.  You may obtain a copy of the License at
010     *
011     *      http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing, software
014     * distributed under the License is distributed on an "AS IS" BASIS,
015     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016     * See the License for the specific language governing permissions and
017     * limitations under the License.
018     */
019    
020    package org.apache.myfaces.tobago.component;
021    
022    import javax.faces.context.FacesContext;
023    import org.apache.myfaces.tobago.context.Markup;
024    import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
025    import org.apache.myfaces.tobago.layout.Display;
026    import org.apache.myfaces.tobago.layout.Measure;
027    import org.apache.commons.lang.ArrayUtils;
028    import org.apache.commons.lang.StringUtils;
029    import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression;
030    import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
031    import org.apache.myfaces.tobago.internal.util.Deprecation;
032    import org.apache.myfaces.tobago.renderkit.MarginValues;
033    import org.apache.myfaces.tobago.renderkit.SpacingValues;
034    import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
035    import javax.el.ELException;
036    import javax.faces.FacesException;
037    import java.util.ArrayList;
038    import java.util.List;
039    import javax.el.MethodExpression;
040    import javax.el.ValueExpression;
041    
042    /** 
043      * UIComponent class, generated from template {@code component1.2.stg} with class
044      * {@link org.apache.myfaces.tobago.internal.taglib.component.ObjectTagDeclaration}.
045     */
046    public class UIObject
047        extends AbstractUIOut implements SupportsMarkup {
048    
049      public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Object";
050    
051      private org.apache.myfaces.tobago.layout.Measure currentWidth;
052      private org.apache.myfaces.tobago.context.Markup markup;
053      private org.apache.myfaces.tobago.layout.Measure marginLeft;
054      private org.apache.myfaces.tobago.layout.Measure marginTop;
055      private org.apache.myfaces.tobago.layout.Measure width;
056      private org.apache.myfaces.tobago.layout.Measure marginRight;
057      private org.apache.myfaces.tobago.layout.Measure preferredHeight;
058      private org.apache.myfaces.tobago.layout.Measure currentHeight;
059      private org.apache.myfaces.tobago.layout.Display display;
060      private org.apache.myfaces.tobago.layout.Measure minimumHeight;
061      private org.apache.myfaces.tobago.layout.Measure maximumWidth;
062      private org.apache.myfaces.tobago.layout.Measure preferredWidth;
063      private org.apache.myfaces.tobago.layout.Measure marginBottom;
064      private org.apache.myfaces.tobago.layout.Measure height;
065      private java.lang.Integer verticalIndex;
066      private org.apache.myfaces.tobago.layout.Measure minimumWidth;
067      private org.apache.myfaces.tobago.context.Markup currentMarkup;
068      private java.lang.Integer rowSpan;
069      private java.lang.Integer horizontalIndex;
070      private org.apache.myfaces.tobago.layout.Measure left;
071      private java.lang.String src;
072      private java.lang.Integer columnSpan;
073      private org.apache.myfaces.tobago.layout.Measure top;
074      private org.apache.myfaces.tobago.layout.Measure maximumHeight;
075    
076    
077      /**
078      This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
079    
080      */
081      public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
082        if (currentWidth != null) {
083          return currentWidth;
084        }
085        ValueExpression ve = getValueExpression("currentWidth");
086        if (ve != null) {
087          try {
088            Object object = ve.getValue(getFacesContext().getELContext());
089            return Measure.valueOf(object);
090          } catch (ELException e) {
091                      throw new FacesException(e);
092              }
093        }
094        return getWidth();
095      }
096    
097      public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
098        this.currentWidth = currentWidth;
099      }
100    
101      public org.apache.myfaces.tobago.context.Markup getMarkup() {
102        if (markup != null) {
103          return markup;
104        }
105        ValueExpression ve = getValueExpression("markup");
106        if (ve != null) {
107          try {
108            Object object = ve.getValue(getFacesContext().getELContext());
109            return Markup.valueOf(object);
110          } catch (ELException e) {
111                      throw new FacesException(e);
112              }
113        }
114        return null;
115      }
116    
117      public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
118        this.markup = markup;
119      }
120    
121      public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
122        if (marginLeft != null) {
123          return marginLeft;
124        }
125        ValueExpression ve = getValueExpression("marginLeft");
126        if (ve != null) {
127          try {
128            Object object = ve.getValue(getFacesContext().getELContext());
129            return Measure.valueOf(object);
130          } catch (ELException e) {
131                      throw new FacesException(e);
132              }
133        }
134        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
135      }
136    
137      public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
138        this.marginLeft = marginLeft;
139      }
140    
141      public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
142        if (marginTop != null) {
143          return marginTop;
144        }
145        ValueExpression ve = getValueExpression("marginTop");
146        if (ve != null) {
147          try {
148            Object object = ve.getValue(getFacesContext().getELContext());
149            return Measure.valueOf(object);
150          } catch (ELException e) {
151                      throw new FacesException(e);
152              }
153        }
154        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
155      }
156    
157      public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
158        this.marginTop = marginTop;
159      }
160    
161      /**
162      This value will usually be set by the layout manager.
163    
164      */
165      public org.apache.myfaces.tobago.layout.Measure getWidth() {
166        if (width != null) {
167          return width;
168        }
169        ValueExpression ve = getValueExpression("width");
170        if (ve != null) {
171          try {
172            Object object = ve.getValue(getFacesContext().getELContext());
173            return Measure.valueOf(object);
174          } catch (ELException e) {
175                      throw new FacesException(e);
176              }
177        }
178        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
179      }
180    
181      public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
182        this.width = width;
183      }
184    
185      public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
186        if (marginRight != null) {
187          return marginRight;
188        }
189        ValueExpression ve = getValueExpression("marginRight");
190        if (ve != null) {
191          try {
192            Object object = ve.getValue(getFacesContext().getELContext());
193            return Measure.valueOf(object);
194          } catch (ELException e) {
195                      throw new FacesException(e);
196              }
197        }
198        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
199      }
200    
201      public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
202        this.marginRight = marginRight;
203      }
204    
205      public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
206        if (preferredHeight != null) {
207          return preferredHeight;
208        }
209        ValueExpression ve = getValueExpression("preferredHeight");
210        if (ve != null) {
211          try {
212            Object object = ve.getValue(getFacesContext().getELContext());
213            return Measure.valueOf(object);
214          } catch (ELException e) {
215                      throw new FacesException(e);
216              }
217        }
218        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
219      }
220    
221      public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
222        this.preferredHeight = preferredHeight;
223      }
224    
225      /**
226      This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
227    
228      */
229      public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
230        if (currentHeight != null) {
231          return currentHeight;
232        }
233        ValueExpression ve = getValueExpression("currentHeight");
234        if (ve != null) {
235          try {
236            Object object = ve.getValue(getFacesContext().getELContext());
237            return Measure.valueOf(object);
238          } catch (ELException e) {
239                      throw new FacesException(e);
240              }
241        }
242        return getHeight();
243      }
244    
245      public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
246        this.currentHeight = currentHeight;
247      }
248    
249      /**
250      This attribute is for internal use only.
251    
252      */
253      public org.apache.myfaces.tobago.layout.Display getDisplay() {
254        if (display != null) {
255          return display;
256        }
257        ValueExpression ve = getValueExpression("display");
258        if (ve != null) {
259          try {
260            return (org.apache.myfaces.tobago.layout.Display) ve.getValue(getFacesContext().getELContext());
261          } catch (ELException e) {
262                      throw new FacesException(e);
263              }
264        }
265        return null;
266      }
267    
268      public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
269        this.display = display;
270      }
271    
272      public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
273        if (minimumHeight != null) {
274          return minimumHeight;
275        }
276        ValueExpression ve = getValueExpression("minimumHeight");
277        if (ve != null) {
278          try {
279            Object object = ve.getValue(getFacesContext().getELContext());
280            return Measure.valueOf(object);
281          } catch (ELException e) {
282                      throw new FacesException(e);
283              }
284        }
285        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
286      }
287    
288      public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
289        this.minimumHeight = minimumHeight;
290      }
291    
292      public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
293        if (maximumWidth != null) {
294          return maximumWidth;
295        }
296        ValueExpression ve = getValueExpression("maximumWidth");
297        if (ve != null) {
298          try {
299            Object object = ve.getValue(getFacesContext().getELContext());
300            return Measure.valueOf(object);
301          } catch (ELException e) {
302                      throw new FacesException(e);
303              }
304        }
305        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
306      }
307    
308      public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
309        this.maximumWidth = maximumWidth;
310      }
311    
312      public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
313        if (preferredWidth != null) {
314          return preferredWidth;
315        }
316        ValueExpression ve = getValueExpression("preferredWidth");
317        if (ve != null) {
318          try {
319            Object object = ve.getValue(getFacesContext().getELContext());
320            return Measure.valueOf(object);
321          } catch (ELException e) {
322                      throw new FacesException(e);
323              }
324        }
325        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
326      }
327    
328      public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
329        this.preferredWidth = preferredWidth;
330      }
331    
332      public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
333        if (marginBottom != null) {
334          return marginBottom;
335        }
336        ValueExpression ve = getValueExpression("marginBottom");
337        if (ve != null) {
338          try {
339            Object object = ve.getValue(getFacesContext().getELContext());
340            return Measure.valueOf(object);
341          } catch (ELException e) {
342                      throw new FacesException(e);
343              }
344        }
345        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
346      }
347    
348      public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
349        this.marginBottom = marginBottom;
350      }
351    
352      /**
353      This value will usually be set by the layout manager.
354    
355      */
356      public org.apache.myfaces.tobago.layout.Measure getHeight() {
357        if (height != null) {
358          return height;
359        }
360        ValueExpression ve = getValueExpression("height");
361        if (ve != null) {
362          try {
363            Object object = ve.getValue(getFacesContext().getELContext());
364            return Measure.valueOf(object);
365          } catch (ELException e) {
366                      throw new FacesException(e);
367              }
368        }
369        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
370      }
371    
372      public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
373        this.height = height;
374      }
375    
376      /**
377      This attribute is for internal use only.
378    
379      */
380      public java.lang.Integer getVerticalIndex() {
381        if (verticalIndex != null) {
382          return verticalIndex;
383        }
384        ValueExpression ve = getValueExpression("verticalIndex");
385        if (ve != null) {
386          try {
387            Number number = (Number) ve.getValue(getFacesContext().getELContext());
388            if (number != null) {
389              return number.intValue();
390            }
391          } catch (ELException e) {
392                      throw new FacesException(e);
393              }
394        }
395        return null;
396      }
397    
398      public void setVerticalIndex(java.lang.Integer verticalIndex) {
399        this.verticalIndex = verticalIndex;
400      }
401    
402      public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
403        if (minimumWidth != null) {
404          return minimumWidth;
405        }
406        ValueExpression ve = getValueExpression("minimumWidth");
407        if (ve != null) {
408          try {
409            Object object = ve.getValue(getFacesContext().getELContext());
410            return Measure.valueOf(object);
411          } catch (ELException e) {
412                      throw new FacesException(e);
413              }
414        }
415        return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
416      }
417    
418      public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
419        this.minimumWidth = minimumWidth;
420      }
421    
422      public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
423        if (currentMarkup != null) {
424          return currentMarkup;
425        }
426        ValueExpression ve = getValueExpression("currentMarkup");
427        if (ve != null) {
428          try {
429            Object object = ve.getValue(getFacesContext().getELContext());
430            return Markup.valueOf(object);
431          } catch (ELException e) {
432                      throw new FacesException(e);
433              }
434        }
435        return null;
436      }
437    
438      public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
439        this.currentMarkup = currentMarkup;
440      }
441    
442      public java.lang.Integer getRowSpan() {
443        if (rowSpan != null) {
444          return rowSpan;
445        }
446        ValueExpression ve = getValueExpression("rowSpan");
447        if (ve != null) {
448          try {
449            Number number = (Number) ve.getValue(getFacesContext().getELContext());
450            if (number != null) {
451              return number.intValue();
452            }
453          } catch (ELException e) {
454                      throw new FacesException(e);
455              }
456        }
457        return 1;
458      }
459    
460      public void setRowSpan(java.lang.Integer rowSpan) {
461        this.rowSpan = rowSpan;
462      }
463    
464      /**
465      This attribute is for internal use only.
466    
467      */
468      public java.lang.Integer getHorizontalIndex() {
469        if (horizontalIndex != null) {
470          return horizontalIndex;
471        }
472        ValueExpression ve = getValueExpression("horizontalIndex");
473        if (ve != null) {
474          try {
475            Number number = (Number) ve.getValue(getFacesContext().getELContext());
476            if (number != null) {
477              return number.intValue();
478            }
479          } catch (ELException e) {
480                      throw new FacesException(e);
481              }
482        }
483        return null;
484      }
485    
486      public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
487        this.horizontalIndex = horizontalIndex;
488      }
489    
490      /**
491      This value will usually be set by the layout manager.
492    
493      */
494      public org.apache.myfaces.tobago.layout.Measure getLeft() {
495        if (left != null) {
496          return left;
497        }
498        ValueExpression ve = getValueExpression("left");
499        if (ve != null) {
500          try {
501            Object object = ve.getValue(getFacesContext().getELContext());
502            return Measure.valueOf(object);
503          } catch (ELException e) {
504                      throw new FacesException(e);
505              }
506        }
507        return null;
508      }
509    
510      public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
511        this.left = left;
512      }
513    
514      /**
515      URI to object source
516    
517      */
518      public java.lang.String getSrc() {
519        if (src != null) {
520          return src;
521        }
522        ValueExpression ve = getValueExpression("src");
523        if (ve != null) {
524          try {
525            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
526          } catch (ELException e) {
527                      throw new FacesException(e);
528              }
529        }
530        return null;
531      }
532    
533      public void setSrc(java.lang.String src) {
534        this.src = src;
535      }
536    
537      public java.lang.Integer getColumnSpan() {
538        if (columnSpan != null) {
539          return columnSpan;
540        }
541        ValueExpression ve = getValueExpression("columnSpan");
542        if (ve != null) {
543          try {
544            Number number = (Number) ve.getValue(getFacesContext().getELContext());
545            if (number != null) {
546              return number.intValue();
547            }
548          } catch (ELException e) {
549                      throw new FacesException(e);
550              }
551        }
552        return 1;
553      }
554    
555      public void setColumnSpan(java.lang.Integer columnSpan) {
556        this.columnSpan = columnSpan;
557      }
558    
559      /**
560      This value will usually be set by the layout manager.
561    
562      */
563      public org.apache.myfaces.tobago.layout.Measure getTop() {
564        if (top != null) {
565          return top;
566        }
567        ValueExpression ve = getValueExpression("top");
568        if (ve != null) {
569          try {
570            Object object = ve.getValue(getFacesContext().getELContext());
571            return Measure.valueOf(object);
572          } catch (ELException e) {
573                      throw new FacesException(e);
574              }
575        }
576        return null;
577      }
578    
579      public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
580        this.top = top;
581      }
582    
583      public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
584        if (maximumHeight != null) {
585          return maximumHeight;
586        }
587        ValueExpression ve = getValueExpression("maximumHeight");
588        if (ve != null) {
589          try {
590            Object object = ve.getValue(getFacesContext().getELContext());
591            return Measure.valueOf(object);
592          } catch (ELException e) {
593                      throw new FacesException(e);
594              }
595        }
596        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
597      }
598    
599      public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
600        this.maximumHeight = maximumHeight;
601      }
602    
603      public void restoreState(FacesContext context, Object componentState) {
604        Object[] values = (Object[]) componentState;
605        super.restoreState(context, values[0]);
606        currentWidth = (org.apache.myfaces.tobago.layout.Measure) values[1];
607        markup = (org.apache.myfaces.tobago.context.Markup) values[2];
608        marginLeft = (org.apache.myfaces.tobago.layout.Measure) values[3];
609        marginTop = (org.apache.myfaces.tobago.layout.Measure) values[4];
610        width = (org.apache.myfaces.tobago.layout.Measure) values[5];
611        marginRight = (org.apache.myfaces.tobago.layout.Measure) values[6];
612        preferredHeight = (org.apache.myfaces.tobago.layout.Measure) values[7];
613        currentHeight = (org.apache.myfaces.tobago.layout.Measure) values[8];
614        display = (org.apache.myfaces.tobago.layout.Display) values[9];
615        minimumHeight = (org.apache.myfaces.tobago.layout.Measure) values[10];
616        maximumWidth = (org.apache.myfaces.tobago.layout.Measure) values[11];
617        preferredWidth = (org.apache.myfaces.tobago.layout.Measure) values[12];
618        marginBottom = (org.apache.myfaces.tobago.layout.Measure) values[13];
619        height = (org.apache.myfaces.tobago.layout.Measure) values[14];
620        verticalIndex = (java.lang.Integer) values[15];
621        minimumWidth = (org.apache.myfaces.tobago.layout.Measure) values[16];
622        currentMarkup = (org.apache.myfaces.tobago.context.Markup) values[17];
623        rowSpan = (java.lang.Integer) values[18];
624        horizontalIndex = (java.lang.Integer) values[19];
625        left = (org.apache.myfaces.tobago.layout.Measure) values[20];
626        src = (java.lang.String) values[21];
627        columnSpan = (java.lang.Integer) values[22];
628        top = (org.apache.myfaces.tobago.layout.Measure) values[23];
629        maximumHeight = (org.apache.myfaces.tobago.layout.Measure) values[24];
630      }
631    
632      public Object saveState(FacesContext context) {
633        Object[] values = new Object[25];
634        values[0] = super.saveState(context);
635        values[1] = currentWidth;
636        values[2] = markup;
637        values[3] = marginLeft;
638        values[4] = marginTop;
639        values[5] = width;
640        values[6] = marginRight;
641        values[7] = preferredHeight;
642        values[8] = currentHeight;
643        values[9] = display;
644        values[10] = minimumHeight;
645        values[11] = maximumWidth;
646        values[12] = preferredWidth;
647        values[13] = marginBottom;
648        values[14] = height;
649        values[15] = verticalIndex;
650        values[16] = minimumWidth;
651        values[17] = currentMarkup;
652        values[18] = rowSpan;
653        values[19] = horizontalIndex;
654        values[20] = left;
655        values[21] = src;
656        values[22] = columnSpan;
657        values[23] = top;
658        values[24] = maximumHeight;
659        return values;
660      }
661    
662    
663    }