KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > design > JRDesignChart


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine.design;
29
30 import java.awt.Color JavaDoc;
31 import java.io.IOException JavaDoc;
32 import java.io.ObjectInputStream JavaDoc;
33 import java.util.ArrayList JavaDoc;
34 import java.util.Iterator JavaDoc;
35 import java.util.List JavaDoc;
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 /**
81  * @author Teodor Danciu (teodord@users.sourceforge.net)
82  * @version $Id: JRDesignChart.java 1391 2006-09-06 00:59:25 +0300 (Wed, 06 Sep 2006) bklawans $
83  */

84 public class JRDesignChart extends JRDesignElement implements JRChart
85 {
86
87
88     /**
89      *
90      */

91     private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
92
93     /**
94      *
95      */

96     protected byte chartType = 0;
97
98     /**
99      *
100      */

101     protected boolean isShowLegend = false;
102     protected byte evaluationTime = JRExpression.EVALUATION_TIME_NOW;
103     protected byte hyperlinkType = JRHyperlink.HYPERLINK_TYPE_NULL;
104     protected String JavaDoc linkType;
105     protected byte hyperlinkTarget = JRHyperlink.HYPERLINK_TARGET_SELF;
106     protected byte titlePosition = JRChart.TITLE_POSITION_TOP;
107     protected Color JavaDoc titleColor = Color.black;
108     protected Color JavaDoc subtitleColor = Color.black;
109     protected Color JavaDoc legendColor = null;
110     protected Color JavaDoc legendBackgroundColor = null;
111
112     /**
113      *
114      */

115     protected JRFont titleFont = null;
116     protected JRFont subtitleFont = null;
117     protected JRFont legendFont = null;
118
119     protected String JavaDoc customizerClass;
120
121     /**
122      *
123      */

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 JavaDoc hyperlinkParameters;
133
134     protected JRChartDataset dataset = null;
135     protected JRChartPlot plot = null;
136
137     /**
138      *
139      */

140     protected Byte JavaDoc border;
141     protected Byte JavaDoc topBorder = null;
142     protected Byte JavaDoc leftBorder = null;
143     protected Byte JavaDoc bottomBorder = null;
144     protected Byte JavaDoc rightBorder = null;
145     protected Color JavaDoc borderColor = null;
146     protected Color JavaDoc topBorderColor = null;
147     protected Color JavaDoc leftBorderColor = null;
148     protected Color JavaDoc bottomBorderColor = null;
149     protected Color JavaDoc rightBorderColor = null;
150     protected Integer JavaDoc padding;
151     protected Integer JavaDoc topPadding = null;
152     protected Integer JavaDoc leftPadding = null;
153     protected Integer JavaDoc bottomPadding = null;
154     protected Integer JavaDoc rightPadding = null;
155
156     /**
157      * The bookmark level for the anchor associated with this chart.
158      * @see JRAnchor#getBookmarkLevel()
159      */

160     protected int bookmarkLevel = JRAnchor.NO_BOOKMARK;
161
162
163     /**
164      *
165      */

166     public JRDesignChart(JRDefaultStyleProvider defaultStyleProvider, byte chartType)
167     {
168         super(defaultStyleProvider);
169         
170         setChartType(chartType);
171         
172         hyperlinkParameters = new ArrayList JavaDoc();
173     }
174
175
176     /**
177      *
178      */

179     public boolean isShowLegend()
180     {
181         return isShowLegend;
182     }
183
184     /**
185      *
186      */

187     public void setShowLegend(boolean isShowLegend)
188     {
189         this.isShowLegend = isShowLegend;
190     }
191
192     /**
193      *
194      */

195     public byte getEvaluationTime()
196     {
197         return evaluationTime;
198     }
199         
200     /**
201      *
202      */

203     public void setEvaluationTime(byte evaluationTime)
204     {
205         this.evaluationTime = evaluationTime;
206     }
207         
208     /**
209      *
210      */

211     public JRGroup getEvaluationGroup()
212     {
213         return evaluationGroup;
214     }
215         
216     /**
217      *
218      */

219     public void setEvaluationGroup(JRGroup group)
220     {
221         this.evaluationGroup = group;
222     }
223         
224     /**
225      * @deprecated
226      */

227     public JRBox getBox()
228     {
229         return this;
230     }
231
232     /**
233      * @deprecated
234      */

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     /**
255      *
256      */

257     public JRFont getTitleFont()
258     {
259         return titleFont;
260     }
261
262     /**
263      *
264      */

265     public void setTitleFont(JRFont font)
266     {
267         this.titleFont = font;
268     }
269     
270     /**
271      *
272      */

273     public byte getTitlePosition()
274     {
275         return titlePosition;
276     }
277
278     /**
279      *
280      */

281     public void setTitlePosition(byte titlePosition)
282     {
283         this.titlePosition = titlePosition;
284     }
285
286     /**
287      *
288      */

289     public Color JavaDoc getTitleColor()
290     {
291         return titleColor;
292     }
293
294     /**
295      *
296      */

297     public void setTitleColor(Color JavaDoc titleColor)
298     {
299         this.titleColor = titleColor;
300     }
301
302     /**
303      *
304      */

305     public JRFont getSubtitleFont()
306     {
307         return subtitleFont;
308     }
309
310     /**
311      *
312      */

313     public void setSubtitleFont(JRFont font)
314     {
315         this.subtitleFont = font;
316     }
317     
318     /**
319      *
320      */

321     public Color JavaDoc getSubtitleColor()
322     {
323         return subtitleColor;
324     }
325
326     /**
327      *
328      */

329     public void setSubtitleColor(Color JavaDoc subtitleColor)
330     {
331         this.subtitleColor = subtitleColor;
332     }
333
334     /**
335      *
336      */

337     public Color JavaDoc getLegendColor()
338     {
339         return legendColor;
340     }
341
342     /**
343      *
344      */

345     public void setLegendColor(Color JavaDoc legendColor)
346     {
347         this.legendColor = legendColor;
348     }
349     
350     /**
351      *
352      */

353     public Color JavaDoc getLegendBackgroundColor()
354     {
355         return legendBackgroundColor;
356     }
357
358     /**
359      *
360      */

361     public void setLegendBackgroundColor(Color JavaDoc legendBackgroundColor)
362     {
363         this.legendBackgroundColor = legendBackgroundColor;
364     }
365     
366     /**
367      *
368      */

369     public JRFont getLegendFont()
370     {
371         return legendFont;
372     }
373
374     /**
375      *
376      */

377     public void setLegendFont(JRFont legendFont)
378     {
379         this.legendFont = legendFont;
380     }
381     
382     /**
383      *
384      */

385     public byte getHyperlinkType()
386     {
387         return JRHyperlinkHelper.getHyperlinkType(this);
388     }
389         
390     /**
391      * Sets the link type as a built-in hyperlink type.
392      *
393      * @param hyperlinkType the built-in hyperlink type
394      * @see #getLinkType()
395      */

396     public void setHyperlinkType(byte hyperlinkType)
397     {
398         setLinkType(JRHyperlinkHelper.getLinkType(hyperlinkType));
399     }
400         
401     /**
402      *
403      */

404     public byte getHyperlinkTarget()
405     {
406         return hyperlinkTarget;
407     }
408         
409     /**
410      *
411      */

412     public void setHyperlinkTarget(byte hyperlinkTarget)
413     {
414         this.hyperlinkTarget = hyperlinkTarget;
415     }
416         
417     /**
418      *
419      */

420     public JRExpression getTitleExpression()
421     {
422         return titleExpression;
423     }
424
425     /**
426      *
427      */

428     public void setTitleExpression(JRExpression expression)
429     {
430         this.titleExpression = expression;
431     }
432
433     /**
434      *
435      */

436     public JRExpression getSubtitleExpression()
437     {
438         return subtitleExpression;
439     }
440
441     /**
442      *
443      */

444     public void setSubtitleExpression(JRExpression expression)
445     {
446         this.subtitleExpression = expression;
447     }
448
449     /**
450      *
451      */

452     public JRExpression getAnchorNameExpression()
453     {
454         return anchorNameExpression;
455     }
456
457     /**
458      *
459      */

460     public void setAnchorNameExpression(JRExpression anchorNameExpression)
461     {
462         this.anchorNameExpression = anchorNameExpression;
463     }
464
465     /**
466      *
467      */

468     public JRExpression getHyperlinkReferenceExpression()
469     {
470         return hyperlinkReferenceExpression;
471     }
472
473     /**
474      *
475      */

476     public void setHyperlinkReferenceExpression(JRExpression hyperlinkReferenceExpression)
477     {
478         this.hyperlinkReferenceExpression = hyperlinkReferenceExpression;
479     }
480
481     /**
482      *
483      */

484     public JRExpression getHyperlinkAnchorExpression()
485     {
486         return hyperlinkAnchorExpression;
487     }
488
489     /**
490      *
491      */

492     public void setHyperlinkAnchorExpression(JRExpression hyperlinkAnchorExpression)
493     {
494         this.hyperlinkAnchorExpression = hyperlinkAnchorExpression;
495     }
496
497     /**
498      *
499      */

500     public JRExpression getHyperlinkPageExpression()
501     {
502         return hyperlinkPageExpression;
503     }
504     
505     /**
506      *
507      */

508     public void setHyperlinkPageExpression(JRExpression hyperlinkPageExpression)
509     {
510         this.hyperlinkPageExpression = hyperlinkPageExpression;
511     }
512
513     /**
514      *
515      */

516     public JRChartDataset getDataset()
517     {
518         return dataset;
519     }
520
521     /**
522      *
523      */

524     public JRChartPlot getPlot()
525     {
526         return plot;
527     }
528
529
530     public byte getChartType()
531     {
532         return chartType;
533     }
534
535
536     /**
537      *
538      */

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 );//other datasets could be supported
606
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 JavaDoc
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     /**
741      * Sets the boomark level for the anchor associated with this chart.
742      *
743      * @param bookmarkLevel the bookmark level (starting from 1)
744      * or {@link JRAnchor#NO_BOOKMARK NO_BOOKMARK} if no bookmark should be created
745      */

