1 28 package net.sf.jasperreports.engine.design; 29 30 import java.awt.Color ; 31 import java.io.IOException ; 32 import java.io.ObjectInputStream ; 33 import java.util.ArrayList ; 34 import java.util.Iterator ; 35 import java.util.List ; 36 37 import net.sf.jasperreports.charts.design.JRDesignAreaPlot; 38 import net.sf.jasperreports.charts.design.JRDesignBar3DPlot; 39 import net.sf.jasperreports.charts.design.JRDesignBarPlot; 40 import net.sf.jasperreports.charts.design.JRDesignBubblePlot; 41 import net.sf.jasperreports.charts.design.JRDesignCandlestickPlot; 42 import net.sf.jasperreports.charts.design.JRDesignCategoryDataset; 43 import net.sf.jasperreports.charts.design.JRDesignHighLowDataset; 44 import net.sf.jasperreports.charts.design.JRDesignHighLowPlot; 45 import net.sf.jasperreports.charts.design.JRDesignLinePlot; 46 import net.sf.jasperreports.charts.design.JRDesignMeterPlot; 47 import net.sf.jasperreports.charts.design.JRDesignMultiAxisPlot; 48 import net.sf.jasperreports.charts.design.JRDesignPie3DPlot; 49 import net.sf.jasperreports.charts.design.JRDesignPieDataset; 50 import net.sf.jasperreports.charts.design.JRDesignPiePlot; 51 import net.sf.jasperreports.charts.design.JRDesignScatterPlot; 52 import net.sf.jasperreports.charts.design.JRDesignThermometerPlot; 53 import net.sf.jasperreports.charts.design.JRDesignTimePeriodDataset; 54 import net.sf.jasperreports.charts.design.JRDesignTimeSeriesDataset; 55 import net.sf.jasperreports.charts.design.JRDesignTimeSeriesPlot; 56 import net.sf.jasperreports.charts.design.JRDesignValueDataset; 57 import net.sf.jasperreports.charts.design.JRDesignXyDataset; 58 import net.sf.jasperreports.charts.design.JRDesignXyzDataset; 59 import net.sf.jasperreports.engine.JRAbstractObjectFactory; 60 import net.sf.jasperreports.engine.JRAnchor; 61 import net.sf.jasperreports.engine.JRBox; 62 import net.sf.jasperreports.engine.JRChart; 63 import net.sf.jasperreports.engine.JRChartDataset; 64 import net.sf.jasperreports.engine.JRChartPlot; 65 import net.sf.jasperreports.engine.JRChild; 66 import net.sf.jasperreports.engine.JRConstants; 67 import net.sf.jasperreports.engine.JRDefaultStyleProvider; 68 import net.sf.jasperreports.engine.JRExpression; 69 import net.sf.jasperreports.engine.JRExpressionCollector; 70 import net.sf.jasperreports.engine.JRFont; 71 import net.sf.jasperreports.engine.JRGroup; 72 import net.sf.jasperreports.engine.JRHyperlink; 73 import net.sf.jasperreports.engine.JRHyperlinkHelper; 74 import net.sf.jasperreports.engine.JRHyperlinkParameter; 75 import net.sf.jasperreports.engine.JRRuntimeException; 76 import net.sf.jasperreports.engine.util.JRStyleResolver; 77 import net.sf.jasperreports.engine.xml.JRXmlWriter; 78 79 80 84 public class JRDesignChart extends JRDesignElement implements JRChart 85 { 86 87 88 91 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 92 93 96 protected byte chartType = 0; 97 98 101 protected boolean isShowLegend = false; 102 protected byte evaluationTime = JRExpression.EVALUATION_TIME_NOW; 103 protected byte hyperlinkType = JRHyperlink.HYPERLINK_TYPE_NULL; 104 protected String linkType; 105 protected byte hyperlinkTarget = JRHyperlink.HYPERLINK_TARGET_SELF; 106 protected byte titlePosition = JRChart.TITLE_POSITION_TOP; 107 protected Color titleColor = Color.black; 108 protected Color subtitleColor = Color.black; 109 protected Color legendColor = null; 110 protected Color legendBackgroundColor = null; 111 112 115 protected JRFont titleFont = null; 116 protected JRFont subtitleFont = null; 117 protected JRFont legendFont = null; 118 119 protected String customizerClass; 120 121 124 protected JRGroup evaluationGroup = null; 125 protected JRExpression titleExpression = null; 126 protected JRExpression subtitleExpression = null; 127 protected JRExpression anchorNameExpression = null; 128 protected JRExpression hyperlinkReferenceExpression = null; 129 protected JRExpression hyperlinkAnchorExpression = null; 130 protected JRExpression hyperlinkPageExpression = null; 131 private JRExpression hyperlinkTooltipExpression; 132 private List hyperlinkParameters; 133 134 protected JRChartDataset dataset = null; 135 protected JRChartPlot plot = null; 136 137 140 protected Byte border; 141 protected Byte topBorder = null; 142 protected Byte leftBorder = null; 143 protected Byte bottomBorder = null; 144 protected Byte rightBorder = null; 145 protected Color borderColor = null; 146 protected Color topBorderColor = null; 147 protected Color leftBorderColor = null; 148 protected Color bottomBorderColor = null; 149 protected Color rightBorderColor = null; 150 protected Integer padding; 151 protected Integer topPadding = null; 152 protected Integer leftPadding = null; 153 protected Integer bottomPadding = null; 154 protected Integer rightPadding = null; 155 156 160 protected int bookmarkLevel = JRAnchor.NO_BOOKMARK; 161 162 163 166 public JRDesignChart(JRDefaultStyleProvider defaultStyleProvider, byte chartType) 167 { 168 super(defaultStyleProvider); 169 170 setChartType(chartType); 171 172 hyperlinkParameters = new ArrayList (); 173 } 174 175 176 179 public boolean isShowLegend() 180 { 181 return isShowLegend; 182 } 183 184 187 public void setShowLegend(boolean isShowLegend) 188 { 189 this.isShowLegend = isShowLegend; 190 } 191 192 195 public byte getEvaluationTime() 196 { 197 return evaluationTime; 198 } 199 200 203 public void setEvaluationTime(byte evaluationTime) 204 { 205 this.evaluationTime = evaluationTime; 206 } 207 208 211 public JRGroup getEvaluationGroup() 212 { 213 return evaluationGroup; 214 } 215 216 219 public void setEvaluationGroup(JRGroup group) 220 { 221 this.evaluationGroup = group; 222 } 223 224 227 public JRBox getBox() 228 { 229 return this; 230 } 231 232 235 public void setBox(JRBox box) 236 { 237 border = box.getOwnBorder(); 238 topBorder = box.getOwnTopBorder(); 239 leftBorder = box.getOwnLeftBorder(); 240 bottomBorder = box.getOwnBottomBorder(); 241 rightBorder = box.getOwnRightBorder(); 242 borderColor = box.getOwnBorderColor(); 243 topBorderColor = box.getOwnTopBorderColor(); 244 leftBorderColor = box.getOwnLeftBorderColor(); 245 bottomBorderColor = box.getOwnBottomBorderColor(); 246 rightBorderColor = box.getOwnRightBorderColor(); 247 padding = box.getOwnPadding(); 248 topPadding = box.getOwnTopPadding(); 249 leftPadding = box.getOwnLeftPadding(); 250 bottomPadding = box.getOwnBottomPadding(); 251 rightPadding = box.getOwnRightPadding(); 252 } 253 254 257 public JRFont getTitleFont() 258 { 259 return titleFont; 260 } 261 262 265 public void setTitleFont(JRFont font) 266 { 267 this.titleFont = font; 268 } 269 270 273 public byte getTitlePosition() 274 { 275 return titlePosition; 276 } 277 278 281 public void setTitlePosition(byte titlePosition) 282 { 283 this.titlePosition = titlePosition; 284 } 285 286 289 public Color getTitleColor() 290 { 291 return titleColor; 292 } 293 294 297 public void setTitleColor(Color titleColor) 298 { 299 this.titleColor = titleColor; 300 } 301 302 305 public JRFont getSubtitleFont() 306 { 307 return subtitleFont; 308 } 309 310 313 public void setSubtitleFont(JRFont font) 314 { 315 this.subtitleFont = font; 316 } 317 318 321 public Color getSubtitleColor() 322 { 323 return subtitleColor; 324 } 325 326 329 public void setSubtitleColor(Color subtitleColor) 330 { 331 this.subtitleColor = subtitleColor; 332 } 333 334 337 public Color getLegendColor() 338 { 339 return legendColor; 340 } 341 342 345 public void setLegendColor(Color legendColor) 346 { 347 this.legendColor = legendColor; 348 } 349 350 353 public Color getLegendBackgroundColor() 354 { 355 return legendBackgroundColor; 356 } 357 358 361 public void setLegendBackgroundColor(Color legendBackgroundColor) 362 { 363 this.legendBackgroundColor = legendBackgroundColor; 364 } 365 366 369 public JRFont getLegendFont() 370 { 371 return legendFont; 372 } 373 374 377 public void setLegendFont(JRFont legendFont) 378 { 379 this.legendFont = legendFont; 380 } 381 382 385 public byte getHyperlinkType() 386 { 387 return JRHyperlinkHelper.getHyperlinkType(this); 388 } 389 390 396 public void setHyperlinkType(byte hyperlinkType) 397 { 398 setLinkType(JRHyperlinkHelper.getLinkType(hyperlinkType)); 399 } 400 401 404 public byte getHyperlinkTarget() 405 { 406 return hyperlinkTarget; 407 } 408 409 412 public void setHyperlinkTarget(byte hyperlinkTarget) 413 { 414 this.hyperlinkTarget = hyperlinkTarget; 415 } 416 417 420 public JRExpression getTitleExpression() 421 { 422 return titleExpression; 423 } 424 425 428 public void setTitleExpression(JRExpression expression) 429 { 430 this.titleExpression = expression; 431 } 432 433 436 public JRExpression getSubtitleExpression() 437 { 438 return subtitleExpression; 439 } 440 441 444 public void setSubtitleExpression(JRExpression expression) 445 { 446 this.subtitleExpression = expression; 447 } 448 449 452 public JRExpression getAnchorNameExpression() 453 { 454 return anchorNameExpression; 455 } 456 457 460 public void setAnchorNameExpression(JRExpression anchorNameExpression) 461 { 462 this.anchorNameExpression = anchorNameExpression; 463 } 464 465 468 public JRExpression getHyperlinkReferenceExpression() 469 { 470 return hyperlinkReferenceExpression; 471 } 472 473 476 public void setHyperlinkReferenceExpression(JRExpression hyperlinkReferenceExpression) 477 { 478 this.hyperlinkReferenceExpression = hyperlinkReferenceExpression; 479 } 480 481 484 public JRExpression getHyperlinkAnchorExpression() 485 { 486 return hyperlinkAnchorExpression; 487 } 488 489 492 public void setHyperlinkAnchorExpression(JRExpression hyperlinkAnchorExpression) 493 { 494 this.hyperlinkAnchorExpression = hyperlinkAnchorExpression; 495 } 496 497 500 public JRExpression getHyperlinkPageExpression() 501 { 502 return hyperlinkPageExpression; 503 } 504 505 508 public void setHyperlinkPageExpression(JRExpression hyperlinkPageExpression) 509 { 510 this.hyperlinkPageExpression = hyperlinkPageExpression; 511 } 512 513 516 public JRChartDataset getDataset() 517 { 518 return dataset; 519 } 520 521 524 public JRChartPlot getPlot() 525 { 526 return plot; 527 } 528 529 530 public byte getChartType() 531 { 532 return chartType; 533 } 534 535 536 539 public void setChartType(byte chartType) 540 { 541 this.chartType = chartType; 542 543 switch(chartType) { 544 case CHART_TYPE_AREA: 545 dataset = new JRDesignCategoryDataset(dataset); 546 plot = new JRDesignAreaPlot(plot); 547 break; 548 case CHART_TYPE_BAR: 549 dataset = new JRDesignCategoryDataset(dataset); 550 plot = new JRDesignBarPlot(plot); 551 break; 552 case CHART_TYPE_BAR3D: 553 dataset = new JRDesignCategoryDataset(dataset); 554 plot = new JRDesignBar3DPlot(plot); 555 break; 556 case CHART_TYPE_BUBBLE: 557 dataset = new JRDesignXyzDataset(dataset); 558 plot = new JRDesignBubblePlot(plot); 559 break; 560 case CHART_TYPE_CANDLESTICK: 561 dataset = new JRDesignHighLowDataset(dataset); 562 plot = new JRDesignCandlestickPlot(plot); 563 break; 564 case CHART_TYPE_HIGHLOW: 565 dataset = new JRDesignHighLowDataset(dataset); 566 plot = new JRDesignHighLowPlot(plot); 567 break; 568 case CHART_TYPE_LINE: 569 dataset = new JRDesignCategoryDataset(dataset); 570 plot = new JRDesignLinePlot(plot); 571 break; 572 case CHART_TYPE_METER: 573 dataset = new JRDesignValueDataset(dataset); 574 plot = new JRDesignMeterPlot(plot); 575 break; 576 case CHART_TYPE_MULTI_AXIS: 577 plot = new JRDesignMultiAxisPlot(plot); 578 dataset = null; 579 break; 580 case CHART_TYPE_PIE: 581 dataset = new JRDesignPieDataset(dataset); 582 plot = new JRDesignPiePlot(plot); 583 break; 584 case CHART_TYPE_PIE3D: 585 dataset = new JRDesignPieDataset(dataset); 586 plot = new JRDesignPie3DPlot(plot); 587 break; 588 case CHART_TYPE_SCATTER: 589 dataset = new JRDesignXyDataset(dataset); 590 plot = new JRDesignScatterPlot(plot); 591 break; 592 case CHART_TYPE_STACKEDBAR: 593 dataset = new JRDesignCategoryDataset(dataset); 594 plot = new JRDesignBarPlot(plot); 595 break; 596 case CHART_TYPE_STACKEDBAR3D: 597 dataset = new JRDesignCategoryDataset(dataset); 598 plot = new JRDesignBar3DPlot(plot); 599 break; 600 case CHART_TYPE_THERMOMETER: 601 dataset = new JRDesignValueDataset(dataset); 602 plot = new JRDesignThermometerPlot(plot); 603 break; 604 case CHART_TYPE_TIMESERIES: 605 dataset = new JRDesignTimeSeriesDataset( dataset ); plot = new JRDesignTimeSeriesPlot( plot ); 607 break; 608 case CHART_TYPE_XYAREA: 609 dataset = new JRDesignXyDataset(dataset); 610 plot = new JRDesignAreaPlot(plot); 611 break; 612 case CHART_TYPE_XYBAR: 613 plot = new JRDesignBarPlot(plot); 614 break; 615 case CHART_TYPE_XYLINE: 616 dataset = new JRDesignXyDataset(dataset); 617 plot = new JRDesignLinePlot(plot); 618 break; 619 default: 620 throw new JRRuntimeException("Chart type not supported."); 621 } 622 } 623 624 625 public void setDataset(JRChartDataset ds) 626 { 627 switch( ds.getDatasetType() ){ 628 case JRChartDataset.CATEGORY_DATASET: 629 dataset = (JRDesignCategoryDataset)ds; 630 break; 631 case JRChartDataset.HIGHLOW_DATASET: 632 dataset = (JRDesignHighLowDataset)ds; 633 break; 634 case JRChartDataset.PIE_DATASET: 635 dataset = (JRDesignPieDataset)ds; 636 break; 637 case JRChartDataset.TIMEPERIOD_DATASET: 638 dataset = (JRDesignTimePeriodDataset)ds; 639 break; 640 case JRChartDataset.TIMESERIES_DATASET: 641 dataset = (JRDesignTimeSeriesDataset)ds; 642 break; 643 case JRChartDataset.VALUE_DATASET: 644 dataset = (JRDesignValueDataset)ds; 645 break; 646 case JRChartDataset.XY_DATASET: 647 dataset = (JRDesignXyDataset)ds; 648 break; 649 case JRChartDataset.XYZ_DATASET: 650 dataset = (JRDesignXyzDataset)ds; 651 break; 652 } 653 } 654 655 656 public JRChild getCopy(JRAbstractObjectFactory factory) 657 { 658 return factory.getChart( this ); 659 } 660 661 662 public void collectExpressions(JRExpressionCollector collector) 663 { 664 collector.collect(this); 665 } 666 667 668 public void writeXml(JRXmlWriter xmlWriter) throws IOException 669 { 670 switch(chartType) { 671 case CHART_TYPE_AREA: 672 xmlWriter.writeAreaChart(this); 673 break; 674 case CHART_TYPE_BAR: 675 xmlWriter.writeBarChart(this); 676 break; 677 case CHART_TYPE_BAR3D: 678 xmlWriter.writeBar3DChart(this); 679 break; 680 case CHART_TYPE_BUBBLE: 681 xmlWriter.writeBubbleChart(this); 682 break; 683 case CHART_TYPE_CANDLESTICK: 684 xmlWriter.writeCandlestickChart(this); 685 break; 686 case CHART_TYPE_HIGHLOW: 687 xmlWriter.writeHighLowChart(this); 688 break; 689 case CHART_TYPE_LINE: 690 xmlWriter.writeLineChart(this); 691 break; 692 case CHART_TYPE_METER: 693 xmlWriter.writeMeterChart(this); 694 break; 695 case CHART_TYPE_MULTI_AXIS: 696 xmlWriter.writeMultiAxisChart(this); 697 break; 698 case CHART_TYPE_PIE: 699 xmlWriter.writePieChart(this); 700 break; 701 case CHART_TYPE_PIE3D: 702 xmlWriter.writePie3DChart(this); 703 break; 704 case CHART_TYPE_SCATTER: 705 xmlWriter.writeScatterChart(this); 706 break; 707 case CHART_TYPE_STACKEDBAR: 708 xmlWriter.writeStackedBarChart(this); 709 break; 710 case CHART_TYPE_STACKEDBAR3D: 711 xmlWriter.writeStackedBar3DChart(this); 712 break; 713 case CHART_TYPE_THERMOMETER: 714 xmlWriter.writeThermometerChart(this); 715 break; 716 case CHART_TYPE_TIMESERIES: 717 xmlWriter.writeTimeSeriesChart( this ); 718 break; 719 case CHART_TYPE_XYAREA: 720 xmlWriter.writeXyAreaChart(this); 721 break; 722 case CHART_TYPE_XYBAR: 723 xmlWriter.writeXyBarChart(this); 724 break; 725 case CHART_TYPE_XYLINE: 726 xmlWriter.writeXyLineChart(this); 727 break; 728 default: 729 throw new JRRuntimeException("Chart type not supported."); 730 } 731 } 732 733 734 public int getBookmarkLevel() 735 { 736 return bookmarkLevel; 737 } 738 739 740 746 public void setBookmarkLevel(int bookmarkLevel) 747 { 748 this.bookmarkLevel = bookmarkLevel; 749 } 750 751 754 public String getCustomizerClass() 755 { 756 return customizerClass; 757 } 758 759 763 public void setCustomizerClass(String customizerClass) 764 { 765 this.customizerClass = customizerClass; 766 } 767 768 769 772 public byte getMode() 773 { 774 return JRStyleResolver.getMode(this, MODE_TRANSPARENT); 775 } 776 777 780 public byte getBorder() 781 { 782 return JRStyleResolver.getBorder(this); 783 } 784 785 public Byte getOwnBorder() 786 { 787 return border; 788 } 789 790 793 public void setBorder(byte border) 794 { 795 this.border = new Byte (border); 796 } 797 798 801 public Color getBorderColor() 802 { 803 return JRStyleResolver.getBorderColor(this, getForecolor()); 804 } 805 806 public Color getOwnBorderColor() 807 { 808 return borderColor; 809 } 810 811 814 public void setBorderColor(Color borderColor) 815 { 816 this.borderColor = borderColor; 817 } 818 819 822 public int getPadding() 823 { 824 return JRStyleResolver.getPadding(this); 825 } 826 827 public Integer getOwnPadding() 828 { 829 return padding; 830 } 831 832 835 public void setPadding(int padding) 836 { 837 this.padding = new Integer (padding); 838 } 839 840 843 public byte getTopBorder() 844 { 845 return JRStyleResolver.getTopBorder(this); 846 } 847 848 851 public Byte getOwnTopBorder() 852 { 853 return topBorder; 854 } 855 856 859 public void setTopBorder(byte topBorder) 860 { 861 this.topBorder = new Byte (topBorder); 862 } 863 864 867 public Color getTopBorderColor() 868 { 869 return JRStyleResolver.getTopBorderColor(this, getForecolor()); 870 } 871 872 875 public Color getOwnTopBorderColor() 876 { 877 return topBorderColor; 878 } 879 880 883 public void setTopBorderColor(Color topBorderColor) 884 { 885 this.topBorderColor = topBorderColor; 886 } 887 888 891 public int getTopPadding() 892 { 893 return JRStyleResolver.getTopPadding(this); 894 } 895 896 899 public Integer getOwnTopPadding() 900 { 901 return topPadding; 902 } 903 904 907 public void setTopPadding(int topPadding) 908 { 909 this.topPadding = new Integer (topPadding); 910 } 911 912 915 public byte getLeftBorder() 916 { 917 return JRStyleResolver.getLeftBorder(this); 918 } 919 920 923 public Byte getOwnLeftBorder() 924 { 925 return leftBorder; 926 } 927 928 931 public void setLeftBorder(byte leftBorder) 932 { 933 this.leftBorder = new Byte (leftBorder); 934 } 935 936 939 public Color getLeftBorderColor() 940 { 941 return JRStyleResolver.getLeftBorderColor(this, getForecolor()); 942 } 943 944 947 public Color getOwnLeftBorderColor() 948 { 949 return leftBorderColor; 950 } 951 952 955 public void setLeftBorderColor(Color leftBorderColor) 956 { 957 this.leftBorderColor = leftBorderColor; 958 } 959 960 963 public int getLeftPadding() 964 { 965 return JRStyleResolver.getLeftPadding(this); 966 } 967 968 971 public Integer getOwnLeftPadding() 972 { 973 return leftPadding; 974 } 975 976 979 public void setLeftPadding(int leftPadding) 980 { 981 this.leftPadding = new Integer (leftPadding); 982 } 983 984 987 public byte getBottomBorder() 988 { 989 return JRStyleResolver.getBottomBorder(this); 990 } 991 992 995 public Byte getOwnBottomBorder() 996 { 997 return bottomBorder; 998 } 999 1000 1003 public void setBottomBorder(byte bottomBorder) 1004 { 1005 this.bottomBorder = new Byte (bottomBorder); 1006 } 1007 1008 1011 public Color getBottomBorderColor() 1012 { 1013 return JRStyleResolver.getBottomBorderColor(this, getForecolor()); 1014 } 1015 1016 1019 public Color getOwnBottomBorderColor() 1020 { 1021 return bottomBorderColor; 1022 } 1023 1024 1027 public void setBottomBorderColor(Color bottomBorderColor) 1028 { 1029 this.bottomBorderColor = bottomBorderColor; 1030 } 1031 1032 1035 public int getBottomPadding() 1036 { 1037 return JRStyleResolver.getBottomPadding(this); 1038 } 1039 1040 1043 public Integer getOwnBottomPadding() 1044 { 1045 return bottomPadding; 1046 } 1047 1048 1051 public void setBottomPadding(int bottomPadding) 1052 { 1053 this.bottomPadding = new Integer (bottomPadding); 1054 } 1055 1056 1059 public byte getRightBorder() 1060 { 1061 return JRStyleResolver.getRightBorder(this); 1062 } 1063 1064 1067 public Byte getOwnRightBorder() 1068 { 1069 return rightBorder; 1070 } 1071 1072 1075 public void setRightBorder(byte rightBorder) 1076 { 1077 this.rightBorder = new Byte (rightBorder); 1078 } 1079 1080 1083 public Color getRightBorderColor() 1084 { 1085 return JRStyleResolver.getRightBorderColor(this, getForecolor()); 1086 } 1087 1088 1091 public Color getOwnRightBorderColor() 1092 { 1093 return rightBorderColor; 1094 } 1095 1096 1099 public void setRightBorderColor(Color rightBorderColor) 1100 { 1101 this.rightBorderColor = rightBorderColor; 1102 } 1103 1104 1107 public int getRightPadding() 1108 { 1109 return JRStyleResolver.getRightPadding(this); 1110 } 1111 1112 1115 public Integer getOwnRightPadding() 1116 { 1117 return rightPadding; 1118 } 1119 1120 1123 public void setRightPadding(int rightPadding) 1124 { 1125 this.rightPadding = new Integer (rightPadding); 1126 } 1127 1128 1129 1132 public void setBorder(Byte border) 1133 { 1134 this.border = border; 1135 } 1136 1137 1140 public void setPadding(Integer padding) 1141 { 1142 this.padding = padding; 1143 } 1144 1145 1148 public void setTopBorder(Byte topBorder) 1149 { 1150 this.topBorder = topBorder; 1151 } 1152 1153 1156 public void setTopPadding(Integer topPadding) 1157 { 1158 this.topPadding = topPadding; 1159 } 1160 1161 1164 public void setLeftBorder(Byte leftBorder) 1165 { 1166 this.leftBorder = leftBorder; 1167 } 1168 1169 1172 public void setLeftPadding(Integer leftPadding) 1173 { 1174 this.leftPadding = leftPadding; 1175 } 1176 1177 1180 public void setBottomBorder(Byte bottomBorder) 1181 { 1182 this.bottomBorder = bottomBorder; 1183 } 1184 1185 1188 public void setBottomPadding(Integer bottomPadding) 1189 { 1190 this.bottomPadding = bottomPadding; 1191 } 1192 1193 1196 public void setRightBorder(Byte rightBorder) 1197 { 1198 this.rightBorder = rightBorder; 1199 } 1200 1201 1204 public void setRightPadding(Integer rightPadding) 1205 { 1206 this.rightPadding = rightPadding; 1207 } 1208 1209 1210 public String getLinkType() 1211 { 1212 return linkType; 1213 } 1214 1215 1216 1225 public void setLinkType(String type) 1226 { 1227 this.linkType = type; 1228 } 1229 1230 1231 public JRHyperlinkParameter[] getHyperlinkParameters() 1232 { 1233 JRHyperlinkParameter[] parameters; 1234 if (hyperlinkParameters.isEmpty()) 1235 { 1236 parameters = null; 1237 } 1238 else 1239 { 1240 parameters = new JRHyperlinkParameter[hyperlinkParameters.size()]; 1241 hyperlinkParameters.toArray(parameters); 1242 } 1243 return parameters; 1244 } 1245 1246 1247 1252 public List getHyperlinkParametersList() 1253 { 1254 return hyperlinkParameters; 1255 } 1256 1257 1258 1263 public void addHyperlinkParameter(JRHyperlinkParameter parameter) 1264 { 1265 hyperlinkParameters.add(parameter); 1266 } 1267 1268 1269 1274 public void removeHyperlinkParameter(JRHyperlinkParameter parameter) 1275 { 1276 hyperlinkParameters.remove(parameter); 1277 } 1278 1279 1280 1289 public void removeHyperlinkParameter(String parameterName) 1290 { 1291 for (Iterator it = hyperlinkParameters.iterator(); it.hasNext();) 1292 { 1293 JRHyperlinkParameter parameter = (JRHyperlinkParameter) it.next(); 1294 if (parameter.getName() != null && parameter.getName().equals(parameterName)) 1295 { 1296 it.remove(); 1297 } 1298 } 1299 } 1300 1301 1302 private void readObject(ObjectInputStream in) throws IOException , ClassNotFoundException 1303 { 1304 in.defaultReadObject(); 1305 normalizeLinkType(); 1306 } 1307 1308 1309 protected void normalizeLinkType() 1310 { 1311 if (linkType == null) 1312 { 1313 linkType = JRHyperlinkHelper.getLinkType(hyperlinkType); 1314 } 1315 hyperlinkType = JRHyperlink.HYPERLINK_TYPE_NULL; 1316 } 1317 1318 1319 public JRExpression getHyperlinkTooltipExpression() 1320 { 1321 return hyperlinkTooltipExpression; 1322 } 1323 1324 1325 1331 public void setHyperlinkTooltipExpression(JRExpression hyperlinkTooltipExpression) 1332 { 1333 this.hyperlinkTooltipExpression = hyperlinkTooltipExpression; 1334 } 1335 1336} 1337 | Popular Tags |