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.AbstractUIMenu;
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   Container component to hold submenus and items.
42    * UIComponent class, generated from template {@code component2.0.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.MenuTagDeclaration}.
44   */
45  public class UIMenu
46      extends AbstractUIMenu implements SupportsAccessKey, SupportsMarkup {
47  
48    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Menu";
49  
50    public static final String COMPONENT_FAMILY = "javax.faces.Panel";
51  
52    private org.apache.myfaces.tobago.context.Markup currentMarkup;
53  
54    enum PropertyKeys {
55      markup,
56      accessKey,
57      marginLeft,
58      minimumHeight,
59      height,
60      minimumWidth,
61      rowSpan,
62      left,
63      columnSpan,
64      maximumHeight,
65      top,
66      currentWidth,
67      marginTop,
68      marginRight,
69      width,
70      preferredHeight,
71      currentHeight,
72      image,
73      label,
74      display,
75      maximumWidth,
76      preferredWidth,
77      marginBottom,
78      verticalIndex,
79      horizontalIndex,
80      disabled,
81    }
82  
83    public String getFamily() {
84      return COMPONENT_FAMILY;
85    }
86  
87  
88    public org.apache.myfaces.tobago.context.Markup getMarkup() {
89      Object object = getStateHelper().eval(PropertyKeys.markup);
90      if (object != null) {
91        return Markup.valueOf(object);
92      }
93      return null;
94    }
95  
96    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
97      getStateHelper().put(PropertyKeys.markup, markup);
98    }
99  
100   /**
101   The access key of this control.
102 
103   */
104   public java.lang.Character getAccessKey() {
105     return (java.lang.Character) getStateHelper().eval(PropertyKeys.accessKey);
106   }
107 
108   public void setAccessKey(java.lang.Character accessKey) {
109     getStateHelper().put(PropertyKeys.accessKey, accessKey);
110   }
111 
112   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
113     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
114     if (object != null) {
115        return Measure.valueOf(object);
116     }
117     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
118   }
119 
120   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
121     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
122   }
123 
124   public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
125     Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
126     if (object != null) {
127        return Measure.valueOf(object);
128     }
129     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this) : Measure.ZERO;
130   }
131 
132   public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
133     getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
134   }
135 
136   /**
137   This value will usually be set by the layout manager.
138 
139   */
140   public org.apache.myfaces.tobago.layout.Measure getHeight() {
141     Object object = getStateHelper().eval(PropertyKeys.height);
142     if (object != null) {
143        return Measure.valueOf(object);
144     }
145     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this) : Measure.ZERO;
146   }
147 
148   public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
149     getStateHelper().put(PropertyKeys.height, height);
150   }
151 
152   public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
153     Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
154     if (object != null) {
155        return Measure.valueOf(object);
156     }
157     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this) : Measure.ZERO;
158   }
159 
160   public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
161     getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
162   }
163 
164   public java.lang.Integer getRowSpan() {
165     Number value  = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
166     if (value != null) {
167       return value.intValue();
168     }
169     return 1;
170   }
171 
172   public void setRowSpan(java.lang.Integer rowSpan) {
173     getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
174   }
175 
176   /**
177   This value will usually be set by the layout manager.
178 
179   */
180   public org.apache.myfaces.tobago.layout.Measure getLeft() {
181     Object object = getStateHelper().eval(PropertyKeys.left);
182     if (object != null) {
183        return Measure.valueOf(object);
184     }
185     return null;
186   }
187 
188   public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
189     getStateHelper().put(PropertyKeys.left, left);
190   }
191 
192   public java.lang.Integer getColumnSpan() {
193     Number value  = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
194     if (value != null) {
195       return value.intValue();
196     }
197     return 1;
198   }
199 
200   public void setColumnSpan(java.lang.Integer columnSpan) {
201     getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
202   }
203 
204   public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
205     Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
206     if (object != null) {
207        return Measure.valueOf(object);
208     }
209     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this) : Measure.ZERO;
210   }
211 
212   public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
213     getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
214   }
215 
216   /**
217   This value will usually be set by the layout manager.
218 
219   */
220   public org.apache.myfaces.tobago.layout.Measure getTop() {
221     Object object = getStateHelper().eval(PropertyKeys.top);
222     if (object != null) {
223        return Measure.valueOf(object);
224     }
225     return null;
226   }
227 
228   public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
229     getStateHelper().put(PropertyKeys.top, top);
230   }
231 
232   /**
233   This value will usually be set by the layout manager. It holds the current width computed by the layout manager.
234 
235   */
236   public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
237     Object object = getStateHelper().eval(PropertyKeys.currentWidth);
238     if (object != null) {
239        return Measure.valueOf(object);
240     }
241     return getWidth();
242   }
243 
244   public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
245     getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
246   }
247 
248   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
249     Object object = getStateHelper().eval(PropertyKeys.marginTop);
250     if (object != null) {
251        return Measure.valueOf(object);
252     }
253     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
254   }
255 
256   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
257     getStateHelper().put(PropertyKeys.marginTop, marginTop);
258   }
259 
260   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
261     Object object = getStateHelper().eval(PropertyKeys.marginRight);
262     if (object != null) {
263        return Measure.valueOf(object);
264     }
265     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
266   }
267 
268   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
269     getStateHelper().put(PropertyKeys.marginRight, marginRight);
270   }
271 
272   /**
273   This value will usually be set by the layout manager.
274 
275   */
276   public org.apache.myfaces.tobago.layout.Measure getWidth() {
277     Object object = getStateHelper().eval(PropertyKeys.width);
278     if (object != null) {
279        return Measure.valueOf(object);
280     }
281     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this) : Measure.ZERO;
282   }
283 
284   public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
285     getStateHelper().put(PropertyKeys.width, width);
286   }
287 
288   public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
289     Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
290     if (object != null) {
291        return Measure.valueOf(object);
292     }
293     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this) : Measure.ZERO;
294   }
295 
296   public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
297     getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
298   }
299 
300   /**
301   This value will usually be set by the layout manager. It holds the current height computed by the layout manager.
302 
303   */
304   public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
305     Object object = getStateHelper().eval(PropertyKeys.currentHeight);
306     if (object != null) {
307        return Measure.valueOf(object);
308     }
309     return getHeight();
310   }
311 
312   public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
313     getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
314   }
315 
316   /**
317   Url to an image to display.
318 
319   */
320   public java.lang.String getImage() {
321     return (java.lang.String) getStateHelper().eval(PropertyKeys.image);
322   }
323 
324   public void setImage(java.lang.String image) {
325     getStateHelper().put(PropertyKeys.image, image);
326   }
327 
328   /**
329   Text value to display as label.
330    If text contains an underscore the next character is used as accesskey (if configured so and possible).
331 
332   */
333   public java.lang.String getLabel() {
334     return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
335   }
336 
337   public void setLabel(java.lang.String label) {
338     getStateHelper().put(PropertyKeys.label, label);
339   }
340 
341   /**
342   This attribute is for internal use only.
343 
344   */
345   public org.apache.myfaces.tobago.layout.Display getDisplay() {
346     return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
347   }
348 
349   public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
350     getStateHelper().put(PropertyKeys.display, display);
351   }
352 
353   public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
354     Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
355     if (object != null) {
356        return Measure.valueOf(object);
357     }
358     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this) : Measure.ZERO;
359   }
360 
361   public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
362     getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
363   }
364 
365   public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
366     Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
367     if (object != null) {
368        return Measure.valueOf(object);
369     }
370     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this) : Measure.ZERO;
371   }
372 
373   public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
374     getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
375   }
376 
377   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
378     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
379     if (object != null) {
380        return Measure.valueOf(object);
381     }
382     return getRendererType() != null ? ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
383   }
384 
385   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
386     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
387   }
388 
389   /**
390   This attribute is for internal use only.
391 
392   */
393   public java.lang.Integer getVerticalIndex() {
394     Number value  = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
395     if (value != null) {
396       return value.intValue();
397     }
398     return null;
399   }
400 
401   public void setVerticalIndex(java.lang.Integer verticalIndex) {
402     getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
403   }
404 
405   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
406     if (currentMarkup != null) {
407       return currentMarkup;
408     }
409     return null;
410   }
411 
412   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
413     this.currentMarkup = currentMarkup;
414   }
415 
416   /**
417   This attribute is for internal use only.
418 
419   */
420   public java.lang.Integer getHorizontalIndex() {
421     Number value  = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
422     if (value != null) {
423       return value.intValue();
424     }
425     return null;
426   }
427 
428   public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
429     getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
430   }
431 
432   /**
433   Flag indicating that this element is disabled.
434   <br />Default: <code>false</code>
435   */
436   public boolean isDisabled() {
437     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
438     if (bool != null) {
439       return bool;
440     }
441     return false;
442   }
443 
444   public void setDisabled(boolean disabled) {
445     getStateHelper().put(PropertyKeys.disabled, disabled);
446   }
447 
448   public Object saveState(FacesContext context) {
449     currentMarkup = null;
450     return super.saveState(context);
451   }
452 
453 }