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