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.renderkit.css;
21
22 import org.apache.myfaces.tobago.component.UIStyle;
23 import org.apache.myfaces.tobago.layout.Display;
24 import org.apache.myfaces.tobago.layout.Measure;
25 import org.apache.myfaces.tobago.layout.Overflow;
26 import org.apache.myfaces.tobago.layout.Position;
27 import org.apache.myfaces.tobago.layout.TextAlign;
28
29 import javax.el.ELContext;
30 import javax.el.ValueExpression;
31 import javax.faces.context.FacesContext;
32 import java.io.Serializable;
33
34
35
36
37
38
39 @Deprecated
40 public class Style implements Serializable {
41
42 private static final long serialVersionUID = 6L;
43
44 private Measure width;
45 private ValueExpression widthVE;
46 private Measure height;
47 private ValueExpression heightVE;
48
49 private Measure minWidth;
50 private ValueExpression minWidthVE;
51 private Measure minHeight;
52 private ValueExpression minHeightVE;
53 private Measure maxWidth;
54 private ValueExpression maxWidthVE;
55 private Measure maxHeight;
56 private ValueExpression maxHeightVE;
57
58 private Measure left;
59 private ValueExpression leftVE;
60 private Measure right;
61 private ValueExpression rightVE;
62 private Measure top;
63 private ValueExpression topVE;
64 private Measure bottom;
65 private ValueExpression bottomVE;
66
67 private Measure paddingLeft;
68 private ValueExpression paddingLeftVE;
69 private Measure paddingRight;
70 private ValueExpression paddingRightVE;
71 private Measure paddingTop;
72 private ValueExpression paddingTopVE;
73 private Measure paddingBottom;
74 private ValueExpression paddingBottomVE;
75
76 private Measure marginLeft;
77 private ValueExpression marginLeftVE;
78 private Measure marginRight;
79 private ValueExpression marginRightVE;
80 private Measure marginTop;
81 private ValueExpression marginTopVE;
82 private Measure marginBottom;
83 private ValueExpression marginBottomVE;
84
85 private Overflow overflowX;
86 private ValueExpression overflowXVE;
87 private Overflow overflowY;
88 private ValueExpression overflowYVE;
89 private Display display;
90 private ValueExpression displayVE;
91 private Position position;
92 private ValueExpression positionVE;
93
94
95 private String backgroundImage;
96
97 private ValueExpression backgroundImageVE;
98
99 private String backgroundPosition;
100
101 private ValueExpression backgroundPositionVE;
102
103 private Integer zIndex;
104
105 private ValueExpression zIndexVE;
106 private TextAlign textAlign;
107 private ValueExpression textAlignVE;
108
109 private Boolean empty;
110
111 public Style() {
112 }
113
114
115
116
117 @Deprecated
118 public Style(final UIStyle style) {
119
120 width = style.getWidth();
121 height = style.getHeight();
122
123 minWidth = style.getMinWidth();
124 minHeight = style.getMinHeight();
125 maxWidth = style.getMaxWidth();
126 maxHeight = style.getMaxHeight();
127
128 left = style.getLeft();
129 right = style.getRight();
130 top = style.getTop();
131 bottom = style.getBottom();
132
133 paddingLeft = style.getPaddingLeft();
134 paddingRight = style.getPaddingRight();
135 paddingTop = style.getPaddingTop();
136 paddingBottom = style.getPaddingBottom();
137
138 marginLeft = style.getMarginLeft();
139 marginRight = style.getMarginRight();
140 marginTop = style.getMarginTop();
141 marginBottom = style.getMarginBottom();
142
143 overflowX = style.getOverflowX();
144 overflowY = style.getOverflowY();
145 display = style.getDisplay();
146 position = style.getPosition();
147
148
149
150
151 textAlign = style.getTextAlign();
152
153 checkEmptiness();
154 }
155
156
157
158
159
160
161 public boolean needsToBeEscaped() {
162 return backgroundImage != null;
163 }
164
165 public boolean isEmpty() {
166 if (empty == null) {
167 checkEmptiness();
168 }
169 return empty;
170 }
171
172 public void checkEmptiness() {
173 empty
174 = width == null
175 && height == null
176
177 && minWidth == null
178 && minHeight == null
179 && maxWidth == null
180 && maxHeight == null
181
182 && left == null
183 && right == null
184 && top == null
185 && bottom == null
186
187 && marginLeft == null
188 && marginRight == null
189 && marginTop == null
190 && marginBottom == null
191
192 && paddingLeft == null
193 && paddingRight == null
194 && paddingTop == null
195 && paddingBottom == null
196
197 && display == null
198 && position == null
199 && overflowX == null
200 && overflowY == null
201
202 && backgroundImage == null
203 && backgroundPosition == null
204 && zIndex == null
205 && textAlign == null;
206 }
207
208 public String encode() {
209 final FacesContext facesContext = FacesContext.getCurrentInstance();
210 final ELContext elContext = facesContext.getELContext();
211 final StringBuilder buf = new StringBuilder();
212
213 if (widthVE != null) {
214 buf.append("width:");
215 buf.append(Measure.valueOf(widthVE.getValue(elContext)).serialize());
216 buf.append(';');
217 } else if (width != null) {
218 buf.append("width:");
219 buf.append(width.serialize());
220 buf.append(';');
221 }
222 if (height != null) {
223 buf.append("height:");
224 buf.append(height.serialize());
225 buf.append(';');
226 }
227 if (minWidth != null) {
228 buf.append("min-width:");
229 buf.append(minWidth.serialize());
230 buf.append(';');
231 }
232 if (minHeight != null) {
233 buf.append("min-height:");
234 buf.append(minHeight.serialize());
235 buf.append(';');
236 }
237 if (maxWidth != null) {
238 buf.append("max-width:");
239 buf.append(maxWidth.serialize());
240 buf.append(';');
241 }
242 if (maxHeight != null) {
243 buf.append("max-height:");
244 buf.append(maxHeight.serialize());
245 buf.append(';');
246 }
247 if (left != null) {
248 buf.append("left:");
249 buf.append(left.serialize());
250 buf.append(';');
251 }
252 if (right != null) {
253 buf.append("right:");
254 buf.append(right.serialize());
255 buf.append(';');
256 }
257 if (top != null) {
258 buf.append("top:");
259 buf.append(top.serialize());
260 buf.append(';');
261 }
262 if (bottom != null) {
263 buf.append("bottom:");
264 buf.append(bottom.serialize());
265 buf.append(';');
266 }
267 if (paddingLeft != null) {
268 buf.append("padding-left:");
269 buf.append(paddingLeft.serialize());
270 buf.append(';');
271 }
272 if (paddingRight != null) {
273 buf.append("padding-right:");
274 buf.append(paddingRight.serialize());
275 buf.append(';');
276 }
277 if (paddingTop != null) {
278 buf.append("padding-top:");
279 buf.append(paddingTop.serialize());
280 buf.append(';');
281 }
282 if (paddingBottom != null) {
283 buf.append("padding-bottom:");
284 buf.append(paddingBottom.serialize());
285 buf.append(';');
286 }
287 if (marginLeft != null) {
288 buf.append("margin-left:");
289 buf.append(marginLeft.serialize());
290 buf.append(';');
291 }
292 if (marginRight != null) {
293 buf.append("margin-right:");
294 buf.append(marginRight.serialize());
295 buf.append(';');
296 }
297 if (marginTop != null) {
298 buf.append("margin-top:");
299 buf.append(marginTop.serialize());
300 buf.append(';');
301 }
302 if (marginBottom != null) {
303 buf.append("margin-bottom:");
304 buf.append(marginBottom.serialize());
305 buf.append(';');
306 }
307 if (overflowX != null) {
308 buf.append("overflow-x:");
309 buf.append(overflowX.name());
310 buf.append(';');
311 }
312 if (overflowY != null) {
313 buf.append("overflow-y:");
314 buf.append(overflowY.name());
315 buf.append(';');
316 }
317 if (display != null) {
318 buf.append("display:");
319 buf.append(display.name());
320 buf.append(';');
321 }
322 if (position != null) {
323 buf.append("position:");
324 buf.append(position.name());
325 buf.append(';');
326 }
327 if (backgroundImage != null) {
328 buf.append("background-image:");
329 buf.append(backgroundImage);
330 buf.append(';');
331 }
332 if (backgroundPosition != null) {
333 buf.append("background-position:");
334 buf.append(backgroundPosition);
335 buf.append(';');
336 }
337 if (zIndex != null) {
338 buf.append("z-index:");
339 buf.append(zIndex);
340 buf.append(';');
341 }
342 if (textAlign != null) {
343 buf.append("text-align:");
344 buf.append(textAlign.name());
345 buf.append(';');
346 }
347
348 return buf.toString();
349 }
350
351 public String encodeJson() {
352 final StringBuilder buf = new StringBuilder("{");
353
354 final Measure widthValue = getWidth();
355 if (widthValue != null) {
356 buf.append("\"width\":\"");
357 buf.append(widthValue.serialize());
358 buf.append("\",");
359 }
360 final Measure heightValue = getHeight();
361 if (heightValue != null) {
362 buf.append("\"height\":\"");
363 buf.append(heightValue.serialize());
364 buf.append("\",");
365 }
366 final Measure minWidthValue = getMinWidth();
367 if (minWidthValue != null) {
368 buf.append("\"minWidth\":\"");
369 buf.append(minWidthValue.serialize());
370 buf.append("\",");
371 }
372 final Measure minHeightValue = getMinHeight();
373 if (minHeightValue != null) {
374 buf.append("\"minHeight\":\"");
375 buf.append(minHeightValue.serialize());
376 buf.append("\",");
377 }
378 final Measure maxWidthValue = getMaxWidth();
379 if (maxWidthValue != null) {
380 buf.append("\"maxWidth\":\"");
381 buf.append(maxWidthValue.serialize());
382 buf.append("\",");
383 }
384 final Measure maxHeightValue = getMaxHeight();
385 if (maxHeightValue != null) {
386 buf.append("\"maxHeight\":\"");
387 buf.append(maxHeightValue.serialize());
388 buf.append("\",");
389 }
390 final Measure leftValue = getLeft();
391 if (leftValue != null) {
392 buf.append("\"left\":\"");
393 buf.append(leftValue.serialize());
394 buf.append("\",");
395 }
396 final Measure rightValue = getRight();
397 if (rightValue != null) {
398 buf.append("\"right\":\"");
399 buf.append(rightValue.serialize());
400 buf.append("\",");
401 }
402 final Measure topValue = getTop();
403 if (topValue != null) {
404 buf.append("\"top\":\"");
405 buf.append(topValue.serialize());
406 buf.append("\",");
407 }
408 final Measure bottomValue = getBottom();
409 if (bottomValue != null) {
410 buf.append("\"bottom\":\"");
411 buf.append(bottomValue.serialize());
412 buf.append("\",");
413 }
414 final Measure paddingLeftValue = getPaddingLeft();
415 if (paddingLeftValue != null) {
416 buf.append("\"paddingLeft\":\"");
417 buf.append(paddingLeftValue.serialize());
418 buf.append("\",");
419 }
420 final Measure paddingRightValue = getPaddingRight();
421 if (paddingRightValue != null) {
422 buf.append("\"paddingRight\":\"");
423 buf.append(paddingRightValue.serialize());
424 buf.append("\",");
425 }
426 final Measure paddingTopValue = getPaddingTop();
427 if (paddingTopValue != null) {
428 buf.append("\"paddingTop\":\"");
429 buf.append(paddingTopValue.serialize());
430 buf.append("\",");
431 }
432 final Measure paddingBottomValue = getPaddingBottom();
433 if (paddingBottomValue != null) {
434 buf.append("\"paddingBottom\":\"");
435 buf.append(paddingBottomValue.serialize());
436 buf.append("\",");
437 }
438 final Measure marginLeftValue = getMarginLeft();
439 if (marginLeftValue != null) {
440 buf.append("\"marginLeft\":\"");
441 buf.append(marginLeftValue.serialize());
442 buf.append("\",");
443 }
444 final Measure marginRightValue = getMarginRight();
445 if (marginRightValue != null) {
446 buf.append("\"marginRight\":\"");
447 buf.append(marginRightValue.serialize());
448 buf.append("\",");
449 }
450 final Measure marginTopValue = getMarginTop();
451 if (marginTopValue != null) {
452 buf.append("\"marginTop\":\"");
453 buf.append(marginTopValue.serialize());
454 buf.append("\",");
455 }
456 final Measure marginBottomValue = getMarginBottom();
457 if (marginBottomValue != null) {
458 buf.append("\"marginBottom\":\"");
459 buf.append(marginBottomValue.serialize());
460 buf.append("\",");
461 }
462 final Overflow overflowXValue = getOverflowX();
463 if (overflowXValue != null) {
464 buf.append("\"overflowX\":\"");
465 buf.append(overflowXValue.name());
466 buf.append("\",");
467 }
468 final Overflow overflowYValue = getOverflowY();
469 if (overflowYValue != null) {
470 buf.append("\"overflowY\":\"");
471 buf.append(overflowYValue.name());
472 buf.append("\",");
473 }
474 final Display displayValue = getDisplay();
475 if (displayValue != null) {
476 buf.append("\"display\":\"");
477 buf.append(displayValue.name());
478 buf.append("\",");
479 }
480 final Position positionValue = getPosition();
481 if (positionValue != null) {
482 buf.append("\"position\":\"");
483 buf.append(positionValue.name());
484 buf.append("\",");
485 }
486
487 final String backgroundImageValue = getBackgroundImage();
488 if (backgroundImageValue != null) {
489 buf.append("\"backgroundImage\":\"");
490 buf.append(backgroundImageValue);
491 buf.append("\",");
492 }
493
494 final String backgroundPositionValue = getBackgroundPosition();
495 if (backgroundPositionValue != null) {
496 buf.append("\"backgroundPosition\":\"");
497 buf.append(backgroundPositionValue);
498 buf.append("\",");
499 }
500
501 final Integer zIndexValue = getZIndex();
502 if (zIndexValue != null) {
503 buf.append("\"zIndex\":");
504 buf.append(zIndexValue);
505 buf.append(",");
506 }
507 final TextAlign textAlignValue = getTextAlign();
508 if (textAlignValue != null) {
509 buf.append("\"textAlign\":\"");
510 buf.append(textAlignValue.name());
511 buf.append("\",");
512 }
513
514 if (buf.length() > 1) {
515 buf.deleteCharAt(buf.length() - 1);
516 }
517
518 buf.append('}');
519 return buf.toString();
520 }
521
522 public Measure getWidth() {
523 if (widthVE != null) {
524 return Measure.valueOf(widthVE.getValue(FacesContext.getCurrentInstance().getELContext()));
525 } else if (width != null) {
526 return width;
527 } else {
528 return null;
529 }
530 }
531
532 public void setWidth(final Measure width) {
533 empty = null;
534 this.width = width;
535 }
536
537 public void setWidth(final ValueExpression width) {
538 empty = null;
539 this.widthVE = width;
540 }
541
542 public Measure getHeight() {
543 if (heightVE != null) {
544 return Measure.valueOf(heightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
545 } else if (height != null) {
546 return height;
547 } else {
548 return null;
549 }
550 }
551
552 public void setHeight(final Measure height) {
553 empty = null;
554 this.height = height;
555 }
556
557 public void setHeight(final ValueExpression height) {
558 empty = null;
559 this.heightVE = height;
560 }
561
562 public Measure getMinWidth() {
563 if (minWidthVE != null) {
564 return Measure.valueOf(minWidthVE.getValue(FacesContext.getCurrentInstance().getELContext()));
565 } else if (minWidth != null) {
566 return minWidth;
567 } else {
568 return null;
569 }
570 }
571
572 public void setMinWidth(final Measure minWidth) {
573 empty = null;
574 this.minWidth = minWidth;
575 }
576
577 public void setMinWidth(final ValueExpression minWidth) {
578 empty = null;
579 this.minWidthVE = minWidth;
580 }
581
582 public Measure getMinHeight() {
583 if (minHeightVE != null) {
584 return Measure.valueOf(minHeightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
585 } else if (minHeight != null) {
586 return minHeight;
587 } else {
588 return null;
589 }
590 }
591
592 public void setMinHeight(final Measure minHeight) {
593 empty = null;
594 this.minHeight = minHeight;
595 }
596
597 public void setMinHeight(final ValueExpression minHeight) {
598 empty = null;
599 this.minHeightVE = minHeight;
600 }
601
602 public Measure getMaxWidth() {
603 if (maxWidthVE != null) {
604 return Measure.valueOf(maxWidthVE.getValue(FacesContext.getCurrentInstance().getELContext()));
605 } else if (maxWidth != null) {
606 return maxWidth;
607 } else {
608 return null;
609 }
610 }
611
612 public void setMaxWidth(final Measure maxWidth) {
613 empty = null;
614 this.maxWidth = maxWidth;
615 }
616
617 public void setMaxWidth(final ValueExpression maxWidth) {
618 empty = null;
619 this.maxWidthVE = maxWidth;
620 }
621
622 public Measure getMaxHeight() {
623 if (maxHeightVE != null) {
624 return Measure.valueOf(maxHeightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
625 } else if (maxHeight != null) {
626 return maxHeight;
627 } else {
628 return null;
629 }
630 }
631
632 public void setMaxHeight(final Measure maxHeight) {
633 empty = null;
634 this.maxHeight = maxHeight;
635 }
636
637 public void setMaxHeight(final ValueExpression maxHeight) {
638 empty = null;
639 this.maxHeightVE = maxHeight;
640 }
641
642 public Measure getLeft() {
643 if (leftVE != null) {
644 return Measure.valueOf(leftVE.getValue(FacesContext.getCurrentInstance().getELContext()));
645 } else if (left != null) {
646 return left;
647 } else {
648 return null;
649 }
650 }
651
652 public void setLeft(final Measure left) {
653 empty = null;
654 this.left = left;
655 }
656
657 public void setLeft(final ValueExpression left) {
658 empty = null;
659 this.leftVE = left;
660 }
661
662 public Measure getRight() {
663 if (rightVE != null) {
664 return Measure.valueOf(rightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
665 } else if (right != null) {
666 return right;
667 } else {
668 return null;
669 }
670 }
671
672 public void setRight(final Measure right) {
673 empty = null;
674 this.right = right;
675 }
676
677 public void setRight(final ValueExpression right) {
678 empty = null;
679 this.rightVE = right;
680 }
681
682 public Measure getTop() {
683 if (topVE != null) {
684 return Measure.valueOf(topVE.getValue(FacesContext.getCurrentInstance().getELContext()));
685 } else if (top != null) {
686 return top;
687 } else {
688 return null;
689 }
690 }
691
692 public void setTop(final Measure top) {
693 empty = null;
694 this.top = top;
695 }
696
697 public void setTop(final ValueExpression top) {
698 empty = null;
699 this.topVE = top;
700 }
701
702 public Measure getBottom() {
703 if (bottomVE != null) {
704 return Measure.valueOf(bottomVE.getValue(FacesContext.getCurrentInstance().getELContext()));
705 } else if (bottom != null) {
706 return bottom;
707 } else {
708 return null;
709 }
710 }
711
712 public void setBottom(final Measure bottom) {
713 empty = null;
714 this.bottom = bottom;
715 }
716
717 public void setBottom(final ValueExpression bottom) {
718 empty = null;
719 this.bottomVE = bottom;
720 }
721
722 public Measure getPaddingLeft() {
723 if (paddingLeftVE != null) {
724 return Measure.valueOf(paddingLeftVE.getValue(FacesContext.getCurrentInstance().getELContext()));
725 } else if (paddingLeft != null) {
726 return paddingLeft;
727 } else {
728 return null;
729 }
730 }
731
732 public void setPaddingLeft(final Measure paddingLeft) {
733 empty = null;
734 this.paddingLeft = paddingLeft;
735 }
736
737 public void setPaddingLeft(final ValueExpression paddingLeft) {
738 empty = null;
739 this.paddingLeftVE = paddingLeft;
740 }
741
742 public Measure getPaddingRight() {
743 if (paddingRightVE != null) {
744 return Measure.valueOf(paddingRightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
745 } else if (paddingRight != null) {
746 return paddingRight;
747 } else {
748 return null;
749 }
750 }
751
752 public void setPaddingRight(final Measure paddingRight) {
753 empty = null;
754 this.paddingRight = paddingRight;
755 }
756
757 public void setPaddingRight(final ValueExpression paddingRight) {
758 empty = null;
759 this.paddingRightVE = paddingRight;
760 }
761
762 public Measure getPaddingTop() {
763 if (paddingTopVE != null) {
764 return Measure.valueOf(paddingTopVE.getValue(FacesContext.getCurrentInstance().getELContext()));
765 } else if (paddingTop != null) {
766 return paddingTop;
767 } else {
768 return null;
769 }
770 }
771
772 public void setPaddingTop(final Measure paddingTop) {
773 empty = null;
774 this.paddingTop = paddingTop;
775 }
776
777 public void setPaddingTop(final ValueExpression paddingTop) {
778 empty = null;
779 this.paddingTopVE = paddingTop;
780 }
781
782 public Measure getPaddingBottom() {
783 if (paddingBottomVE != null) {
784 return Measure.valueOf(paddingBottomVE.getValue(FacesContext.getCurrentInstance().getELContext()));
785 } else if (paddingBottom != null) {
786 return paddingBottom;
787 } else {
788 return null;
789 }
790 }
791
792 public void setPaddingBottom(final Measure paddingBottom) {
793 empty = null;
794 this.paddingBottom = paddingBottom;
795 }
796
797 public void setPaddingBottom(final ValueExpression paddingBottom) {
798 empty = null;
799 this.paddingBottomVE = paddingBottom;
800 }
801
802 public Measure getMarginLeft() {
803 if (marginLeftVE != null) {
804 return Measure.valueOf(marginLeftVE.getValue(FacesContext.getCurrentInstance().getELContext()));
805 } else if (marginLeft != null) {
806 return marginLeft;
807 } else {
808 return null;
809 }
810 }
811
812 public void setMarginLeft(final Measure marginLeft) {
813 empty = null;
814 this.marginLeft = marginLeft;
815 }
816
817 public void setMarginLeft(final ValueExpression marginLeft) {
818 empty = null;
819 this.marginLeftVE = marginLeft;
820 }
821
822 public Measure getMarginRight() {
823 if (marginRightVE != null) {
824 return Measure.valueOf(marginRightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
825 } else if (marginRight != null) {
826 return marginRight;
827 } else {
828 return null;
829 }
830 }
831
832 public void setMarginRight(final Measure marginRight) {
833 empty = null;
834 this.marginRight = marginRight;
835 }
836
837 public void setMarginRight(final ValueExpression marginRight) {
838 empty = null;
839 this.marginRightVE = marginRight;
840 }
841
842 public Measure getMarginTop() {
843 if (marginTopVE != null) {
844 return Measure.valueOf(marginTopVE.getValue(FacesContext.getCurrentInstance().getELContext()));
845 } else if (marginTop != null) {
846 return marginTop;
847 } else {
848 return null;
849 }
850 }
851
852 public void setMarginTop(final Measure marginTop) {
853 empty = null;
854 this.marginTop = marginTop;
855 }
856
857 public void setMarginTop(final ValueExpression marginTop) {
858 empty = null;
859 this.marginTopVE = marginTop;
860 }
861
862 public Measure getMarginBottom() {
863 if (marginBottomVE != null) {
864 return Measure.valueOf(marginBottomVE.getValue(FacesContext.getCurrentInstance().getELContext()));
865 } else if (marginBottom != null) {
866 return marginBottom;
867 } else {
868 return null;
869 }
870 }
871
872 public void setMarginBottom(final Measure marginBottom) {
873 empty = null;
874 this.marginBottom = marginBottom;
875 }
876
877 public void setMarginBottom(final ValueExpression marginBottom) {
878 empty = null;
879 this.marginBottomVE = marginBottom;
880 }
881
882 public Overflow getOverflowX() {
883 if (overflowXVE != null) {
884 final Object value = overflowXVE.getValue(FacesContext.getCurrentInstance().getELContext());
885 if (value instanceof Overflow) {
886 return (Overflow) value;
887 } else if (value != null) {
888 return Overflow.valueOf(value.toString());
889 } else {
890 return null;
891 }
892 } else if (overflowX != null) {
893 return overflowX;
894 } else {
895 return null;
896 }
897 }
898
899 public void setOverflowX(final Overflow overflowX) {
900 empty = null;
901 this.overflowX = overflowX;
902 }
903
904 public void setOverflowX(final ValueExpression overflowX) {
905 empty = null;
906 this.overflowXVE = overflowX;
907 }
908
909 public Overflow getOverflowY() {
910 if (overflowYVE != null) {
911 final Object value = overflowYVE.getValue(FacesContext.getCurrentInstance().getELContext());
912 if (value instanceof Overflow) {
913 return (Overflow) value;
914 } else if (value != null) {
915 return Overflow.valueOf(value.toString());
916 } else {
917 return null;
918 }
919 } else if (overflowY != null) {
920 return overflowY;
921 } else {
922 return null;
923 }
924 }
925
926 public void setOverflowY(final Overflow overflowY) {
927 empty = null;
928 this.overflowY = overflowY;
929 }
930
931 public void setOverflowY(final ValueExpression overflowY) {
932 empty = null;
933 this.overflowYVE = overflowY;
934 }
935
936 public Display getDisplay() {
937 if (displayVE != null) {
938 final Object value = displayVE.getValue(FacesContext.getCurrentInstance().getELContext());
939 if (value instanceof Display) {
940 return (Display) value;
941 } else if (value != null) {
942 return Display.valueOf(value.toString());
943 } else {
944 return null;
945 }
946 } else if (display != null) {
947 return display;
948 } else {
949 return null;
950 }
951 }
952
953 public void setDisplay(final Display display) {
954 empty = null;
955 this.display = display;
956 }
957
958 public void setDisplay(final ValueExpression display) {
959 empty = null;
960 this.displayVE = display;
961 }
962
963 public Position getPosition() {
964 if (positionVE != null) {
965 final Object value = positionVE.getValue(FacesContext.getCurrentInstance().getELContext());
966 if (value instanceof Position) {
967 return (Position) value;
968 } else if (value != null) {
969 return Position.valueOf(value.toString());
970 } else {
971 return null;
972 }
973 } else if (position != null) {
974 return position;
975 } else {
976 return null;
977 }
978 }
979
980 public void setPosition(final Position position) {
981 empty = null;
982 this.position = position;
983 }
984
985 public void setPosition(final ValueExpression position) {
986 empty = null;
987 this.positionVE = position;
988 }
989
990
991 public String getBackgroundImage() {
992 if (backgroundImageVE != null) {
993 return (String) backgroundImageVE.getValue(FacesContext.getCurrentInstance().getELContext());
994 } else if (backgroundImage != null) {
995 return backgroundImage;
996 } else {
997 return null;
998 }
999 }
1000
1001
1002 public void setBackgroundImage(final String backgroundImage) {
1003 empty = null;
1004 this.backgroundImage = backgroundImage;
1005 }
1006
1007
1008 public void setBackgroundImage(final ValueExpression backgroundImage) {
1009 empty = null;
1010 this.backgroundImageVE = backgroundImage;
1011 }
1012
1013
1014 public String getBackgroundPosition() {
1015 if (backgroundPositionVE != null) {
1016 return (String) backgroundPositionVE.getValue(FacesContext.getCurrentInstance().getELContext());
1017 } else if (backgroundPosition != null) {
1018 return backgroundPosition;
1019 } else {
1020 return null;
1021 }
1022 }
1023
1024
1025 public void setBackgroundPosition(final String backgroundPosition) {
1026 empty = null;
1027 this.backgroundPosition = backgroundPosition;
1028 }
1029
1030
1031 public void setBackgroundPosition(final ValueExpression backgroundPosition) {
1032 empty = null;
1033 this.backgroundPositionVE = backgroundPosition;
1034 }
1035
1036
1037 public Integer getZIndex() {
1038 if (zIndexVE != null) {
1039 final Object value = zIndexVE.getValue(FacesContext.getCurrentInstance().getELContext());
1040 if (value instanceof Number) {
1041 return (Integer) value;
1042 } else if (value != null) {
1043 return Integer.parseInt(value.toString());
1044 } else {
1045 return null;
1046 }
1047 } else if (zIndex != null) {
1048 return zIndex;
1049 } else {
1050 return null;
1051 }
1052 }
1053
1054
1055 public void setZIndex(final Integer zIndexValue) {
1056 empty = null;
1057 this.zIndex = zIndexValue;
1058 }
1059
1060
1061 public void setZIndex(final ValueExpression zIndexValue) {
1062 empty = null;
1063 this.zIndexVE = zIndexValue;
1064 }
1065
1066 public TextAlign getTextAlign() {
1067 if (textAlignVE != null) {
1068 final Object value = textAlignVE.getValue(FacesContext.getCurrentInstance().getELContext());
1069 if (value instanceof TextAlign) {
1070 return (TextAlign) value;
1071 } else if (value != null) {
1072 return TextAlign.valueOf(value.toString());
1073 } else {
1074 return null;
1075 }
1076 } else if (textAlign != null) {
1077 return textAlign;
1078 } else {
1079 return null;
1080 }
1081 }
1082
1083 public void setTextAlign(final TextAlign textAlign) {
1084 empty = null;
1085 this.textAlign = textAlign;
1086 }
1087
1088 public void setTextAlign(final ValueExpression textAlign) {
1089 empty = null;
1090 this.textAlignVE = textAlign;
1091 }
1092
1093 @Override
1094 public String toString() {
1095 return encode();
1096 }
1097 }