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