Source Code Cross Referenced for JRDesignChart.java in  » Report » jasperreports-2.0.1 » net » sf » jasperreports » engine » design » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » jasperreports 2.0.1 » net.sf.jasperreports.engine.design 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * ============================================================================
0003:         * GNU Lesser General Public License
0004:         * ============================================================================
0005:         *
0006:         * JasperReports - Free Java report-generating library.
0007:         * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
0008:         * 
0009:         * This library is free software; you can redistribute it and/or
0010:         * modify it under the terms of the GNU Lesser General Public
0011:         * License as published by the Free Software Foundation; either
0012:         * version 2.1 of the License, or (at your option) any later version.
0013:         * 
0014:         * This library is distributed in the hope that it will be useful,
0015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017:         * Lesser General Public License for more details.
0018:         * 
0019:         * You should have received a copy of the GNU Lesser General Public
0020:         * License along with this library; if not, write to the Free Software
0021:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
0022:         * 
0023:         * JasperSoft Corporation
0024:         * 303 Second Street, Suite 450 North
0025:         * San Francisco, CA 94107
0026:         * http://www.jaspersoft.com
0027:         */
0028:        package net.sf.jasperreports.engine.design;
0029:
0030:        import java.awt.Color;
0031:        import java.io.IOException;
0032:        import java.io.ObjectInputStream;
0033:        import java.util.ArrayList;
0034:        import java.util.Iterator;
0035:        import java.util.List;
0036:
0037:        import net.sf.jasperreports.charts.design.JRDesignAreaPlot;
0038:        import net.sf.jasperreports.charts.design.JRDesignBar3DPlot;
0039:        import net.sf.jasperreports.charts.design.JRDesignBarPlot;
0040:        import net.sf.jasperreports.charts.design.JRDesignBubblePlot;
0041:        import net.sf.jasperreports.charts.design.JRDesignCandlestickPlot;
0042:        import net.sf.jasperreports.charts.design.JRDesignCategoryDataset;
0043:        import net.sf.jasperreports.charts.design.JRDesignHighLowDataset;
0044:        import net.sf.jasperreports.charts.design.JRDesignHighLowPlot;
0045:        import net.sf.jasperreports.charts.design.JRDesignLinePlot;
0046:        import net.sf.jasperreports.charts.design.JRDesignMeterPlot;
0047:        import net.sf.jasperreports.charts.design.JRDesignMultiAxisPlot;
0048:        import net.sf.jasperreports.charts.design.JRDesignPie3DPlot;
0049:        import net.sf.jasperreports.charts.design.JRDesignPieDataset;
0050:        import net.sf.jasperreports.charts.design.JRDesignPiePlot;
0051:        import net.sf.jasperreports.charts.design.JRDesignScatterPlot;
0052:        import net.sf.jasperreports.charts.design.JRDesignThermometerPlot;
0053:        import net.sf.jasperreports.charts.design.JRDesignTimePeriodDataset;
0054:        import net.sf.jasperreports.charts.design.JRDesignTimeSeriesDataset;
0055:        import net.sf.jasperreports.charts.design.JRDesignTimeSeriesPlot;
0056:        import net.sf.jasperreports.charts.design.JRDesignValueDataset;
0057:        import net.sf.jasperreports.charts.design.JRDesignXyDataset;
0058:        import net.sf.jasperreports.charts.design.JRDesignXyzDataset;
0059:        import net.sf.jasperreports.engine.JRAbstractObjectFactory;
0060:        import net.sf.jasperreports.engine.JRAnchor;
0061:        import net.sf.jasperreports.engine.JRBox;
0062:        import net.sf.jasperreports.engine.JRChart;
0063:        import net.sf.jasperreports.engine.JRChartDataset;
0064:        import net.sf.jasperreports.engine.JRChartPlot;
0065:        import net.sf.jasperreports.engine.JRChild;
0066:        import net.sf.jasperreports.engine.JRConstants;
0067:        import net.sf.jasperreports.engine.JRDefaultStyleProvider;
0068:        import net.sf.jasperreports.engine.JRExpression;
0069:        import net.sf.jasperreports.engine.JRExpressionCollector;
0070:        import net.sf.jasperreports.engine.JRFont;
0071:        import net.sf.jasperreports.engine.JRGroup;
0072:        import net.sf.jasperreports.engine.JRHyperlink;
0073:        import net.sf.jasperreports.engine.JRHyperlinkHelper;
0074:        import net.sf.jasperreports.engine.JRHyperlinkParameter;
0075:        import net.sf.jasperreports.engine.JRRuntimeException;
0076:        import net.sf.jasperreports.engine.util.JRStyleResolver;
0077:        import net.sf.jasperreports.engine.xml.JRXmlWriter;
0078:
0079:        /**
0080:         * @author Teodor Danciu (teodord@users.sourceforge.net)
0081:         * @version $Id: JRDesignChart.java 1577 2007-02-09 11:25:48Z teodord $
0082:         */
0083:        public class JRDesignChart extends JRDesignElement implements  JRChart {
0084:
0085:            /**
0086:             *
0087:             */
0088:            private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
0089:
0090:            /**
0091:             *
0092:             */
0093:            protected byte chartType = 0;
0094:
0095:            /**
0096:             *
0097:             */
0098:            protected boolean isShowLegend = false;
0099:            protected byte evaluationTime = JRExpression.EVALUATION_TIME_NOW;
0100:            protected byte hyperlinkType = JRHyperlink.HYPERLINK_TYPE_NULL;
0101:            protected String linkType;
0102:            protected byte hyperlinkTarget = JRHyperlink.HYPERLINK_TARGET_SELF;
0103:            protected byte titlePosition = JRChart.TITLE_POSITION_TOP;
0104:            protected Color titleColor = null;
0105:            protected Color subtitleColor = null;
0106:            protected Color legendColor = null;
0107:            protected Color legendBackgroundColor = null;
0108:
0109:            /**
0110:             *
0111:             */
0112:            protected JRFont titleFont = null;
0113:            protected JRFont subtitleFont = null;
0114:            protected JRFont legendFont = null;
0115:
0116:            protected String customizerClass;
0117:
0118:            /**
0119:             *
0120:             */
0121:            protected JRGroup evaluationGroup = null;
0122:            protected JRExpression titleExpression = null;
0123:            protected JRExpression subtitleExpression = null;
0124:            protected JRExpression anchorNameExpression = null;
0125:            protected JRExpression hyperlinkReferenceExpression = null;
0126:            protected JRExpression hyperlinkAnchorExpression = null;
0127:            protected JRExpression hyperlinkPageExpression = null;
0128:            private JRExpression hyperlinkTooltipExpression;
0129:            private List hyperlinkParameters;
0130:
0131:            protected JRChartDataset dataset = null;
0132:            protected JRChartPlot plot = null;
0133:
0134:            /**
0135:             *
0136:             */
0137:            protected Byte border;
0138:            protected Byte topBorder = null;
0139:            protected Byte leftBorder = null;
0140:            protected Byte bottomBorder = null;
0141:            protected Byte rightBorder = null;
0142:            protected Color borderColor = null;
0143:            protected Color topBorderColor = null;
0144:            protected Color leftBorderColor = null;
0145:            protected Color bottomBorderColor = null;
0146:            protected Color rightBorderColor = null;
0147:            protected Integer padding;
0148:            protected Integer topPadding = null;
0149:            protected Integer leftPadding = null;
0150:            protected Integer bottomPadding = null;
0151:            protected Integer rightPadding = null;
0152:
0153:            /**
0154:             * The bookmark level for the anchor associated with this chart.
0155:             * @see JRAnchor#getBookmarkLevel()
0156:             */
0157:            protected int bookmarkLevel = JRAnchor.NO_BOOKMARK;
0158:
0159:            /**
0160:             *
0161:             */
0162:            public JRDesignChart(JRDefaultStyleProvider defaultStyleProvider,
0163:                    byte chartType) {
0164:                super (defaultStyleProvider);
0165:
0166:                setChartType(chartType);
0167:
0168:                hyperlinkParameters = new ArrayList();
0169:            }
0170:
0171:            /**
0172:             *
0173:             */
0174:            public boolean isShowLegend() {
0175:                return isShowLegend;
0176:            }
0177:
0178:            /**
0179:             *
0180:             */
0181:            public void setShowLegend(boolean isShowLegend) {
0182:                this .isShowLegend = isShowLegend;
0183:            }
0184:
0185:            /**
0186:             *
0187:             */
0188:            public byte getEvaluationTime() {
0189:                return evaluationTime;
0190:            }
0191:
0192:            /**
0193:             *
0194:             */
0195:            public void setEvaluationTime(byte evaluationTime) {
0196:                this .evaluationTime = evaluationTime;
0197:            }
0198:
0199:            /**
0200:             *
0201:             */
0202:            public JRGroup getEvaluationGroup() {
0203:                return evaluationGroup;
0204:            }
0205:
0206:            /**
0207:             *
0208:             */
0209:            public void setEvaluationGroup(JRGroup group) {
0210:                this .evaluationGroup = group;
0211:            }
0212:
0213:            /**
0214:             * @deprecated
0215:             */
0216:            public JRBox getBox() {
0217:                return this ;
0218:            }
0219:
0220:            /**
0221:             * @deprecated
0222:             */
0223:            public void setBox(JRBox box) {
0224:                border = box.getOwnBorder();
0225:                topBorder = box.getOwnTopBorder();
0226:                leftBorder = box.getOwnLeftBorder();
0227:                bottomBorder = box.getOwnBottomBorder();
0228:                rightBorder = box.getOwnRightBorder();
0229:                borderColor = box.getOwnBorderColor();
0230:                topBorderColor = box.getOwnTopBorderColor();
0231:                leftBorderColor = box.getOwnLeftBorderColor();
0232:                bottomBorderColor = box.getOwnBottomBorderColor();
0233:                rightBorderColor = box.getOwnRightBorderColor();
0234:                padding = box.getOwnPadding();
0235:                topPadding = box.getOwnTopPadding();
0236:                leftPadding = box.getOwnLeftPadding();
0237:                bottomPadding = box.getOwnBottomPadding();
0238:                rightPadding = box.getOwnRightPadding();
0239:            }
0240:
0241:            /**
0242:             *
0243:             */
0244:            public JRFont getTitleFont() {
0245:                return titleFont;
0246:            }
0247:
0248:            /**
0249:             *
0250:             */
0251:            public void setTitleFont(JRFont font) {
0252:                this .titleFont = font;
0253:            }
0254:
0255:            /**
0256:             *
0257:             */
0258:            public byte getTitlePosition() {
0259:                return titlePosition;
0260:            }
0261:
0262:            /**
0263:             *
0264:             */
0265:            public void setTitlePosition(byte titlePosition) {
0266:                this .titlePosition = titlePosition;
0267:            }
0268:
0269:            /**
0270:             *
0271:             */
0272:            public Color getTitleColor() {
0273:                return JRStyleResolver.getTitleColor(this );
0274:            }
0275:
0276:            /**
0277:             *
0278:             */
0279:            public Color getOwnTitleColor() {
0280:                return titleColor;
0281:            }
0282:
0283:            /**
0284:             *
0285:             */
0286:            public void setTitleColor(Color titleColor) {
0287:                this .titleColor = titleColor;
0288:            }
0289:
0290:            /**
0291:             *
0292:             */
0293:            public JRFont getSubtitleFont() {
0294:                return subtitleFont;
0295:            }
0296:
0297:            /**
0298:             *
0299:             */
0300:            public void setSubtitleFont(JRFont font) {
0301:                this .subtitleFont = font;
0302:            }
0303:
0304:            /**
0305:             *
0306:             */
0307:            public Color getSubtitleColor() {
0308:                return JRStyleResolver.getSubtitleColor(this );
0309:            }
0310:
0311:            /**
0312:             *
0313:             */
0314:            public Color getOwnSubtitleColor() {
0315:                return subtitleColor;
0316:            }
0317:
0318:            /**
0319:             *
0320:             */
0321:            public void setSubtitleColor(Color subtitleColor) {
0322:                this .subtitleColor = subtitleColor;
0323:            }
0324:
0325:            /**
0326:             *
0327:             */
0328:            public Color getOwnLegendColor() {
0329:                return legendColor;
0330:            }
0331:
0332:            /**
0333:             *
0334:             */
0335:            public Color getLegendColor() {
0336:                return JRStyleResolver.getLegendColor(this );
0337:            }
0338:
0339:            /**
0340:             *
0341:             */
0342:            public void setLegendColor(Color legendColor) {
0343:                this .legendColor = legendColor;
0344:            }
0345:
0346:            /**
0347:             *
0348:             */
0349:            public Color getOwnLegendBackgroundColor() {
0350:                return legendBackgroundColor;
0351:            }
0352:
0353:            /**
0354:             *
0355:             */
0356:            public Color getLegendBackgroundColor() {
0357:                return JRStyleResolver.getLegendBackgroundColor(this );
0358:            }
0359:
0360:            /**
0361:             *
0362:             */
0363:            public void setLegendBackgroundColor(Color legendBackgroundColor) {
0364:                this .legendBackgroundColor = legendBackgroundColor;
0365:            }
0366:
0367:            /**
0368:             *
0369:             */
0370:            public JRFont getLegendFont() {
0371:                return legendFont;
0372:            }
0373:
0374:            /**
0375:             *
0376:             */
0377:            public void setLegendFont(JRFont legendFont) {
0378:                this .legendFont = legendFont;
0379:            }
0380:
0381:            /**
0382:             *
0383:             */
0384:            public byte getHyperlinkType() {
0385:                return JRHyperlinkHelper.getHyperlinkType(this );
0386:            }
0387:
0388:            /**
0389:             * Sets the link type as a built-in hyperlink type.
0390:             * 
0391:             * @param hyperlinkType the built-in hyperlink type
0392:             * @see #getLinkType()
0393:             */
0394:            public void setHyperlinkType(byte hyperlinkType) {
0395:                setLinkType(JRHyperlinkHelper.getLinkType(hyperlinkType));
0396:            }
0397:
0398:            /**
0399:             *
0400:             */
0401:            public byte getHyperlinkTarget() {
0402:                return hyperlinkTarget;
0403:            }
0404:
0405:            /**
0406:             *
0407:             */
0408:            public void setHyperlinkTarget(byte hyperlinkTarget) {
0409:                this .hyperlinkTarget = hyperlinkTarget;
0410:            }
0411:
0412:            /**
0413:             *
0414:             */
0415:            public JRExpression getTitleExpression() {
0416:                return titleExpression;
0417:            }
0418:
0419:            /**
0420:             *
0421:             */
0422:            public void setTitleExpression(JRExpression expression) {
0423:                this .titleExpression = expression;
0424:            }
0425:
0426:            /**
0427:             *
0428:             */
0429:            public JRExpression getSubtitleExpression() {
0430:                return subtitleExpression;
0431:            }
0432:
0433:            /**
0434:             *
0435:             */
0436:            public void setSubtitleExpression(JRExpression expression) {
0437:                this .subtitleExpression = expression;
0438:            }
0439:
0440:            /**
0441:             *
0442:             */
0443:            public JRExpression getAnchorNameExpression() {
0444:                return anchorNameExpression;
0445:            }
0446:
0447:            /**
0448:             *
0449:             */
0450:            public void setAnchorNameExpression(
0451:                    JRExpression anchorNameExpression) {
0452:                this .anchorNameExpression = anchorNameExpression;
0453:            }
0454:
0455:            /**
0456:             *
0457:             */
0458:            public JRExpression getHyperlinkReferenceExpression() {
0459:                return hyperlinkReferenceExpression;
0460:            }
0461:
0462:            /**
0463:             *
0464:             */
0465:            public void setHyperlinkReferenceExpression(
0466:                    JRExpression hyperlinkReferenceExpression) {
0467:                this .hyperlinkReferenceExpression = hyperlinkReferenceExpression;
0468:            }
0469:
0470:            /**
0471:             *
0472:             */
0473:            public JRExpression getHyperlinkAnchorExpression() {
0474:                return hyperlinkAnchorExpression;
0475:            }
0476:
0477:            /**
0478:             *
0479:             */
0480:            public void setHyperlinkAnchorExpression(
0481:                    JRExpression hyperlinkAnchorExpression) {
0482:                this .hyperlinkAnchorExpression = hyperlinkAnchorExpression;
0483:            }
0484:
0485:            /**
0486:             *
0487:             */
0488:            public JRExpression getHyperlinkPageExpression() {
0489:                return hyperlinkPageExpression;
0490:            }
0491:
0492:            /**
0493:             *
0494:             */
0495:            public void setHyperlinkPageExpression(
0496:                    JRExpression hyperlinkPageExpression) {
0497:                this .hyperlinkPageExpression = hyperlinkPageExpression;
0498:            }
0499:
0500:            /**
0501:             *
0502:             */
0503:            public JRChartDataset getDataset() {
0504:                return dataset;
0505:            }
0506:
0507:            /**
0508:             *
0509:             */
0510:            public JRChartPlot getPlot() {
0511:                return plot;
0512:            }
0513:
0514:            public byte getChartType() {
0515:                return chartType;
0516:            }
0517:
0518:            /**
0519:             *
0520:             */
0521:            public void setChartType(byte chartType) {
0522:                this .chartType = chartType;
0523:
0524:                switch (chartType) {
0525:                case CHART_TYPE_AREA:
0526:                    dataset = new JRDesignCategoryDataset(dataset);
0527:                    plot = new JRDesignAreaPlot(plot, this );
0528:                    break;
0529:                case CHART_TYPE_BAR:
0530:                    dataset = new JRDesignCategoryDataset(dataset);
0531:                    plot = new JRDesignBarPlot(plot, this );
0532:                    break;
0533:                case CHART_TYPE_BAR3D:
0534:                    dataset = new JRDesignCategoryDataset(dataset);
0535:                    plot = new JRDesignBar3DPlot(plot, this );
0536:                    break;
0537:                case CHART_TYPE_BUBBLE:
0538:                    dataset = new JRDesignXyzDataset(dataset);
0539:                    plot = new JRDesignBubblePlot(plot, this );
0540:                    break;
0541:                case CHART_TYPE_CANDLESTICK:
0542:                    dataset = new JRDesignHighLowDataset(dataset);
0543:                    plot = new JRDesignCandlestickPlot(plot, this );
0544:                    break;
0545:                case CHART_TYPE_HIGHLOW:
0546:                    dataset = new JRDesignHighLowDataset(dataset);
0547:                    plot = new JRDesignHighLowPlot(plot, this );
0548:                    break;
0549:                case CHART_TYPE_LINE:
0550:                    dataset = new JRDesignCategoryDataset(dataset);
0551:                    plot = new JRDesignLinePlot(plot, this );
0552:                    break;
0553:                case CHART_TYPE_METER:
0554:                    dataset = new JRDesignValueDataset(dataset);
0555:                    plot = new JRDesignMeterPlot(plot, this );
0556:                    break;
0557:                case CHART_TYPE_MULTI_AXIS:
0558:                    plot = new JRDesignMultiAxisPlot(plot, this );
0559:                    dataset = null;
0560:                    break;
0561:                case CHART_TYPE_PIE:
0562:                    dataset = new JRDesignPieDataset(dataset);
0563:                    plot = new JRDesignPiePlot(plot, this );
0564:                    break;
0565:                case CHART_TYPE_PIE3D:
0566:                    dataset = new JRDesignPieDataset(dataset);
0567:                    plot = new JRDesignPie3DPlot(plot, this );
0568:                    break;
0569:                case CHART_TYPE_SCATTER:
0570:                    dataset = new JRDesignXyDataset(dataset);
0571:                    plot = new JRDesignScatterPlot(plot, this );
0572:                    break;
0573:                case CHART_TYPE_STACKEDBAR:
0574:                    dataset = new JRDesignCategoryDataset(dataset);
0575:                    plot = new JRDesignBarPlot(plot, this );
0576:                    break;
0577:                case CHART_TYPE_STACKEDBAR3D:
0578:                    dataset = new JRDesignCategoryDataset(dataset);
0579:                    plot = new JRDesignBar3DPlot(plot, this );
0580:                    break;
0581:                case CHART_TYPE_THERMOMETER:
0582:                    dataset = new JRDesignValueDataset(dataset);
0583:                    plot = new JRDesignThermometerPlot(plot, this );
0584:                    break;
0585:                case CHART_TYPE_TIMESERIES:
0586:                    dataset = new JRDesignTimeSeriesDataset(dataset);//other datasets could be supported
0587:                    plot = new JRDesignTimeSeriesPlot(plot, this );
0588:                    break;
0589:                case CHART_TYPE_XYAREA:
0590:                    dataset = new JRDesignXyDataset(dataset);
0591:                    plot = new JRDesignAreaPlot(plot, this );
0592:                    break;
0593:                case CHART_TYPE_XYBAR:
0594:                    plot = new JRDesignBarPlot(plot, this );
0595:                    break;
0596:                case CHART_TYPE_XYLINE:
0597:                    dataset = new JRDesignXyDataset(dataset);
0598:                    plot = new JRDesignLinePlot(plot, this );
0599:                    break;
0600:                case CHART_TYPE_STACKEDAREA:
0601:                    dataset = new JRDesignCategoryDataset(dataset);
0602:                    plot = new JRDesignAreaPlot(plot, this );
0603:                    break;
0604:                default:
0605:                    throw new JRRuntimeException("Chart type not supported.");
0606:                }
0607:            }
0608:
0609:            public void setDataset(JRChartDataset ds) {
0610:                switch (ds.getDatasetType()) {
0611:                case JRChartDataset.CATEGORY_DATASET:
0612:                    dataset = (JRDesignCategoryDataset) ds;
0613:                    break;
0614:                case JRChartDataset.HIGHLOW_DATASET:
0615:                    dataset = (JRDesignHighLowDataset) ds;
0616:                    break;
0617:                case JRChartDataset.PIE_DATASET:
0618:                    dataset = (JRDesignPieDataset) ds;
0619:                    break;
0620:                case JRChartDataset.TIMEPERIOD_DATASET:
0621:                    dataset = (JRDesignTimePeriodDataset) ds;
0622:                    break;
0623:                case JRChartDataset.TIMESERIES_DATASET:
0624:                    dataset = (JRDesignTimeSeriesDataset) ds;
0625:                    break;
0626:                case JRChartDataset.VALUE_DATASET:
0627:                    dataset = (JRDesignValueDataset) ds;
0628:                    break;
0629:                case JRChartDataset.XY_DATASET:
0630:                    dataset = (JRDesignXyDataset) ds;
0631:                    break;
0632:                case JRChartDataset.XYZ_DATASET:
0633:                    dataset = (JRDesignXyzDataset) ds;
0634:                    break;
0635:                }
0636:            }
0637:
0638:            public JRChild getCopy(JRAbstractObjectFactory factory) {
0639:                return factory.getChart(this );
0640:            }
0641:
0642:            public void collectExpressions(JRExpressionCollector collector) {
0643:                collector.collect(this );
0644:            }
0645:
0646:            public void writeXml(JRXmlWriter xmlWriter) throws IOException {
0647:                switch (chartType) {
0648:                case CHART_TYPE_AREA:
0649:                    xmlWriter.writeAreaChart(this );
0650:                    break;
0651:                case CHART_TYPE_BAR:
0652:                    xmlWriter.writeBarChart(this );
0653:                    break;
0654:                case CHART_TYPE_BAR3D:
0655:                    xmlWriter.writeBar3DChart(this );
0656:                    break;
0657:                case CHART_TYPE_BUBBLE:
0658:                    xmlWriter.writeBubbleChart(this );
0659:                    break;
0660:                case CHART_TYPE_CANDLESTICK:
0661:                    xmlWriter.writeCandlestickChart(this );
0662:                    break;
0663:                case CHART_TYPE_HIGHLOW:
0664:                    xmlWriter.writeHighLowChart(this );
0665:                    break;
0666:                case CHART_TYPE_LINE:
0667:                    xmlWriter.writeLineChart(this );
0668:                    break;
0669:                case CHART_TYPE_METER:
0670:                    xmlWriter.writeMeterChart(this );
0671:                    break;
0672:                case CHART_TYPE_MULTI_AXIS:
0673:                    xmlWriter.writeMultiAxisChart(this );
0674:                    break;
0675:                case CHART_TYPE_PIE:
0676:                    xmlWriter.writePieChart(this );
0677:                    break;
0678:                case CHART_TYPE_PIE3D:
0679:                    xmlWriter.writePie3DChart(this );
0680:                    break;
0681:                case CHART_TYPE_SCATTER:
0682:                    xmlWriter.writeScatterChart(this );
0683:                    break;
0684:                case CHART_TYPE_STACKEDBAR:
0685:                    xmlWriter.writeStackedBarChart(this );
0686:                    break;
0687:                case CHART_TYPE_STACKEDBAR3D:
0688:                    xmlWriter.writeStackedBar3DChart(this );
0689:                    break;
0690:                case CHART_TYPE_THERMOMETER:
0691:                    xmlWriter.writeThermometerChart(this );
0692:                    break;
0693:                case CHART_TYPE_TIMESERIES:
0694:                    xmlWriter.writeTimeSeriesChart(this );
0695:                    break;
0696:                case CHART_TYPE_XYAREA:
0697:                    xmlWriter.writeXyAreaChart(this );
0698:                    break;
0699:                case CHART_TYPE_XYBAR:
0700:                    xmlWriter.writeXyBarChart(this );
0701:                    break;
0702:                case CHART_TYPE_XYLINE:
0703:                    xmlWriter.writeXyLineChart(this );
0704:                    break;
0705:                case CHART_TYPE_STACKEDAREA:
0706:                    xmlWriter.writeStackedAreaChart(this );
0707:                    break;
0708:                default:
0709:                    throw new JRRuntimeException("Chart type not supported.");
0710:                }
0711:            }
0712:
0713:            public int getBookmarkLevel() {
0714:                return bookmarkLevel;
0715:            }
0716:
0717:            /**
0718:             * Sets the boomark level for the anchor associated with this chart.
0719:             * 
0720:             * @param bookmarkLevel the bookmark level (starting from 1)
0721:             * or {@link JRAnchor#NO_BOOKMARK NO_BOOKMARK} if no bookmark should be created
0722:             */
0723:            public void setBookmarkLevel(int bookmarkLevel) {
0724:                this .bookmarkLevel = bookmarkLevel;
0725:            }
0726:
0727:            /**
0728:             *
0729:             */
0730:            public String getCustomizerClass() {
0731:                return customizerClass;
0732:            }
0733:
0734:            /**
0735:             * Sets a user specified chart customizer class name.
0736:             * @see net.sf.jasperreports.engine.JRChartCustomizer
0737:             */
0738:            public void setCustomizerClass(String customizerClass) {
0739:                this .customizerClass = customizerClass;
0740:            }
0741:
0742:            /**
0743:             *
0744:             */
0745:            public byte getMode() {
0746:                return JRStyleResolver.getMode(this , MODE_TRANSPARENT);
0747:            }
0748:
0749:            /**
0750:             *
0751:             */
0752:            public byte getBorder() {
0753:                return JRStyleResolver.getBorder(this );
0754:            }
0755:
0756:            public Byte getOwnBorder() {
0757:                return border;
0758:            }
0759:
0760:            /**
0761:             *
0762:             */
0763:            public void setBorder(byte border) {
0764:                this .border = new Byte(border);
0765:            }
0766:
0767:            /**
0768:             *
0769:             */
0770:            public Color getBorderColor() {
0771:                return JRStyleResolver.getBorderColor(this , getForecolor());
0772:            }
0773:
0774:            public Color getOwnBorderColor() {
0775:                return borderColor;
0776:            }
0777:
0778:            /**
0779:             *
0780:             */
0781:            public void setBorderColor(Color borderColor) {
0782:                this .borderColor = borderColor;
0783:            }
0784:
0785:            /**
0786:             *
0787:             */
0788:            public int getPadding() {
0789:                return JRStyleResolver.getPadding(this );
0790:            }
0791:
0792:            public Integer getOwnPadding() {
0793:                return padding;
0794:            }
0795:
0796:            /**
0797:             *
0798:             */
0799:            public void setPadding(int padding) {
0800:                this .padding = new Integer(padding);
0801:            }
0802:
0803:            /**
0804:             *
0805:             */
0806:            public byte getTopBorder() {
0807:                return JRStyleResolver.getTopBorder(this );
0808:            }
0809:
0810:            /**
0811:             *
0812:             */
0813:            public Byte getOwnTopBorder() {
0814:                return topBorder;
0815:            }
0816:
0817:            /**
0818:             *
0819:             */
0820:            public void setTopBorder(byte topBorder) {
0821:                this .topBorder = new Byte(topBorder);
0822:            }
0823:
0824:            /**
0825:             *
0826:             */
0827:            public Color getTopBorderColor() {
0828:                return JRStyleResolver.getTopBorderColor(this , getForecolor());
0829:            }
0830:
0831:            /**
0832:             *
0833:             */
0834:            public Color getOwnTopBorderColor() {
0835:                return topBorderColor;
0836:            }
0837:
0838:            /**
0839:             *
0840:             */
0841:            public void setTopBorderColor(Color topBorderColor) {
0842:                this .topBorderColor = topBorderColor;
0843:            }
0844:
0845:            /**
0846:             *
0847:             */
0848:            public int getTopPadding() {
0849:                return JRStyleResolver.getTopPadding(this );
0850:            }
0851:
0852:            /**
0853:             *
0854:             */
0855:            public Integer getOwnTopPadding() {
0856:                return topPadding;
0857:            }
0858:
0859:            /**
0860:             *
0861:             */
0862:            public void setTopPadding(int topPadding) {
0863:                this .topPadding = new Integer(topPadding);
0864:            }
0865:
0866:            /**
0867:             *
0868:             */
0869:            public byte getLeftBorder() {
0870:                return JRStyleResolver.getLeftBorder(this );
0871:            }
0872:
0873:            /**
0874:             *
0875:             */
0876:            public Byte getOwnLeftBorder() {
0877:                return leftBorder;
0878:            }
0879:
0880:            /**
0881:             *
0882:             */
0883:            public void setLeftBorder(byte leftBorder) {
0884:                this .leftBorder = new Byte(leftBorder);
0885:            }
0886:
0887:            /**
0888:             *
0889:             */
0890:            public Color getLeftBorderColor() {
0891:                return JRStyleResolver.getLeftBorderColor(this , getForecolor());
0892:            }
0893:
0894:            /**
0895:             *
0896:             */
0897:            public Color getOwnLeftBorderColor() {
0898:                return leftBorderColor;
0899:            }
0900:
0901:            /**
0902:             *
0903:             */
0904:            public void setLeftBorderColor(Color leftBorderColor) {
0905:                this .leftBorderColor = leftBorderColor;
0906:            }
0907:
0908:            /**
0909:             *
0910:             */
0911:            public int getLeftPadding() {
0912:                return JRStyleResolver.getLeftPadding(this );
0913:            }
0914:
0915:            /**
0916:             *
0917:             */
0918:            public Integer getOwnLeftPadding() {
0919:                return leftPadding;
0920:            }
0921:
0922:            /**
0923:             *
0924:             */
0925:            public void setLeftPadding(int leftPadding) {
0926:                this .leftPadding = new Integer(leftPadding);
0927:            }
0928:
0929:            /**
0930:             *
0931:             */
0932:            public byte getBottomBorder() {
0933:                return JRStyleResolver.getBottomBorder(this );
0934:            }
0935:
0936:            /**
0937:             *
0938:             */
0939:            public Byte getOwnBottomBorder() {
0940:                return bottomBorder;
0941:            }
0942:
0943:            /**
0944:             *
0945:             */
0946:            public void setBottomBorder(byte bottomBorder) {
0947:                this .bottomBorder = new Byte(bottomBorder);
0948:            }
0949:
0950:            /**
0951:             *
0952:             */
0953:            public Color getBottomBorderColor() {
0954:                return JRStyleResolver.getBottomBorderColor(this ,
0955:                        getForecolor());
0956:            }
0957:
0958:            /**
0959:             *
0960:             */
0961:            public Color getOwnBottomBorderColor() {
0962:                return bottomBorderColor;
0963:            }
0964:
0965:            /**
0966:             *
0967:             */
0968:            public void setBottomBorderColor(Color bottomBorderColor) {
0969:                this .bottomBorderColor = bottomBorderColor;
0970:            }
0971:
0972:            /**
0973:             *
0974:             */
0975:            public int getBottomPadding() {
0976:                return JRStyleResolver.getBottomPadding(this );
0977:            }
0978:
0979:            /**
0980:             *
0981:             */
0982:            public Integer getOwnBottomPadding() {
0983:                return bottomPadding;
0984:            }
0985:
0986:            /**
0987:             *
0988:             */
0989:            public void setBottomPadding(int bottomPadding) {
0990:                this .bottomPadding = new Integer(bottomPadding);
0991:            }
0992:
0993:            /**
0994:             *
0995:             */
0996:            public byte getRightBorder() {
0997:                return JRStyleResolver.getRightBorder(this );
0998:            }
0999:
1000:            /**
1001:             *
1002:             */
1003:            public Byte getOwnRightBorder() {
1004:                return rightBorder;
1005:            }
1006:
1007:            /**
1008:             *
1009:             */
1010:            public void setRightBorder(byte rightBorder) {
1011:                this .rightBorder = new Byte(rightBorder);
1012:            }
1013:
1014:            /**
1015:             *
1016:             */
1017:            public Color getRightBorderColor() {
1018:                return JRStyleResolver
1019:                        .getRightBorderColor(this , getForecolor());
1020:            }
1021:
1022:            /**
1023:             *
1024:             */
1025:            public Color getOwnRightBorderColor() {
1026:                return rightBorderColor;
1027:            }
1028:
1029:            /**
1030:             *
1031:             */
1032:            public void setRightBorderColor(Color rightBorderColor) {
1033:                this .rightBorderColor = rightBorderColor;
1034:            }
1035:
1036:            /**
1037:             *
1038:             */
1039:            public int getRightPadding() {
1040:                return JRStyleResolver.getRightPadding(this );
1041:            }
1042:
1043:            /**
1044:             *
1045:             */
1046:            public Integer getOwnRightPadding() {
1047:                return rightPadding;
1048:            }
1049:
1050:            /**
1051:             *
1052:             */
1053:            public void setRightPadding(int rightPadding) {
1054:                this .rightPadding = new Integer(rightPadding);
1055:            }
1056:
1057:            /**
1058:             *
1059:             */
1060:            public void setBorder(Byte border) {
1061:                this .border = border;
1062:            }
1063:
1064:            /**
1065:             *
1066:             */
1067:            public void setPadding(Integer padding) {
1068:                this .padding = padding;
1069:            }
1070:
1071:            /**
1072:             *
1073:             */
1074:            public void setTopBorder(Byte topBorder) {
1075:                this .topBorder = topBorder;
1076:            }
1077:
1078:            /**
1079:             *
1080:             */
1081:            public void setTopPadding(Integer topPadding) {
1082:                this .topPadding = topPadding;
1083:            }
1084:
1085:            /**
1086:             *
1087:             */
1088:            public void setLeftBorder(Byte leftBorder) {
1089:                this .leftBorder = leftBorder;
1090:            }
1091:
1092:            /**
1093:             *
1094:             */
1095:            public void setLeftPadding(Integer leftPadding) {
1096:                this .leftPadding = leftPadding;
1097:            }
1098:
1099:            /**
1100:             *
1101:             */
1102:            public void setBottomBorder(Byte bottomBorder) {
1103:                this .bottomBorder = bottomBorder;
1104:            }
1105:
1106:            /**
1107:             *
1108:             */
1109:            public void setBottomPadding(Integer bottomPadding) {
1110:                this .bottomPadding = bottomPadding;
1111:            }
1112:
1113:            /**
1114:             *
1115:             */
1116:            public void setRightBorder(Byte rightBorder) {
1117:                this .rightBorder = rightBorder;
1118:            }
1119:
1120:            /**
1121:             *
1122:             */
1123:            public void setRightPadding(Integer rightPadding) {
1124:                this .rightPadding = rightPadding;
1125:            }
1126:
1127:            public String getLinkType() {
1128:                return linkType;
1129:            }
1130:
1131:            /**
1132:             * Sets the hyperlink type.
1133:             * <p>
1134:             * The type can be one of the built-in types
1135:             * (Reference, LocalAnchor, LocalPage, RemoteAnchor, RemotePage),
1136:             * or can be an arbitrary type.
1137:             * </p>
1138:             * @param type the hyperlink type
1139:             */
1140:            public void setLinkType(String type) {
1141:                this .linkType = type;
1142:            }
1143:
1144:            public JRHyperlinkParameter[] getHyperlinkParameters() {
1145:                JRHyperlinkParameter[] parameters;
1146:                if (hyperlinkParameters.isEmpty()) {
1147:                    parameters = null;
1148:                } else {
1149:                    parameters = new JRHyperlinkParameter[hyperlinkParameters
1150:                            .size()];
1151:                    hyperlinkParameters.toArray(parameters);
1152:                }
1153:                return parameters;
1154:            }
1155:
1156:            /**
1157:             * Returns the list of custom hyperlink parameters.
1158:             * 
1159:             * @return the list of custom hyperlink parameters
1160:             */
1161:            public List getHyperlinkParametersList() {
1162:                return hyperlinkParameters;
1163:            }
1164:
1165:            /**
1166:             * Adds a custom hyperlink parameter.
1167:             * 
1168:             * @param parameter the parameter to add
1169:             */
1170:            public void addHyperlinkParameter(JRHyperlinkParameter parameter) {
1171:                hyperlinkParameters.add(parameter);
1172:            }
1173:
1174:            /**
1175:             * Removes a custom hyperlink parameter.
1176:             * 
1177:             * @param parameter the parameter to remove
1178:             */
1179:            public void removeHyperlinkParameter(JRHyperlinkParameter parameter) {
1180:                hyperlinkParameters.remove(parameter);
1181:            }
1182:
1183:            /**
1184:             * Removes a custom hyperlink parameter.
1185:             * <p>
1186:             * If multiple parameters having the specified name exist, all of them
1187:             * will be removed
1188:             * </p>
1189:             * 
1190:             * @param parameterName the parameter name
1191:             */
1192:            public void removeHyperlinkParameter(String parameterName) {
1193:                for (Iterator it = hyperlinkParameters.iterator(); it.hasNext();) {
1194:                    JRHyperlinkParameter parameter = (JRHyperlinkParameter) it
1195:                            .next();
1196:                    if (parameter.getName() != null
1197:                            && parameter.getName().equals(parameterName)) {
1198:                        it.remove();
1199:                    }
1200:                }
1201:            }
1202:
1203:            private void readObject(ObjectInputStream in) throws IOException,
1204:                    ClassNotFoundException {
1205:                in.defaultReadObject();
1206:                normalizeLinkType();
1207:            }
1208:
1209:            protected void normalizeLinkType() {
1210:                if (linkType == null) {
1211:                    linkType = JRHyperlinkHelper.getLinkType(hyperlinkType);
1212:                }
1213:                hyperlinkType = JRHyperlink.HYPERLINK_TYPE_NULL;
1214:            }
1215:
1216:            public JRExpression getHyperlinkTooltipExpression() {
1217:                return hyperlinkTooltipExpression;
1218:            }
1219:
1220:            /**
1221:             * Sets the expression which will be used to generate the hyperlink tooltip.
1222:             * 
1223:             * @param hyperlinkTooltipExpression the expression which will be used to generate the hyperlink tooltip
1224:             * @see #getHyperlinkTooltipExpression()
1225:             */
1226:            public void setHyperlinkTooltipExpression(
1227:                    JRExpression hyperlinkTooltipExpression) {
1228:                this.hyperlinkTooltipExpression = hyperlinkTooltipExpression;
1229:            }
1230:
1231:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.