746     public void setBookmarkLevel(int bookmarkLevel)
747     {
748         this.bookmarkLevel = bookmarkLevel;
749     }
750
751     /**
752      *
753      */

754     public String JavaDoc getCustomizerClass()
755     {
756         return customizerClass;
757     }
758
759     /**
760      * Sets a user specified chart customizer class name.
761      * @see net.sf.jasperreports.engine.JRChartCustomizer
762      */

763     public void setCustomizerClass(String JavaDoc customizerClass)
764     {
765         this.customizerClass = customizerClass;
766     }
767
768
769     /**
770      *
771      */

772     public byte getMode()
773     {
774         return JRStyleResolver.getMode(this, MODE_TRANSPARENT);
775     }
776
777     /**
778      *
779      */

780     public byte getBorder()
781     {
782         return JRStyleResolver.getBorder(this);
783     }
784
785     public Byte JavaDoc getOwnBorder()
786     {
787         return border;
788     }
789
790     /**
791      *
792      */

793     public void setBorder(byte border)
794     {
795         this.border = new Byte JavaDoc(border);
796     }
797
798     /**
799      *
800      */

801     public Color JavaDoc getBorderColor()
802     {
803         return JRStyleResolver.getBorderColor(this, getForecolor());
804     }
805
806     public Color JavaDoc getOwnBorderColor()
807     {
808         return borderColor;
809     }
810
811     /**
812      *
813      */

