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