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        return null;
427      }
428    
429      public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
430        this.currentMarkup = currentMarkup;
431      }
432    
433      public java.lang.Integer getRowSpan() {
434        if (rowSpan != null) {
435          return rowSpan;
436        }
437        ValueExpression ve = getValueExpression("rowSpan");
438        if (ve != null) {
439          try {
440            Number number = (Number) ve.getValue(getFacesContext().getELContext());
441            if (number != null) {
442              return number.intValue();
443            }
444          } catch (ELException e) {
445                      throw new FacesException(e);
446              }
447        }
448        return 1;
449      }
450    
451      public void setRowSpan(java.lang.Integer rowSpan) {
452        this.rowSpan = rowSpan;
453      }
454    
455      /**
456      This attribute is for internal use only.
457    
458      */
459      public java.lang.Integer getHorizontalIndex() {
460        if (horizontalIndex != null) {
461          return horizontalIndex;
462        }
463        ValueExpression ve = getValueExpression("horizontalIndex");
464        if (ve != null) {
465          try {
466            Number number = (Number) ve.getValue(getFacesContext().getELContext());
467            if (number != null) {
468              return number.intValue();
469            }
470          } catch (ELException e) {
471                      throw new FacesException(e);
472              }
473        }
474        return null;
475      }
476    
477      public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
478        this.horizontalIndex = horizontalIndex;
479      }
480    
481      /**
482      This value will usually be set by the layout manager.
483    
484      */
485      public org.apache.myfaces.tobago.layout.Measure getLeft() {
486        if (left != null) {
487          return left;
488        }
489        ValueExpression ve = getValueExpression("left");
490        if (ve != null) {
491          try {
492            Object object = ve.getValue(getFacesContext().getELContext());
493            return Measure.valueOf(object);
494          } catch (ELException e) {
495                      throw new FacesException(e);
496              }
497        }
498        return null;
499      }
500    
501      public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
502        this.left = left;
503      }
504    
505      /**
506      URI to object source
507    
508      */
509      public java.lang.String getSrc() {
510        if (src != null) {
511          return src;
512        }
513        ValueExpression ve = getValueExpression("src");
514        if (ve != null) {
515          try {
516            return (java.lang.String) ve.getValue(getFacesContext().getELContext());
517          } catch (ELException e) {
518                      throw new FacesException(e);
519              }
520        }
521        return null;
522      }
523    
524      public void setSrc(java.lang.String src) {
525        this.src = src;
526      }
527    
528      public java.lang.Integer getColumnSpan() {
529        if (columnSpan != null) {
530          return columnSpan;
531        }
532        ValueExpression ve = getValueExpression("columnSpan");
533        if (ve != null) {
534          try {
535            Number number = (Number) ve.getValue(getFacesContext().getELContext());
536            if (number != null) {
537              return number.intValue();
538            }
539          } catch (ELException e) {
540                      throw new FacesException(e);
541              }
542        }
543        return 1;
544      }
545    
546      public void setColumnSpan(java.lang.Integer columnSpan) {
547        this.columnSpan = columnSpan;
548      }
549    
550      /**
551      This value will usually be set by the layout manager.
552    
553      */
554      public org.apache.myfaces.tobago.layout.Measure getTop() {
555        if (top != null) {
556          return top;
557        }
558        ValueExpression ve = getValueExpression("top");
559        if (ve != null) {
560          try {
561            Object object = ve.getValue(getFacesContext().getELContext());
562            return Measure.valueOf(object);
563          } catch (ELException e) {
564                      throw new FacesException(e);
565              }
566        }
567        return null;
568      }
569    
570      public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
571        this.top = top;
572      }
573    
574      public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
575        if (maximumHeight != null) {
576          return maximumHeight;
577        }
578        ValueExpression ve = getValueExpression("maximumHeight");
579        if (ve != null) {
580          try {
581            Object object = ve.getValue(getFacesContext().getELContext());
582            return Measure.valueOf(object);
583          } catch (ELException e) {
584                      throw new FacesException(e);
585              }
586        }
587        return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
588      }
589    
590      public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
591        this.maximumHeight = maximumHeight;
592      }
593    
594      public void restoreState(FacesContext context, Object componentState) {
595        Object[] values = (Object[]) componentState;
596        super.restoreState(context, values[0]);
597        currentWidth = (org.apache.myfaces.tobago.layout.Measure) values[1];
598        markup = (org.apache.myfaces.tobago.context.Markup) values[2];
599        marginLeft = (org.apache.myfaces.tobago.layout.Measure) values[3];
600        marginTop = (org.apache.myfaces.tobago.layout.Measure) values[4];
601        width = (org.apache.myfaces.tobago.layout.Measure) values[5];
602        marginRight = (org.apache.myfaces.tobago.layout.Measure) values[6];
603        preferredHeight = (org.apache.myfaces.tobago.layout.Measure) values[7];
604        currentHeight = (org.apache.myfaces.tobago.layout.Measure) values[8];
605        display = (org.apache.myfaces.tobago.layout.Display) values[9];
606        minimumHeight = (org.apache.myfaces.tobago.layout.Measure) values[10];
607        maximumWidth = (org.apache.myfaces.tobago.layout.Measure) values[11];
608        preferredWidth = (org.apache.myfaces.tobago.layout.Measure) values[12];
609        marginBottom = (org.apache.myfaces.tobago.layout.Measure) values[13];
610        height = (org.apache.myfaces.tobago.layout.Measure) values[14];
611        verticalIndex = (java.lang.Integer) values[15];
612        minimumWidth = (org.apache.myfaces.tobago.layout.Measure) values[16];
613        rowSpan = (java.lang.Integer) values[17];
614        horizontalIndex = (java.lang.Integer) values[18];
615        left = (org.apache.myfaces.tobago.layout.Measure) values[19];
616        src = (java.lang.String) values[20];
617        columnSpan = (java.lang.Integer) values[21];
618        top = (org.apache.myfaces.tobago.layout.Measure) values[22];
619        maximumHeight = (org.apache.myfaces.tobago.layout.Measure) values[23];
620      }
621    
622      public Object saveState(FacesContext context) {
623        Object[] values = new Object[24];
624        values[0] = super.saveState(context);
625        values[1] = currentWidth;
626        values[2] = markup;
627        values[3] = marginLeft;
628        values[4] = marginTop;
629        values[5] = width;
630        values[6] = marginRight;
631        values[7] = preferredHeight;
632        values[8] = currentHeight;
633        values[9] = display;
634        values[10] = minimumHeight;
635        values[11] = maximumWidth;
636        values[12] = preferredWidth;
637        values[13] = marginBottom;
638        values[14] = height;
639        values[15] = verticalIndex;
640        values[16] = minimumWidth;
641        values[17] = rowSpan;
642        values[18] = horizontalIndex;
643        values[19] = left;
644        values[20] = src;
645        values[21] = columnSpan;
646        values[22] = top;
647        values[23] = maximumHeight;
648        currentMarkup = null;
649        return values;
650      }
651    
652    
653    }