814     public void setBorderColor(Color JavaDoc borderColor)
815     {
816         this.borderColor = borderColor;
817     }
818
819     /**
820      *
821      */

822     public int getPadding()
823     {
824         return JRStyleResolver.getPadding(this);
825     }
826
827     public Integer JavaDoc getOwnPadding()
828     {
829         return padding;
830     }
831
832     /**
833      *
834      */

835     public void setPadding(int padding)
836     {
837         this.padding = new Integer JavaDoc(padding);
838     }
839
840     /**
841      *
842      */

843     public byte getTopBorder()
844     {
845         return JRStyleResolver.getTopBorder(this);
846     }
847
848     /**
849      *
850      */

851     public Byte JavaDoc getOwnTopBorder()
852     {
853         return topBorder;
854     }
855
856     /**
857      *
858      */

859     public void setTopBorder(byte topBorder)
860     {
861         this.topBorder = new Byte JavaDoc(topBorder);
862     }
863
864     /**
865      *
866      */

867     public Color JavaDoc getTopBorderColor()
868     {
869         return JRStyleResolver.getTopBorderColor(this, getForecolor());
870     }
871
872     /**
873      *
874      */

875     public Color JavaDoc getOwnTopBorderColor()
876     {
877         return topBorderColor;
878     }
879
880     /**
881      *
882      */

883     public void setTopBorderColor(Color JavaDoc topBorderColor)
884     {
885         this.topBorderColor = topBorderColor;
886     }
887
888     /**
889      *
890      */

891     public int getTopPadding()
892     {
893         return JRStyleResolver.getTopPadding(this);
894     }
895
896     /**
897      *
898      */

899     public Integer JavaDoc getOwnTopPadding()
900     {
901         return topPadding;
902     }
903
904     /**
905      *
906      */

907     public void setTopPadding(int topPadding)
908     {
909         this.topPadding = new Integer JavaDoc(topPadding);
910     }
911
912     /**
913      *
914      */

