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