Source Code Cross Referenced for Chart.java in  » ESB » open-esb » org » openesb » tools » extchart » jfchart » 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 » ESB » open esb » org.openesb.tools.extchart.jfchart 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)Chart.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package org.openesb.tools.extchart.jfchart;
030:
031:        import org.openesb.tools.extchart.exception.ChartException;
032:        import org.openesb.tools.extchart.jfchart.data.DataAccess;
033:        import org.openesb.tools.extchart.property.ChartConstants;
034:        import org.openesb.tools.extchart.property.ChartDefaults;
035:        import org.openesb.tools.extchart.property.JFChartConstants;
036:        import org.openesb.tools.extpropertysheet.IExtPropertyGroup;
037:        import org.openesb.tools.extpropertysheet.IExtPropertyGroupsBean;
038:        import java.awt.Color;
039:        import java.util.Map;
040:
041:        import java.util.logging.Logger;
042:        import org.jfree.chart.JFreeChart;
043:        import org.jfree.chart.title.LegendTitle;
044:        import org.jfree.chart.title.TextTitle;
045:        import org.jfree.ui.HorizontalAlignment;
046:        import org.jfree.ui.RectangleEdge;
047:
048:        /**
049:         *
050:         * @author rdwivedi
051:         */
052:        public abstract class Chart {
053:
054:            private static Logger mLogger = Logger.getLogger(Chart.class
055:                    .getName());
056:
057:            abstract public JFreeChart createChart() throws ChartException;
058:
059:            abstract public ChartDefaults getChartDefaults();
060:
061:            // Chart specific methods common to all
062:
063:            protected void setTitle(JFreeChart chart) {
064:
065:                ChartDefaults chartProp = getChartDefaults();
066:                String title = chartProp.getTitle();
067:                if (!chartProp.isDisplayTitle()) {
068:                    chart.setTitle((String) null);
069:                } else {
070:                    int nHorizonalAlignment = chartProp.getTitleAlignment();
071:                    HorizontalAlignment horizontalAlignment = null;
072:                    switch (nHorizonalAlignment) {
073:                    case ChartDefaults.LEFT:
074:                        horizontalAlignment = HorizontalAlignment.LEFT; //TextTitle.LEFT;
075:                        break;
076:                    case ChartDefaults.RIGHT:
077:                        horizontalAlignment = HorizontalAlignment.RIGHT; //TextTitle.RIGHT;
078:                        break;
079:                    default:
080:                        horizontalAlignment = HorizontalAlignment.CENTER; //TextTitle.CENTER;
081:                    }
082:                    TextTitle textTitle = new TextTitle(title, chartProp
083:                            .getTitleFont());
084:                    Color titleColor = chartProp.getTitleColor();
085:                    if (titleColor != null) {
086:                        textTitle.setPaint(titleColor);
087:                    }
088:                    Color titleBackground = chartProp.getTitleBackground();
089:                    if (titleBackground != null) {
090:                        textTitle.setBackgroundPaint(titleBackground);
091:                    }
092:                    textTitle.setHorizontalAlignment(horizontalAlignment);
093:                    chart.setTitle(textTitle);
094:                }
095:            }
096:
097:            /**
098:             * Sets legend of the chart basing on chart properties
099:             * @param chart - chart
100:             */
101:            protected void setLegend(JFreeChart chart) {
102:                ChartDefaults chartProp = getChartDefaults();
103:                if (!chartProp.isIncludeLegend()) {
104:                    return;
105:                }
106:                LegendTitle legend = chart.getLegend();
107:                if (legend == null) {
108:                    return;
109:                }
110:                int anchor = chartProp.getLegendAnchor();
111:                switch (anchor) {
112:                case ChartDefaults.ANCHOR_NORTH:
113:                    legend.setPosition(RectangleEdge.TOP);
114:                    break;
115:                case ChartDefaults.ANCHOR_EAST:
116:                    legend.setPosition(RectangleEdge.RIGHT);
117:                    break;
118:                case ChartDefaults.ANCHOR_WEST:
119:                    legend.setPosition(RectangleEdge.LEFT);
120:                    break;
121:                default:
122:                    legend.setPosition(RectangleEdge.BOTTOM);
123:                }
124:            }
125:
126:            /**
127:             * Sets border for the chart
128:             * @param chart - chart
129:             */
130:            protected void setBorder(JFreeChart chart) {
131:                ChartDefaults chartProp = getChartDefaults();
132:                boolean borderVisible = chartProp.isBorderVisible();
133:                if (borderVisible) {
134:                    chart.setBorderVisible(true);
135:                    Color borderPaint = chartProp.getBorderPaint();
136:                    if (borderPaint != null) {
137:                        chart.setBorderPaint(borderPaint);
138:                    }
139:                }
140:            }
141:
142:            public static Map getAllowedChartsForDatasetType(String dsType) {
143:                Map map = null;
144:                if (dsType.equals(JFChartConstants.CATEGORY_DATASET)) {
145:                    map = BasicCategoryDatasetBasedCharts.getAllAllowedCharts();
146:
147:                } else if (dsType.equals(JFChartConstants.XY_DATASET)) {
148:                    map = BasicXYDatasetBasedCharts.getAllAllowedCharts();
149:
150:                } else if (dsType.equals(JFChartConstants.VALUE_DATASET)) {
151:                    map = BasicSingleValueDatasetBasedCharts
152:                            .getAllAllowedCharts();
153:
154:                } else if (dsType.equals(JFChartConstants.PIE_DATASET)) {
155:                    map = BasicPieDatasetBasedCharts.getAllAllowedCharts();
156:
157:                }
158:                return map;
159:            }
160:
161:            public static Chart createChartObject(IExtPropertyGroupsBean pg,
162:                    DataAccess da) throws ChartException {
163:                Chart chart = null;
164:                String datasetType = da.getDatasetType();
165:                if (datasetType.equals(JFChartConstants.CATEGORY_DATASET)) {
166:                    chart = new BasicCategoryDatasetBasedCharts(pg, da);
167:                } else if (datasetType.equals(JFChartConstants.XY_DATASET)) {
168:                    chart = new BasicXYDatasetBasedCharts(pg, da);
169:                } else if (datasetType
170:                        .equalsIgnoreCase(JFChartConstants.VALUE_DATASET)) {
171:                    chart = new BasicSingleValueDatasetBasedCharts(pg, da);
172:                } else if (datasetType
173:                        .equalsIgnoreCase(JFChartConstants.PIE_DATASET)) {
174:                    chart = new BasicPieDatasetBasedCharts(pg, da);
175:                } else {
176:                    throw new ChartException("Chart Properties are not set.");
177:                }
178:
179:                return chart;
180:            }
181:
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.