915     public byte getLeftBorder()
916     {
917         return JRStyleResolver.getLeftBorder(this);
918     }
919
920     /**
921      *
922      */

923     public Byte JavaDoc getOwnLeftBorder()
924     {
925         return leftBorder;
926     }
927
928     /**
929      *
930      */

931     public void setLeftBorder(byte leftBorder)
932     {
933         this.leftBorder = new Byte JavaDoc(leftBorder);
934     }
935
936     /**
937      *
938      */

939     public Color JavaDoc getLeftBorderColor()
940     {
941         return JRStyleResolver.getLeftBorderColor(this, getForecolor());
942     }
943
944     /**
945      *
946      */

947     public Color JavaDoc getOwnLeftBorderColor()
948     {
949         return leftBorderColor;
950     }
951
952     /**
953      *
954      */

955     public void setLeftBorderColor(Color JavaDoc leftBorderColor)
956     {
957         this.leftBorderColor = leftBorderColor;
958     }
959
960     /**
961      *
962      */

963     public int getLeftPadding()
964     {
965         return JRStyleResolver.getLeftPadding(this);
966     }
967
968     /**
969      *
970      */

971     public Integer JavaDoc getOwnLeftPadding()
972     {
973         return leftPadding;
974     }
975
976     /**
977      *
978      */

979     public void setLeftPadding(int leftPadding)
980     {
981         this.leftPadding = new Integer JavaDoc(leftPadding);
982     }
983
984     /**
985      *
986      */

987     public byte getBottomBorder()
988     {
989         return JRStyleResolver.getBottomBorder(this);
990     }
991
992     /**
993      *
994      */

995     public Byte JavaDoc getOwnBottomBorder()
996     {
997         return bottomBorder;
998     }
999
1000    /**
1001     *
1002     */

1003    public void setBottomBorder(byte bottomBorder)
1004    {
1005        this.bottomBorder = new Byte JavaDoc(bottomBorder);
1006    }
1007
1008    /**
1009     *
1010     */

1011    public Color JavaDoc getBottomBorderColor()
1012    {
1013        return JRStyleResolver.getBottomBorderColor(this, getForecolor());
1014    }
1015
1016    /**
1017     *
1018     */

1019    public Color JavaDoc getOwnBottomBorderColor()
1020    {
1021        return bottomBorderColor;
1022    }
1023
1024    /**
1025     *
1026     */

1027    public void setBottomBorderColor(Color JavaDoc bottomBorderColor)
1028    {
1029        this.bottomBorderColor = bottomBorderColor;
1030    }
1031
1032    /**
1033     *
1034     */

1035    public int getBottomPadding()
1036    {
1037        return JRStyleResolver.getBottomPadding(this);
1038    }
1039
1040    /**
1041     *
1042     */

1043    public Integer JavaDoc getOwnBottomPadding()
1044    {
1045        return bottomPadding;
1046    }
1047
1048    /**
1049     *
1050     */

1051    public void setBottomPadding(int bottomPadding)
1052    {
1053        this.bottomPadding = new Integer JavaDoc(bottomPadding);
1054    }
1055
1056    /**
1057     *
1058     */

1059    public byte getRightBorder()
1060    {
1061        return JRStyleResolver.getRightBorder(this);
1062    }
1063
1064    /**
1065     *
1066     */

1067    public Byte JavaDoc getOwnRightBorder()
1068    {
1069        return rightBorder;
1070    }
1071
1072    /**
1073     *
1074     */

1075    public void setRightBorder(byte rightBorder)
1076    {
1077        this.rightBorder = new Byte JavaDoc(rightBorder);
1078    }
1079
1080    /**
1081     *
1082     */

1083    public Color JavaDoc getRightBorderColor()
1084    {
1085        return JRStyleResolver.getRightBorderColor(this, getForecolor());
1086    }
1087
1088    /**
1089     *
1090     */

1091    public Color JavaDoc getOwnRightBorderColor()
1092    {
1093        return rightBorderColor;
1094    }
1095
1096    /**
1097     *
1098     */

1099    public void setRightBorderColor(Color JavaDoc rightBorderColor)
1100    {
1101        this.rightBorderColor = rightBorderColor;
1102    }
1103
1104    /**
1105     *
1106     */

1107    public int getRightPadding()
1108    {
1109        return JRStyleResolver.getRightPadding(this);
1110    }
1111
1112    /**
1113     *
1114     */

