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