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.AbstractUITree;
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 public class UITreeMenu
47 extends AbstractUITree implements SupportsMarkup {
48
49 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TreeMenu";
50
51 public static final String COMPONENT_FAMILY = "javax.faces.Data";
52
53 private org.apache.myfaces.tobago.context.Markup currentMarkup;
54
55 enum PropertyKeys {
56 markup,
57 marginLeft,
58 minimumHeight,
59 height,
60 showRoot,
61 minimumWidth,
62 rowSpan,
63 left,
64 columnSpan,
65 maximumHeight,
66 top,
67 currentWidth,
68 marginTop,
69 marginRight,
70 width,
71 preferredHeight,
72 currentHeight,
73 display,
74 maximumWidth,
75 preferredWidth,
76 marginBottom,
77 verticalIndex,
78 horizontalIndex,
79 }
80
81 public String getFamily() {
82 return COMPONENT_FAMILY;
83 }
84
85
86 public org.apache.myfaces.tobago.context.Markup getMarkup() {
87 Object object = getStateHelper().eval(PropertyKeys.markup);
88 if (object != null) {
89 return Markup.valueOf(object);
90 }
91 return null;
92 }
93
94 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
95 getStateHelper().put(PropertyKeys.markup, markup);
96 }
97
98 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
99 Object object = getStateHelper().eval(PropertyKeys.marginLeft);
100 if (object != null) {
101 return Measure.valueOf(object);
102 }
103 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
104 }
105
106 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
107 getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
108 }
109
110 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
111 Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
112 if (object != null) {
113 return Measure.valueOf(object);
114 }
115 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
116 }
117
118 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
119 getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
120 }
121
122
123
124
125
126 public org.apache.myfaces.tobago.layout.Measure getHeight() {
127 Object object = getStateHelper().eval(PropertyKeys.height);
128 if (object != null) {
129 return Measure.valueOf(object);
130 }
131 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
132 }
133
134 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
135 getStateHelper().put(PropertyKeys.height, height);
136 }
137
138
139
140
141
142
143
144 public boolean isShowRoot() {
145 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRoot);
146 if (bool != null) {
147 return bool;
148 }
149 return false;
150 }
151
152 public void setShowRoot(boolean showRoot) {
153 getStateHelper().put(PropertyKeys.showRoot, showRoot);
154 }
155
156 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
157 Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
158 if (object != null) {
159 return Measure.valueOf(object);
160 }
161 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
162 }
163
164 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
165 getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
166 }
167
168 public java.lang.Integer getRowSpan() {
169 Number value = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
170 if (value != null) {
171 return value.intValue();
172 }
173 return 1;
174 }
175
176 public void setRowSpan(java.lang.Integer rowSpan) {
177 getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
178 }
179
180
181
182
183
184 public org.apache.myfaces.tobago.layout.Measure getLeft() {
185 Object object = getStateHelper().eval(PropertyKeys.left);
186 if (object != null) {
187 return Measure.valueOf(object);
188 }
189 return null;
190 }
191
192 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
193 getStateHelper().put(PropertyKeys.left, left);
194 }
195
196 public java.lang.Integer getColumnSpan() {
197 Number value = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
198 if (value != null) {
199 return value.intValue();
200 }
201 return 1;
202 }
203
204 public void setColumnSpan(java.lang.Integer columnSpan) {
205 getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
206 }
207
208 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
209 Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
210 if (object != null) {
211 return Measure.valueOf(object);
212 }
213 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
214 }
215
216 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
217 getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
218 }
219
220
221
222
223
224 public org.apache.myfaces.tobago.layout.Measure getTop() {
225 Object object = getStateHelper().eval(PropertyKeys.top);
226 if (object != null) {
227 return Measure.valueOf(object);
228 }
229 return null;
230 }
231
232 public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
233 getStateHelper().put(PropertyKeys.top, top);
234 }
235
236
237
238
239
240 public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
241 Object object = getStateHelper().eval(PropertyKeys.currentWidth);
242 if (object != null) {
243 return Measure.valueOf(object);
244 }
245 return getWidth();
246 }
247
248 public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
249 getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
250 }
251
252 public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
253 Object object = getStateHelper().eval(PropertyKeys.marginTop);
254 if (object != null) {
255 return Measure.valueOf(object);
256 }
257 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
258 }
259
260 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
261 getStateHelper().put(PropertyKeys.marginTop, marginTop);
262 }
263
264 public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
265 Object object = getStateHelper().eval(PropertyKeys.marginRight);
266 if (object != null) {
267 return Measure.valueOf(object);
268 }
269 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
270 }
271
272 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
273 getStateHelper().put(PropertyKeys.marginRight, marginRight);
274 }
275
276
277
278
279
280 public org.apache.myfaces.tobago.layout.Measure getWidth() {
281 Object object = getStateHelper().eval(PropertyKeys.width);
282 if (object != null) {
283 return Measure.valueOf(object);
284 }
285 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
286 }
287
288 public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
289 getStateHelper().put(PropertyKeys.width, width);
290 }
291
292 public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
293 Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
294 if (object != null) {
295 return Measure.valueOf(object);
296 }
297 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
298 }
299
300 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
301 getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
302 }
303
304
305
306
307
308 public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
309 Object object = getStateHelper().eval(PropertyKeys.currentHeight);
310 if (object != null) {
311 return Measure.valueOf(object);
312 }
313 return getHeight();
314 }
315
316 public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
317 getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
318 }
319
320
321
322
323
324 public org.apache.myfaces.tobago.layout.Display getDisplay() {
325 return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
326 }
327
328 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
329 getStateHelper().put(PropertyKeys.display, display);
330 }
331
332 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
333 Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
334 if (object != null) {
335 return Measure.valueOf(object);
336 }
337 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
338 }
339
340 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
341 getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
342 }
343
344 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
345 Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
346 if (object != null) {
347 return Measure.valueOf(object);
348 }
349 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
350 }
351
352 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
353 getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
354 }
355
356 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
357 Object object = getStateHelper().eval(PropertyKeys.marginBottom);
358 if (object != null) {
359 return Measure.valueOf(object);
360 }
361 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
362 }
363
364 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
365 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
366 }
367
368
369
370
371
372 public java.lang.Integer getVerticalIndex() {
373 Number value = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
374 if (value != null) {
375 return value.intValue();
376 }
377 return null;
378 }
379
380 public void setVerticalIndex(java.lang.Integer verticalIndex) {
381 getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
382 }
383
384 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
385 if (currentMarkup != null) {
386 return currentMarkup;
387 }
388 return null;
389 }
390
391 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
392 this.currentMarkup = currentMarkup;
393 }
394
395
396
397
398
399 public java.lang.Integer getHorizontalIndex() {
400 Number value = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
401 if (value != null) {
402 return value.intValue();
403 }
404 return null;
405 }
406
407 public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
408 getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
409 }
410
411 public Object saveState(FacesContext context) {
412 currentMarkup = null;
413 return super.saveState(context);
414 }
415
416
417 }