View Javadoc

1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.myfaces.tobago.component;
21  
22  import javax.faces.context.FacesContext;
23  import org.apache.myfaces.tobago.context.Markup;
24  import org.apache.myfaces.tobago.internal.component.AbstractUIMenuBar;
25  import org.apache.myfaces.tobago.layout.Display;
26  import org.apache.myfaces.tobago.layout.Measure;
27  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
28  import org.apache.myfaces.tobago.internal.util.StringUtils;
29  import org.apache.myfaces.tobago.internal.util.Deprecation;
30  import org.apache.myfaces.tobago.renderkit.MarginValues;
31  import org.apache.myfaces.tobago.renderkit.SpacingValues;
32  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.ArrayList;
36  import java.util.List;
37  import javax.el.MethodExpression;
38  import javax.el.ValueExpression;
39  
40  /** 
41   Renders a menu bar.<br />
42    Add menu bar as facet name="menuBar" to page tag or use it anywhere
43    on page.<br />
44    * UIComponent class, generated from template {@code component2.0.stg} with class
45    * {@link org.apache.myfaces.tobago.internal.taglib.component.MenuBarTagDeclaration}.
46   */
47  public class UIMenuBar
48      extends AbstractUIMenuBar implements SupportsMarkup {
49  
50    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.MenuBar";
51  
52    public static final String COMPONENT_FAMILY = "javax.faces.Panel";
53  
54    private org.apache.myfaces.tobago.context.Markup currentMarkup;
55  
56    enum PropertyKeys {
57      currentWidth,
58      markup,
59      marginTop,
60      marginLeft,
61      width,
62      marginRight,
63      currentHeight,
64      preferredHeight,
65      display,
66      minimumHeight,
67      maximumWidth,
68      preferredWidth,
69      marginBottom,
70      height,
71      verticalIndex,
72      minimumWidth,
73      rowSpan,
74      horizontalIndex,
75      left,
76      columnSpan,
77      top,
78      maximumHeight,
79    }
80  
81    public String getFamily() {
82      return COMPONENT_FAMILY;
83    }
84  
85  
86    /**
87    This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
88  
89    */
90    public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
91      Object object = getStateHelper().eval(PropertyKeys.currentWidth);
92      if (object != null) {
93         return Measure.valueOf(object);
94      }
95      return getWidth();
96    }
97  
98    public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
99      getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
100   }
101 
102   public org.apache.myfaces.tobago.context.Markup getMarkup() {
103     Object object = getStateHelper().eval(PropertyKeys.markup);
104     if (object != null) {
105       return Markup.valueOf(object);
106     }
107     return null;
108   }
109 
110   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
111     getStateHelper().put(PropertyKeys.markup, markup);
112   }
113 
114   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
115     Object object = getStateHelper().eval(PropertyKeys.marginTop);
116     if (object != null) {
117        return Measure.valueOf(object);
118     }
119     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
120   }
121 
122   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
123     getStateHelper().put(PropertyKeys.marginTop, marginTop);
124   }
125 
126   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
127     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
128     if (object != null) {
129        return Measure.valueOf(object);
130     }
131     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
132   }
133 
134   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
135     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
136   }
137 
138   /**
139   This value will usually be set by the layout manager.
140 
141   */
142   public org.apache.myfaces.tobago.layout.Measure getWidth() {
143     Object object = getStateHelper().eval(PropertyKeys.width);
144     if (object != null) {
145        return Measure.valueOf(object);
146     }
147     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
148   }
149 
150   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
151     getStateHelper().put(PropertyKeys.width, width);
152   }
153 
154   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
155     Object object = getStateHelper().eval(PropertyKeys.marginRight);
156     if (object != null) {
157        return Measure.valueOf(object);
158     }
159     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
160   }
161 
162   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
163     getStateHelper().put(PropertyKeys.marginRight, marginRight);
164   }
165 
166   /**
167   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
168 
169   */
170   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
171     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
172     if (object != null) {
173        return Measure.valueOf(object);
174     }
175     return getHeight();
176   }
177 
178   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
179     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
180   }
181 
182   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
183     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
184     if (object != null) {
185        return Measure.valueOf(object);
186     }
187     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
188   }
189 
190   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
191     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
192   }
193 
194   /**
195   This attribute is for internal use only.
196 
197   */
198   public org.apache.myfaces.tobago.layout.Display getDisplay() {
199     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
200   }
201 
202   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
203     getStateHelper().put(PropertyKeys.display, display);
204   }
205 
206   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
207     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
208     if (object != null) {
209        return Measure.valueOf(object);
210     }
211     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
212   }
213 
214   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
215     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
216   }
217 
218   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
219     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
220     if (object != null) {
221        return Measure.valueOf(object);
222     }
223     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
224   }
225 
226   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
227     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
228   }
229 
230   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
231     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
232     if (object != null) {
233        return Measure.valueOf(object);
234     }
235     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
236   }
237 
238   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
239     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
240   }
241 
242   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
243     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
244     if (object != null) {
245        return Measure.valueOf(object);
246     }
247     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
248   }
249 
250   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
251     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
252   }
253 
254   /**
255   This value will usually be set by the layout manager.
256 
257   */
258   public org.apache.myfaces.tobago.layout.Measure getHeight() {
259     Object object = getStateHelper().eval(PropertyKeys.height);
260     if (object != null) {
261        return Measure.valueOf(object);
262     }
263     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
264   }
265 
266   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
267     getStateHelper().put(PropertyKeys.height, height);
268   }
269 
270   /**
271   This attribute is for internal use only.
272 
273   */
274   public java.lang.Integer getVerticalIndex() {
275     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
276     if (value != null) {
277       return value.intValue();
278     }
279     return null;
280   }
281 
282   public void setVerticalIndex(java.lang.Integer verticalIndex) {
283     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
284   }
285 
286   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
287     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
288     if (object != null) {
289        return Measure.valueOf(object);
290     }
291     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
292   }
293 
294   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
295     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
296   }
297 
298   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
299     if (currentMarkup != null) {
300       return currentMarkup;
301     }
302     return null;
303   }
304 
305   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
306     this.currentMarkup = currentMarkup;
307   }
308 
309   public java.lang.Integer getRowSpan() {
310     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
311     if (value != null) {
312       return value.intValue();
313     }
314     return 1;
315   }
316 
317   public void setRowSpan(java.lang.Integer rowSpan) {
318     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
319   }
320 
321   /**
322   This attribute is for internal use only.
323 
324   */
325   public java.lang.Integer getHorizontalIndex() {
326     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
327     if (value != null) {
328       return value.intValue();
329     }
330     return null;
331   }
332 
333   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
334     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
335   }
336 
337   /**
338   This value will usually be set by the layout manager.
339 
340   */
341   public org.apache.myfaces.tobago.layout.Measure getLeft() {
342     Object object = getStateHelper().eval(PropertyKeys.left);
343     if (object != null) {
344        return Measure.valueOf(object);
345     }
346     return null;
347   }
348 
349   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
350     getStateHelper().put(PropertyKeys.left, left);
351   }
352 
353   public java.lang.Integer getColumnSpan() {
354     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
355     if (value != null) {
356       return value.intValue();
357     }
358     return 1;
359   }
360 
361   public void setColumnSpan(java.lang.Integer columnSpan) {
362     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
363   }
364 
365   /**
366   This value will usually be set by the layout manager.
367 
368   */
369   public org.apache.myfaces.tobago.layout.Measure getTop() {
370     Object object = getStateHelper().eval(PropertyKeys.top);
371     if (object != null) {
372        return Measure.valueOf(object);
373     }
374     return null;
375   }
376 
377   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
378     getStateHelper().put(PropertyKeys.top, top);
379   }
380 
381   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
382     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
383     if (object != null) {
384        return Measure.valueOf(object);
385     }
386     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
387   }
388 
389   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
390     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
391   }
392 
393   public Object saveState(FacesContext context) {
394     currentMarkup = null;
395     return super.saveState(context);
396   }
397 
398 
399 }