1 28 package net.sf.jasperreports.engine.base; 29 30 import java.awt.Color ; 31 import java.io.Serializable ; 32 33 import net.sf.jasperreports.engine.JRAbstractObjectFactory; 34 import net.sf.jasperreports.engine.JRConditionalStyle; 35 import net.sf.jasperreports.engine.JRDefaultStyleProvider; 36 import net.sf.jasperreports.engine.JRStyle; 37 import net.sf.jasperreports.engine.util.JRStyleResolver; 38 39 43 public class JRBaseStyle implements JRStyle, Serializable 44 { 45 46 49 private static final long serialVersionUID = 10001; 50 51 52 55 protected JRDefaultStyleProvider defaultStyleProvider = null; 56 protected JRStyle parentStyle = null; 57 58 61 protected String name = null; 62 protected boolean isDefault = false; 63 64 protected Byte positionType = null; 65 protected Byte stretchType = null; 66 protected Byte mode = null; 67 protected Color forecolor = null; 68 protected Color backcolor = null; 69 70 protected Byte pen = null; 71 protected Byte fill = null; 72 73 protected Integer radius = null; 74 75 protected Byte scaleImage = null; 76 protected Byte horizontalAlignment = null; 77 protected Byte verticalAlignment = null; 78 79 protected Byte border = null; 80 protected Byte topBorder = null; 81 protected Byte leftBorder = null; 82 protected Byte bottomBorder = null; 83 protected Byte rightBorder = null; 84 protected Color borderColor = null; 85 protected Color topBorderColor = null; 86 protected Color leftBorderColor = null; 87 protected Color bottomBorderColor = null; 88 protected Color rightBorderColor = null; 89 protected Integer padding = null; 90 protected Integer topPadding = null; 91 protected Integer leftPadding = null; 92 protected Integer bottomPadding = null; 93 protected Integer rightPadding = null; 94 95 protected String fontName = null; 96 protected Boolean isBold = null; 97 protected Boolean isItalic = null; 98 protected Boolean isUnderline = null; 99 protected Boolean isStrikeThrough = null; 100 protected Integer fontSize = null; 101 protected String pdfFontName = null; 102 protected String pdfEncoding = null; 103 protected Boolean isPdfEmbedded = null; 104 105 protected Byte rotation = null; 106 protected Byte lineSpacing = null; 107 protected Boolean isStyledText = null; 108 109 protected String pattern = null; 110 protected Boolean isBlankWhenNull = null; 111 112 protected JRConditionalStyle[] conditionalStyles; 113 114 115 118 public JRBaseStyle() 119 { 120 } 121 122 125 public JRBaseStyle(String name) 126 { 127 this.name = name; 128 } 129 130 133 public JRBaseStyle(JRStyle style, JRAbstractObjectFactory factory) 134 { 135 name= style.getName(); 136 parentStyle = factory.getStyle(style.getStyle()); 137 isDefault = style.isDefault(); 138 139 mode = style.getOwnMode(); 140 forecolor = style.getOwnForecolor(); 141 backcolor = style.getOwnBackcolor(); 142 143 pen = style.getOwnPen(); 144 fill = style.getOwnFill(); 145 146 radius = style.getOwnRadius(); 147 148 scaleImage = style.getOwnScaleImage(); 149 horizontalAlignment = style.getOwnHorizontalAlignment(); 150 verticalAlignment = style.getOwnVerticalAlignment(); 151 152 border = style.getOwnBorder(); 153 topBorder = style.getOwnTopBorder(); 154 leftBorder = style.getOwnLeftBorder(); 155 bottomBorder = style.getOwnBottomBorder(); 156 rightBorder = style.getOwnRightBorder(); 157 borderColor = style.getOwnBorderColor(); 158 topBorderColor = style.getOwnTopBorderColor(); 159 leftBorderColor = style.getOwnLeftBorderColor(); 160 bottomBorderColor = style.getOwnBottomBorderColor(); 161 rightBorderColor = style.getOwnRightBorderColor(); 162 padding = style.getOwnPadding(); 163 topPadding = style.getOwnTopPadding(); 164 leftPadding = style.getOwnLeftPadding(); 165 bottomPadding = style.getOwnBottomPadding(); 166 rightPadding = style.getOwnRightPadding(); 167 168 rotation = style.getOwnRotation(); 169 lineSpacing = style.getOwnLineSpacing(); 170 isStyledText = style.isOwnStyledText(); 171 172 pattern = style.getOwnPattern(); 173 174 fontName = style.getOwnFontName(); 175 isBold = style.isOwnBold(); 176 isItalic = style.isOwnItalic(); 177 isUnderline = style.isOwnUnderline(); 178 isStrikeThrough = style.isOwnStrikeThrough(); 179 fontSize = style.getOwnFontSize(); 180 pdfFontName = style.getOwnPdfFontName(); 181 pdfEncoding = style.getOwnPdfEncoding(); 182 isPdfEmbedded = style.isOwnPdfEmbedded(); 183 184 JRConditionalStyle[] condStyles = style.getConditionalStyles(); 185 if (condStyles != null && condStyles.length > 0) { 186 this.conditionalStyles = new JRConditionalStyle[condStyles.length]; 187 for (int i = 0; i < condStyles.length; i++) { 188 this.conditionalStyles[i] = factory.getConditionalStyle(condStyles[i], this); 189 } 190 } 191 } 192 193 194 197 public JRDefaultStyleProvider getDefaultStyleProvider() 198 { 199 return defaultStyleProvider; 200 } 201 202 205 public JRStyle getStyle() 206 { 207 return parentStyle; 208 } 209 210 213 public String getName() 214 { 215 return name; 216 } 217 218 221 public boolean isDefault() 222 { 223 return isDefault; 224 } 225 226 229 public Color getForecolor() 230 { 231 return JRStyleResolver.getForecolor(this); 232 } 233 234 237 public Color getOwnForecolor() 238 { 239 return forecolor; 240 } 241 242 public Color getBackcolor() 243 { 244 return JRStyleResolver.getBackcolor(this); 245 } 246 247 public Color getOwnBackcolor() 248 { 249 return backcolor; 250 } 251 252 public Byte getPen() 253 { 254 return JRStyleResolver.getPen(this); 255 } 256 257 public Byte getOwnPen() 258 { 259 return pen; 260 } 261 262 public Byte getFill() 263 { 264 return JRStyleResolver.getFill(this); 265 } 266 267 public Byte getOwnFill() 268 { 269 return fill; 270 } 271 272 public Integer getRadius() 273 { 274 return JRStyleResolver.getRadius(this); 275 } 276 277 public Integer getOwnRadius() 278 { 279 return radius; 280 } 281 282 public Byte getScaleImage() 283 { 284 return JRStyleResolver.getScaleImage(this); 285 } 286 287 public Byte getOwnScaleImage() 288 { 289 return scaleImage; 290 } 291 292 public Byte getHorizontalAlignment() 293 { 294 return JRStyleResolver.getHorizontalAlignment(this); 295 } 296 297 public Byte getOwnHorizontalAlignment() 298 { 299 return horizontalAlignment; 300 } 301 302 public Byte getVerticalAlignment() 303 { 304 return JRStyleResolver.getVerticalAlignment(this); 305 } 306 307 public Byte getOwnVerticalAlignment() 308 { 309 return verticalAlignment; 310 } 311 312 public Byte getBorder() 313 { 314 return JRStyleResolver.getBorder(this); 315 } 316 317 public Byte getOwnBorder() 318 { 319 return border; 320 } 321 322 public Color getBorderColor() 323 { 324 return JRStyleResolver.getBorderColor(this); 325 } 326 327 public Color getOwnBorderColor() 328 { 329 return borderColor; 330 } 331 332 public Integer getPadding() 333 { 334 return JRStyleResolver.getPadding(this); 335 } 336 337 public Integer getOwnPadding() 338 { 339 return padding; 340 } 341 342 public Byte getTopBorder() 343 { 344 return JRStyleResolver.getTopBorder(this); 345 } 346 347 public Byte getOwnTopBorder() 348 { 349 return topBorder; 350 } 351 352 public Color getTopBorderColor() 353 { 354 return JRStyleResolver.getTopBorderColor(this); 355 } 356 357 public Color getOwnTopBorderColor() 358 { 359 return topBorderColor; 360 } 361 362 public Integer getTopPadding() 363 { 364 return JRStyleResolver.getTopPadding(this); 365 } 366 367 public Integer getOwnTopPadding() 368 { 369 return topPadding; 370 } 371 372 public Byte getLeftBorder() 373 { 374 return JRStyleResolver.getLeftBorder(this); 375 } 376 377 public Byte getOwnLeftBorder() 378 { 379 return leftBorder; 380 } 381 382 public Color getLeftBorderColor() 383 { 384 return JRStyleResolver.getLeftBorderColor(this); 385 } 386 387 public Color getOwnLeftBorderColor() 388 { 389 return leftBorderColor; 390 } 391 392 public Integer getLeftPadding() 393 { 394 return JRStyleResolver.getLeftPadding(this); 395 } 396 397 public Integer getOwnLeftPadding() 398 { 399 return leftPadding; 400 } 401 402 public Byte getBottomBorder() 403 { 404 return JRStyleResolver.getBottomBorder(this); 405 } 406 407 public Byte getOwnBottomBorder() 408 { 409 return bottomBorder; 410 } 411 412 public Color getBottomBorderColor() 413 { 414 return JRStyleResolver.getBottomBorderColor(this); 415 } 416 417 public Color getOwnBottomBorderColor() 418 { 419 return bottomBorderColor; 420 } 421 422 public Integer getBottomPadding() 423 { 424 return JRStyleResolver.getBottomPadding(this); 425 } 426 427 public Integer getOwnBottomPadding() 428 { 429 return bottomPadding; 430 } 431 432 public Byte getRightBorder() 433 { 434 return JRStyleResolver.getRightBorder(this); 435 } 436 437 public Byte getOwnRightBorder() 438 { 439 return rightBorder; 440 } 441 442 public Color getRightBorderColor() 443 { 444 return JRStyleResolver.getRightBorderColor(this); 445 } 446 447 public Color getOwnRightBorderColor() 448 { 449 return rightBorderColor; 450 } 451 452 public Integer getRightPadding() 453 { 454 return JRStyleResolver.getRightPadding(this); 455 } 456 457 public Integer getOwnRightPadding() 458 { 459 return rightPadding; 460 } 461 462 public Byte getRotation() 463 { 464 return JRStyleResolver.getRotation(this); 465 } 466 467 public Byte getOwnRotation() 468 { 469 return rotation; 470 } 471 472 public Byte getLineSpacing() 473 { 474 return JRStyleResolver.getLineSpacing(this); 475 } 476 477 public Byte getOwnLineSpacing() 478 { 479 return lineSpacing; 480 } 481 482 public Boolean isStyledText() 483 { 484 return JRStyleResolver.isStyledText(this); 485 } 486 487 public Boolean isOwnStyledText() 488 { 489 return isStyledText; 490 } 491 492 public Boolean isBlankWhenNull() 493 { 494 return JRStyleResolver.isBlankWhenNull(this); 495 } 496 497 public Boolean isOwnBlankWhenNull() 498 { 499 return isStyledText; 500 } 501 502 503 public String getFontName() 504 { 505 return JRStyleResolver.getFontName(this); 506 } 507 508 public String getOwnFontName() 509 { 510 return fontName; 511 } 512 513 public Boolean isBold() 514 { 515 return JRStyleResolver.isBold(this); 516 } 517 518 public Boolean isOwnBold() 519 { 520 return isBold; 521 } 522 523 public Boolean isItalic() 524 { 525 return JRStyleResolver.isItalic(this); 526 } 527 528 public Boolean isOwnItalic() 529 { 530 return isItalic; 531 } 532 533 public Boolean isUnderline() 534 { 535 return JRStyleResolver.isUnderline(this); 536 } 537 538 public Boolean isOwnUnderline() 539 { 540 return isUnderline; 541 } 542 543 public Boolean isStrikeThrough() 544 { 545 return JRStyleResolver.isStrikeThrough(this); 546 } 547 548 public Boolean isOwnStrikeThrough() 549 { 550 return isStrikeThrough; 551 } 552 553 public Integer getFontSize() 554 { 555 return JRStyleResolver.getFontSize(this); 556 } 557 558 public Integer getOwnFontSize() 559 { 560 return fontSize; 561 } 562 563 public String getPdfFontName() 564 { 565 return JRStyleResolver.getPdfFontName(this); 566 } 567 568 public String getOwnPdfFontName() 569 { 570 return pdfFontName; 571 } 572 573 public String getPdfEncoding() 574 { 575 return JRStyleResolver.getPdfEncoding(this); 576 } 577 578 public String getOwnPdfEncoding() 579 { 580 return pdfEncoding; 581 } 582 583 public Boolean isPdfEmbedded() 584 { 585 return JRStyleResolver.isPdfEmbedded(this); 586 } 587 588 public Boolean isOwnPdfEmbedded() 589 { 590 return isPdfEmbedded; 591 } 592 593 public String getPattern() 594 { 595 return JRStyleResolver.getPattern(this); 596 } 597 598 public String getOwnPattern() 599 { 600 return pattern; 601 } 602 603 public Byte getMode() 604 { 605 return JRStyleResolver.getMode(this); 606 } 607 608 public Byte getOwnMode() 609 { 610 return mode; 611 } 612 613 616 public void setForecolor(Color forecolor) 617 { 618 this.forecolor = forecolor; 619 } 620 621 624 public void setBackcolor(Color backcolor) 625 { 626 this.backcolor = backcolor; 627 } 628 629 632 public void setMode(byte mode) 633 { 634 setMode(new Byte (mode)); 635 } 636 637 640 public void setMode(Byte mode) 641 { 642 this.mode = mode; 643 } 644 645 648 public void setPen(byte pen) 649 { 650 setPen(new Byte (pen)); 651 } 652 653 656 public void setPen(Byte pen) 657 { 658 this.pen = pen; 659 } 660 661 664 public void setFill(byte fill) 665 { 666 setFill(new Byte (fill)); 667 } 668 669 672 public void setFill(Byte fill) 673 { 674 this.fill = fill; 675 } 676 677 680 public void setRadius(int radius) 681 { 682 setRadius(new Integer (radius)); 683 } 684 685 688 public void setRadius(Integer radius) 689 { 690 this.radius = radius; 691 } 692 693 696 public void setScaleImage(byte scaleImage) 697 { 698 setScaleImage(new Byte (scaleImage)); 699 } 700 701 704 public void setScaleImage(Byte scaleImage) 705 { 706 this.scaleImage = scaleImage; 707 } 708 709 712 public void setHorizontalAlignment(byte horizontalAlignment) 713 { 714 setHorizontalAlignment(new Byte (horizontalAlignment)); 715 } 716 717 720 public void setHorizontalAlignment(Byte horizontalAlignment) 721 { 722 this.horizontalAlignment = horizontalAlignment; 723 } 724 725 728 public void setVerticalAlignment(byte verticalAlignment) 729 { 730 setVerticalAlignment(new Byte (verticalAlignment)); 731 } 732 733 736 public void setVerticalAlignment(Byte verticalAlignment) 737 { 738 this.verticalAlignment = verticalAlignment; 739 } 740 741 744 public void setBorder(byte border) 745 { 746 setBorder(new Byte (border)); 747 } 748 749 752 public void setBorder(Byte border) 753 { 754 this.border = border; 755 } 756 757 760 public void setBorderColor(Color borderColor) 761 { 762 this.borderColor = borderColor; 763 } 764 765 768 public void setPadding(int padding) 769 { 770 setPadding(new Integer (padding)); 771 } 772 773 776 public void setPadding(Integer padding) 777 { 778 this.padding = padding; 779 } 780 781 784 public void setTopBorder(byte topBorder) 785 { 786 setTopBorder(new Byte (topBorder)); 787 } 788 789 792 public void setTopBorder(Byte topBorder) 793 { 794 this.topBorder = topBorder; 795 } 796 797 800 public void setTopBorderColor(Color topBorderColor) 801 { 802 this.topBorderColor = topBorderColor; 803 } 804 805 808 public void setTopPadding(int topPadding) 809 { 810 setTopPadding(new Integer (topPadding)); 811 } 812 813 816 public void setTopPadding(Integer topPadding) 817 { 818 this.topPadding = topPadding; 819 } 820 821 824 public void setLeftBorder(byte leftBorder) 825 { 826 setLeftBorder(new Byte (leftBorder)); 827 } 828 829 832 public void setLeftBorder(Byte leftBorder) 833 { 834 this.leftBorder = leftBorder; 835 } 836 837 840 public void setLeftBorderColor(Color leftBorderColor) 841 { 842 this.leftBorderColor = leftBorderColor; 843 } 844 845 848 public void setLeftPadding(int leftPadding) 849 { 850 setLeftPadding(new Integer (leftPadding)); 851 } 852 853 856 public void setLeftPadding(Integer leftPadding) 857 { 858 this.leftPadding = leftPadding; 859 } 860 861 864 public void setBottomBorder(byte bottomBorder) 865 { 866 setBottomBorder(new Byte (bottomBorder)); 867 } 868 869 872 public void setBottomBorder(Byte bottomBorder) 873 { 874 this.bottomBorder = bottomBorder; 875 } 876 877 880 public void setBottomBorderColor(Color bottomBorderColor) 881 { 882 this.bottomBorderColor = bottomBorderColor; 883 } 884 885 888 public void setBottomPadding(int bottomPadding) 889 { 890 setBottomPadding(new Integer (bottomPadding)); 891 } 892 893 896 public void setBottomPadding(Integer bottomPadding) 897 { 898 this.bottomPadding = bottomPadding; 899 } 900 901 904 public void setRightBorder(byte rightBorder) 905 { 906 setRightBorder(new Byte (rightBorder)); 907 } 908 909 912 public void setRightBorder(Byte rightBorder) 913 { 914 this.rightBorder = rightBorder; 915 } 916 917 920 public void setRightBorderColor(Color rightBorderColor) 921 { 922 this.rightBorderColor = rightBorderColor; 923 } 924 925 928 public void setRightPadding(int rightPadding) 929 { 930 setRightPadding(new Integer (rightPadding)); 931 } 932 933 936 public void setRightPadding(Integer rightPadding) 937 { 938 this.rightPadding = rightPadding; 939 } 940 941 944 public void setRotation(byte rotation) 945 { 946 setRotation(new Byte (rotation)); 947 } 948 949 952 public void setRotation(Byte rotation) 953 { 954 this.rotation = rotation; 955 } 956 957 960 public void setFontName(String fontName) 961 { 962 this.fontName = fontName; 963 } 964 965 968 public void setBold(boolean bold) 969 { 970 setBold(bold ? Boolean.TRUE : Boolean.FALSE); 971 } 972 973 976 public void setBold(Boolean bold) 977 { 978 this.isBold = bold; 979 } 980 981 984 public void setItalic(boolean italic) 985 { 986 setItalic(italic ? Boolean.TRUE : Boolean.FALSE); 987 } 988 989 992 public void setItalic(Boolean italic) 993 { 994 this.isItalic = italic; 995 } 996 997 1000 public void setPdfEmbedded(boolean pdfEmbedded) 1001 { 1002 setPdfEmbedded(pdfEmbedded ? Boolean.TRUE : Boolean.FALSE); 1003 } 1004 1005 1008 public void setPdfEmbedded(Boolean pdfEmbedded) 1009 { 1010 this.isPdfEmbedded = pdfEmbedded; 1011 } 1012 1013 1016 public void setStrikeThrough(boolean strikeThrough) 1017 { 1018 setStrikeThrough(strikeThrough ? Boolean.TRUE : Boolean.FALSE); 1019 } 1020 1021 1024 public void setStrikeThrough(Boolean strikeThrough) 1025 { 1026 this.isStrikeThrough = strikeThrough; 1027 } 1028 1029 1032 public void setStyledText(boolean styledText) 1033 { 1034 setStyledText(styledText ? Boolean.TRUE : Boolean.FALSE); 1035 } 1036 1037 1040 public void setStyledText(Boolean styledText) 1041 { 1042 this.isStyledText = styledText; 1043 } 1044 1045 1048 public void setBlankWhenNull(boolean isBlankWhenNull) 1049 { 1050 setBlankWhenNull(isBlankWhenNull ? Boolean.TRUE : Boolean.FALSE); 1051 } 1052 1053 1056 public void setBlankWhenNull(Boolean isBlankWhenNull) 1057 { 1058 this.isBlankWhenNull = isBlankWhenNull; 1059 } 1060 1061 1064 public void setUnderline(boolean underline) 1065 { 1066 setUnderline(underline ? Boolean.TRUE : Boolean.FALSE); 1067 } 1068 1069 1072 public void setUnderline(Boolean underline) 1073 { 1074 this.isUnderline = underline; 1075 } 1076 1077 1080 public void setLineSpacing(byte lineSpacing) 1081 { 1082 setLineSpacing(new Byte (lineSpacing)); 1083 } 1084 1085 1088 public void setLineSpacing(Byte lineSpacing) 1089 { 1090 this.lineSpacing = lineSpacing; 1091 } 1092 1093 1096 public void setPattern(String pattern) 1097 { 1098 this.pattern = pattern; 1099 } 1100 1101 1104 public void setPdfEncoding(String pdfEncoding) 1105 { 1106 this.pdfEncoding = pdfEncoding; 1107 } 1108 1109 1112 public void setPdfFontName(String pdfFontName) 1113 { 1114 this.pdfFontName = pdfFontName; 1115 } 1116 1117 1120 public void setFontSize(int fontSize) 1121 { 1122 setFontSize(new Integer (fontSize)); 1123 } 1124 1125 1128 public void setFontSize(Integer fontSize) 1129 { 1130 this.fontSize = fontSize; 1131 } 1132 1133 1136 public JRConditionalStyle[] getConditionalStyles() 1137 { 1138 return conditionalStyles; 1139 } 1140} 1141 | Popular Tags |