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.AbstractUITreeListbox;
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 public class UITreeListbox
46 extends AbstractUITreeListbox implements SupportsMarkup {
47
48 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TreeListbox";
49
50 public static final String COMPONENT_FAMILY = "javax.faces.Data";
51
52 private org.apache.myfaces.tobago.context.Markup currentMarkup;
53
54 enum PropertyKeys {
55 markup,
56 marginLeft,
57 minimumHeight,
58 height,
59 minimumWidth,
60 rowSpan,
61 left,
62 columnSpan,
63 required,
64 maximumHeight,
65 top,
66 currentWidth,
67 marginTop,
68 marginRight,
69 width,
70 preferredHeight,
71 currentHeight,
72 display,
73 maximumWidth,
74 preferredWidth,
75 marginBottom,
76 selectable,
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 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
139 Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
140 if (object != null) {
141 return Measure.valueOf(object);
142 }
143 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
144 }
145
146 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
147 getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
148 }
149
150 public java.lang.Integer getRowSpan() {
151 Number value = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
152 if (value != null) {
153 return value.intValue();
154 }
155 return 1;
156 }
157
158 public void setRowSpan(java.lang.Integer rowSpan) {
159 getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
160 }
161
162
163
164
165
166 public org.apache.myfaces.tobago.layout.Measure getLeft() {
167 Object object = getStateHelper().eval(PropertyKeys.left);
168 if (object != null) {
169 return Measure.valueOf(object);
170 }
171 return null;
172 }
173
174 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
175 getStateHelper().put(PropertyKeys.left, left);
176 }
177
178 public java.lang.Integer getColumnSpan() {
179 Number value = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
180 if (value != null) {
181 return value.intValue();
182 }
183 return 1;
184 }
185
186 public void setColumnSpan(java.lang.Integer columnSpan) {
187 getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
188 }
189
190
191
192
193
194
195
196 public boolean isRequired() {
197 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.required);
198 if (bool != null) {
199 return bool;
200 }
201 return false;
202 }
203
204 public void setRequired(boolean required) {
205 getStateHelper().put(PropertyKeys.required, required);
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
373
374
375
376
377
378
379
380 public java.lang.String getSelectable() {
381 java.lang.String selectable = (java.lang.String) getStateHelper().eval(PropertyKeys.selectable);
382 if (selectable != null) {
383 return selectable;
384 }
385 return "single";
386 }
387
388 public void setSelectable(java.lang.String selectable) {
389 getStateHelper().put(PropertyKeys.selectable, selectable);
390 }
391
392
393
394
395
396 public java.lang.Integer getVerticalIndex() {
397 Number value = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
398 if (value != null) {
399 return value.intValue();
400 }
401 return null;
402 }
403
404 public void setVerticalIndex(java.lang.Integer verticalIndex) {
405 getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
406 }
407
408 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
409 if (currentMarkup != null) {
410 return currentMarkup;
411 }
412 return null;
413 }
414
415 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
416 this.currentMarkup = currentMarkup;
417 }
418
419
420
421
422
423 public java.lang.Integer getHorizontalIndex() {
424 Number value = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
425 if (value != null) {
426 return value.intValue();
427 }
428 return null;
429 }
430
431 public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
432 getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
433 }
434
435 public Object saveState(FacesContext context) {
436 currentMarkup = null;
437 return super.saveState(context);
438 }
439
440
441 }