1115    public Integer JavaDoc getOwnRightPadding()
1116    {
1117        return rightPadding;
1118    }
1119
1120    /**
1121     *
1122     */

1123    public void setRightPadding(int rightPadding)
1124    {
1125        this.rightPadding = new Integer JavaDoc(rightPadding);
1126    }
1127    
1128
1129    /**
1130     *
1131     */

1132    public void setBorder(Byte JavaDoc border)
1133    {
1134        this.border = border;
1135    }
1136
1137    /**
1138     *
1139     */

1140    public void setPadding(Integer JavaDoc padding)
1141    {
1142        this.padding = padding;
1143    }
1144
1145    /**
1146     *
1147     */

1148    public void setTopBorder(Byte JavaDoc topBorder)
1149    {
1150        this.topBorder = topBorder;
1151    }
1152
1153    /**
1154     *
1155     */

1156    public void setTopPadding(Integer JavaDoc topPadding)
1157    {
1158        this.topPadding = topPadding;
1159    }
1160
1161    /**
1162     *
1163     */

1164    public void setLeftBorder(Byte JavaDoc leftBorder)
1165    {
1166        this.leftBorder = leftBorder;
1167    }
1168
1169    /**
1170     *
1171     */

1172    public void setLeftPadding(Integer JavaDoc leftPadding)
1173    {
1174        this.leftPadding = leftPadding;
1175    }
1176
1177    /**
1178     *
1179     */

1180    public void setBottomBorder(Byte JavaDoc bottomBorder)
1181    {
1182        this.bottomBorder = bottomBorder;
1183    }
1184
1185    /**
1186     *
1187     */

1188    public void setBottomPadding(Integer JavaDoc bottomPadding)
1189    {
1190        this.bottomPadding = bottomPadding;
1191    }
1192
1193    /**
1194     *
1195     */

1196    public void setRightBorder(Byte JavaDoc rightBorder)
1197    {
1198        this.rightBorder = rightBorder;
1199    }
1200
1201    /**
1202     *
1203     */

1204    public void setRightPadding(Integer JavaDoc rightPadding)
1205    {
1206        this.rightPadding = rightPadding;
1207    }
1208
1209
1210    public String JavaDoc getLinkType()
1211    {
1212        return linkType;
1213    }
1214
1215
1216    /**
1217     * Sets the hyperlink type.
1218     * <p>
1219     * The type can be one of the built-in types
1220     * (Reference, LocalAnchor, LocalPage, RemoteAnchor, RemotePage),
1221     * or can be an arbitrary type.
1222     * </p>
1223     * @param type the hyperlink type
1224     */

1225    public void setLinkType(String JavaDoc 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    /**
1248     * Returns the list of custom hyperlink parameters.
1249     *
1250     * @return the list of custom hyperlink parameters
1251     */

1252    public List JavaDoc getHyperlinkParametersList()
1253    {
1254        return hyperlinkParameters;
1255    }
1256    
1257    
1258    /**
1259     * Adds a custom hyperlink parameter.
1260     *
1261     * @param parameter the parameter to add
1262     */

1263    public void addHyperlinkParameter(JRHyperlinkParameter parameter)
1264    {
1265        hyperlinkParameters.add(parameter);
1266    }
1267    
1268
1269    /**
1270     * Removes a custom hyperlink parameter.
1271     *
1272     * @param parameter the parameter to remove
1273     */

1274    public void removeHyperlinkParameter(JRHyperlinkParameter parameter)
1275    {
1276        hyperlinkParameters.remove(parameter);
1277    }
1278    
1279    
1280    /**
1281     * Removes a custom hyperlink parameter.
1282     * <p>
1283     * If multiple parameters having the specified name exist, all of them
1284     * will be removed
1285     * </p>
1286     *
1287     * @param parameterName the parameter name
1288     */

1289    public void removeHyperlinkParameter(String JavaDoc parameterName)
1290    {
1291        for (Iterator JavaDoc 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 JavaDoc in) throws IOException JavaDoc, ClassNotFoundException JavaDoc
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    /**
1326     * Sets the expression which will be used to generate the hyperlink tooltip.
1327     *
1328     * @param hyperlinkTooltipExpression the expression which will be used to generate the hyperlink tooltip
1329     * @see #getHyperlinkTooltipExpression()
1330     */

1331    public void setHyperlinkTooltipExpression(JRExpression hyperlinkTooltipExpression)
1332    {
1333        this.hyperlinkTooltipExpression = hyperlinkTooltipExpression;
1334    }
1335
1336}
1337
Popular Tags