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