1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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.commons.lang.ArrayUtils;
28 import org.apache.commons.lang.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
42
43
44
45
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 marginLeft,
60 marginTop,
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
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 getMarginLeft() {
115 Object object = getStateHelper().eval(PropertyKeys.marginLeft);
116 if (object != null) {
117 return Measure.valueOf(object);
118 }
119 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
120 }
121
122 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
123 getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
124 }
125
126 public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
127 Object object = getStateHelper().eval(PropertyKeys.marginTop);
128 if (object != null) {
129 return Measure.valueOf(object);
130 }
131 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
132 }
133
134 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
135 getStateHelper().put(PropertyKeys.marginTop, marginTop);
136 }
137
138
139
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
160 }
161
162 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
163 getStateHelper().put(PropertyKeys.marginRight, marginRight);
164 }
165
166
167
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
188 }
189
190 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
191 getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
192 }
193
194
195
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
248 }
249
250 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
251 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
252 }
253
254
255
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
264 }
265
266 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
267 getStateHelper().put(PropertyKeys.height, height);
268 }
269
270
271
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 ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
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
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
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
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 ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
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 }