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.AbstractUIPanel;
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 UIPanel
47 extends AbstractUIPanel implements SupportsMarkup {
48
49 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Panel";
50
51 public static final String COMPONENT_FAMILY = "javax.faces.Panel";
52
53 private org.apache.myfaces.tobago.context.Markup currentMarkup;
54
55 enum PropertyKeys {
56 markup,
57 marginLeft,
58 minimumHeight,
59 borderLeft,
60 tip,
61 height,
62 minimumWidth,
63 overflowX,
64 rowSpan,
65 overflowY,
66 left,
67 columnSpan,
68 borderRight,
69 paddingBottom,
70 maximumHeight,
71 top,
72 currentWidth,
73 paddingTop,
74 marginTop,
75 marginRight,
76 width,
77 preferredHeight,
78 currentHeight,
79 display,
80 borderBottom,
81 maximumWidth,
82 paddingLeft,
83 paddingRight,
84 preferredWidth,
85 marginBottom,
86 verticalIndex,
87 borderTop,
88 horizontalIndex,
89 }
90
91 public String getFamily() {
92 return COMPONENT_FAMILY;
93 }
94
95
96 public org.apache.myfaces.tobago.context.Markup getMarkup() {
97 Object object = getStateHelper().eval(PropertyKeys.markup);
98 if (object != null) {
99 return Markup.valueOf(object);
100 }
101 return null;
102 }
103
104 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
105 getStateHelper().put(PropertyKeys.markup, markup);
106 }
107
108 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
109 Object object = getStateHelper().eval(PropertyKeys.marginLeft);
110 if (object != null) {
111 return Measure.valueOf(object);
112 }
113 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
114 }
115
116 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
117 getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
118 }
119
120 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
121 Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
122 if (object != null) {
123 return Measure.valueOf(object);
124 }
125 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
126 }
127
128 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
129 getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
130 }
131
132
133
134
135
136 public org.apache.myfaces.tobago.layout.Measure getBorderLeft() {
137 Object object = getStateHelper().eval(PropertyKeys.borderLeft);
138 if (object != null) {
139 return Measure.valueOf(object);
140 }
141 return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
142 getRenderer(getFacesContext())).getBorderLeft(getFacesContext(), this);
143 }
144
145 public void setBorderLeft(org.apache.myfaces.tobago.layout.Measure borderLeft) {
146 getStateHelper().put(PropertyKeys.borderLeft, borderLeft);
147 }
148
149
150
151
152
153 public java.lang.String getTip() {
154 return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
155 }
156
157 public void setTip(java.lang.String tip) {
158 getStateHelper().put(PropertyKeys.tip, tip);
159 }
160
161
162
163
164
165 public org.apache.myfaces.tobago.layout.Measure getHeight() {
166 Object object = getStateHelper().eval(PropertyKeys.height);
167 if (object != null) {
168 return Measure.valueOf(object);
169 }
170 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
171 }
172
173 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
174 getStateHelper().put(PropertyKeys.height, height);
175 }
176
177 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
178 Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
179 if (object != null) {
180 return Measure.valueOf(object);
181 }
182 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
183 }
184
185 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
186 getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
187 }
188
189
190
191
192
193 public boolean isOverflowX() {
194 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.overflowX);
195 if (bool != null) {
196 return bool;
197 }
198 return false;
199 }
200
201 public void setOverflowX(boolean overflowX) {
202 getStateHelper().put(PropertyKeys.overflowX, overflowX);
203 }
204
205 public java.lang.Integer getRowSpan() {
206 Number value = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
207 if (value != null) {
208 return value.intValue();
209 }
210 return 1;
211 }
212
213 public void setRowSpan(java.lang.Integer rowSpan) {
214 getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
215 }
216
217
218
219
220
221 public boolean isOverflowY() {
222 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.overflowY);
223 if (bool != null) {
224 return bool;
225 }
226 return false;
227 }
228
229 public void setOverflowY(boolean overflowY) {
230 getStateHelper().put(PropertyKeys.overflowY, overflowY);
231 }
232
233
234
235
236
237 public org.apache.myfaces.tobago.layout.Measure getLeft() {
238 Object object = getStateHelper().eval(PropertyKeys.left);
239 if (object != null) {
240 return Measure.valueOf(object);
241 }
242 return null;
243 }
244
245 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
246 getStateHelper().put(PropertyKeys.left, left);
247 }
248
249 public java.lang.Integer getColumnSpan() {
250 Number value = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
251 if (value != null) {
252 return value.intValue();
253 }
254 return 1;
255 }
256
257 public void setColumnSpan(java.lang.Integer columnSpan) {
258 getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
259 }
260
261
262
263
264
265 public org.apache.myfaces.tobago.layout.Measure getBorderRight() {
266 Object object = getStateHelper().eval(PropertyKeys.borderRight);
267 if (object != null) {
268 return Measure.valueOf(object);
269 }
270 return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
271 getRenderer(getFacesContext())).getBorderRight(getFacesContext(), this);
272 }
273
274 public void setBorderRight(org.apache.myfaces.tobago.layout.Measure borderRight) {
275 getStateHelper().put(PropertyKeys.borderRight, borderRight);
276 }
277
278
279
280
281
282 public org.apache.myfaces.tobago.layout.Measure getPaddingBottom() {
283 Object object = getStateHelper().eval(PropertyKeys.paddingBottom);
284 if (object != null) {
285 return Measure.valueOf(object);
286 }
287 return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
288 getRenderer(getFacesContext())).getPaddingBottom(getFacesContext(), this);
289 }
290
291 public void setPaddingBottom(org.apache.myfaces.tobago.layout.Measure paddingBottom) {
292 getStateHelper().put(PropertyKeys.paddingBottom, paddingBottom);
293 }
294
295 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
296 Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
297 if (object != null) {
298 return Measure.valueOf(object);
299 }
300 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
301 }
302
303 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
304 getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
305 }
306
307
308
309
310
311 public org.apache.myfaces.tobago.layout.Measure getTop() {
312 Object object = getStateHelper().eval(PropertyKeys.top);
313 if (object != null) {
314 return Measure.valueOf(object);
315 }
316 return null;
317 }
318
319 public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
320 getStateHelper().put(PropertyKeys.top, top);
321 }
322
323
324
325
326
327 public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
328 Object object = getStateHelper().eval(PropertyKeys.currentWidth);
329 if (object != null) {
330 return Measure.valueOf(object);
331 }
332 return getWidth();
333 }
334
335 public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
336 getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
337 }
338
339
340
341
342
343 public org.apache.myfaces.tobago.layout.Measure getPaddingTop() {
344 Object object = getStateHelper().eval(PropertyKeys.paddingTop);
345 if (object != null) {
346 return Measure.valueOf(object);
347 }
348 return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
349 getRenderer(getFacesContext())).getPaddingTop(getFacesContext(), this);
350 }
351
352 public void setPaddingTop(org.apache.myfaces.tobago.layout.Measure paddingTop) {
353 getStateHelper().put(PropertyKeys.paddingTop, paddingTop);
354 }
355
356 public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
357 Object object = getStateHelper().eval(PropertyKeys.marginTop);
358 if (object != null) {
359 return Measure.valueOf(object);
360 }
361 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
362 }
363
364 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
365 getStateHelper().put(PropertyKeys.marginTop, marginTop);
366 }
367
368 public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
369 Object object = getStateHelper().eval(PropertyKeys.marginRight);
370 if (object != null) {
371 return Measure.valueOf(object);
372 }
373 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
374 }
375
376 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
377 getStateHelper().put(PropertyKeys.marginRight, marginRight);
378 }
379
380
381
382
383
384 public org.apache.myfaces.tobago.layout.Measure getWidth() {
385 Object object = getStateHelper().eval(PropertyKeys.width);
386 if (object != null) {
387 return Measure.valueOf(object);
388 }
389 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
390 }
391
392 public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
393 getStateHelper().put(PropertyKeys.width, width);
394 }
395
396 public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
397 Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
398 if (object != null) {
399 return Measure.valueOf(object);
400 }
401 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
402 }
403
404 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
405 getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
406 }
407
408
409
410
411
412 public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
413 Object object = getStateHelper().eval(PropertyKeys.currentHeight);
414 if (object != null) {
415 return Measure.valueOf(object);
416 }
417 return getHeight();
418 }
419
420 public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
421 getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
422 }
423
424
425
426
427
428 public org.apache.myfaces.tobago.layout.Display getDisplay() {
429 return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
430 }
431
432 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
433 getStateHelper().put(PropertyKeys.display, display);
434 }
435
436
437
438
439
440 public org.apache.myfaces.tobago.layout.Measure getBorderBottom() {
441 Object object = getStateHelper().eval(PropertyKeys.borderBottom);
442 if (object != null) {
443 return Measure.valueOf(object);
444 }
445 return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
446 getRenderer(getFacesContext())).getBorderBottom(getFacesContext(), this);
447 }
448
449 public void setBorderBottom(org.apache.myfaces.tobago.layout.Measure borderBottom) {
450 getStateHelper().put(PropertyKeys.borderBottom, borderBottom);
451 }
452
453 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
454 Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
455 if (object != null) {
456 return Measure.valueOf(object);
457 }
458 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
459 }
460
461 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
462 getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
463 }
464
465
466
467
468
469 public org.apache.myfaces.tobago.layout.Measure getPaddingLeft() {
470 Object object = getStateHelper().eval(PropertyKeys.paddingLeft);
471 if (object != null) {
472 return Measure.valueOf(object);
473 }
474 return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
475 getRenderer(getFacesContext())).getPaddingLeft(getFacesContext(), this);
476 }
477
478 public void setPaddingLeft(org.apache.myfaces.tobago.layout.Measure paddingLeft) {
479 getStateHelper().put(PropertyKeys.paddingLeft, paddingLeft);
480 }
481
482
483
484
485
486 public org.apache.myfaces.tobago.layout.Measure getPaddingRight() {
487 Object object = getStateHelper().eval(PropertyKeys.paddingRight);
488 if (object != null) {
489 return Measure.valueOf(object);
490 }
491 return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
492 getRenderer(getFacesContext())).getPaddingRight(getFacesContext(), this);
493 }
494
495 public void setPaddingRight(org.apache.myfaces.tobago.layout.Measure paddingRight) {
496 getStateHelper().put(PropertyKeys.paddingRight, paddingRight);
497 }
498
499 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
500 Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
501 if (object != null) {
502 return Measure.valueOf(object);
503 }
504 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
505 }
506
507 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
508 getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
509 }
510
511 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
512 Object object = getStateHelper().eval(PropertyKeys.marginBottom);
513 if (object != null) {
514 return Measure.valueOf(object);
515 }
516 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
517 }
518
519 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
520 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
521 }
522
523
524
525
526
527 public java.lang.Integer getVerticalIndex() {
528 Number value = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
529 if (value != null) {
530 return value.intValue();
531 }
532 return null;
533 }
534
535 public void setVerticalIndex(java.lang.Integer verticalIndex) {
536 getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
537 }
538
539
540
541
542
543 public org.apache.myfaces.tobago.layout.Measure getBorderTop() {
544 Object object = getStateHelper().eval(PropertyKeys.borderTop);
545 if (object != null) {
546 return Measure.valueOf(object);
547 }
548 return ((org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer)
549 getRenderer(getFacesContext())).getBorderTop(getFacesContext(), this);
550 }
551
552 public void setBorderTop(org.apache.myfaces.tobago.layout.Measure borderTop) {
553 getStateHelper().put(PropertyKeys.borderTop, borderTop);
554 }
555
556 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
557 if (currentMarkup != null) {
558 return currentMarkup;
559 }
560 return null;
561 }
562
563 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
564 this.currentMarkup = currentMarkup;
565 }
566
567
568
569
570
571 public java.lang.Integer getHorizontalIndex() {
572 Number value = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
573 if (value != null) {
574 return value.intValue();
575 }
576 return null;
577 }
578
579 public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
580 getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
581 }
582
583 public Object saveState(FacesContext context) {
584 currentMarkup = null;
585 return super.saveState(context);
586 }
587
588
589 }