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