Source Code Cross Referenced for ChartPanel.java in  » Chart » charting-0.94 » de » progra » charting » swing » 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 » Chart » charting 0.94 » de.progra.charting.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:            JOpenChart Java Charting Library and Toolkit
003:            Copyright (C) 2001  Sebastian Müller
004:            http://jopenchart.sourceforge.net
005:
006:            This library is free software; you can redistribute it and/or
007:            modify it under the terms of the GNU Lesser General Public
008:            License as published by the Free Software Foundation; either
009:            version 2.1 of the License, or (at your option) any later version.
010:
011:            This library is distributed in the hope that it will be useful,
012:            but WITHOUT ANY WARRANTY; without even the implied warranty of
013:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:            Lesser General Public License for more details.
015:
016:            You should have received a copy of the GNU Lesser General Public
017:            License along with this library; if not, write to the Free Software
018:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:
020:            ChartPanel.java
021:            Created on 6. September 2001, 14:10
022:         */
023:
024:        package de.progra.charting.swing;
025:
026:        import javax.swing.JPanel;
027:        import de.progra.charting.render.AbstractChartRenderer;
028:        import de.progra.charting.event.*;
029:        import de.progra.charting.Chart;
030:        import de.progra.charting.Legend;
031:        import de.progra.charting.Title;
032:        import de.progra.charting.CoordSystem;
033:        import de.progra.charting.DefaultChart;
034:        import java.awt.geom.Rectangle2D;
035:        import java.awt.Rectangle;
036:        import java.awt.Graphics;
037:        import java.awt.Graphics2D;
038:        import java.awt.Dimension;
039:        import java.util.Map;
040:        import de.progra.charting.model.ChartDataModel;
041:
042:        /**
043:         * This Panel provides the possibility to include a Chart into a Swing 
044:         * Application. I choose not to make every Chart extend JComponent because
045:         * of the overhead this would have meant. Instead, this class is an adaptor.
046:         * It implements the Chart interface and contains a DefaultChart instance
047:         * to which all Chart calls are promoted.
048:         * @author  mueller
049:         */
050:        public class ChartPanel extends JPanel implements  Chart {
051:
052:            /** The chart instance to which all method calls are promoted.*/
053:            DefaultChart chart;
054:
055:            /** Creates new ChartPanel */
056:            private ChartPanel() {
057:            }
058:
059:            /** Creates a new ChartPanel with the given model
060:             * and title string. 
061:             * @param model the ChartDataModel
062:             * @param title the title String
063:             */
064:            public ChartPanel(ChartDataModel model, String title) {
065:                this ();
066:                chart = new DefaultChart(model, title);
067:            }
068:
069:            /** Creates a new ChartPanel with the given model
070:             * and title string and a coordinate system.
071:             * @param model the ChartDataModel
072:             * @param title the title String
073:             * @param coord the id of the coordinate system configuration
074:             */
075:            public ChartPanel(ChartDataModel model, String title, int coord) {
076:                this ();
077:                chart = new DefaultChart(model, title, coord);
078:            }
079:
080:            /** This method is write-protected by the IDE but isn't used at all.
081:             */
082:            private void initComponents() {//GEN-BEGIN:initComponents
083:
084:                setLayout(new java.awt.BorderLayout());
085:
086:            }//GEN-END:initComponents
087:
088:            /** Adds a ChartRenderer with a specific z-coordinate.
089:             * @param renderer the ChartRenderer
090:             * @param z its z-coordinate.
091:             */
092:            public void addChartRenderer(AbstractChartRenderer renderer, int z) {
093:                chart.addChartRenderer(renderer, z);
094:            }
095:
096:            /** Returns the Bounds for the ChartPanel.
097:             * @return the bounds
098:             */
099:            public Rectangle getBounds() {
100:                return chart.getBounds();
101:            }
102:
103:            /** Returns the ChartDataModel.
104:             * @return the ChartDataModel
105:             */
106:            public ChartDataModel getChartDataModel() {
107:                return chart.getChartDataModel();
108:            }
109:
110:            /** Returns the Map of all ChartRenderers.
111:             * @return the Map of Renderers.
112:             */
113:            public Map getChartRenderer() {
114:                return chart.getChartRenderer();
115:            }
116:
117:            /** Returns the ChartRenderer with a specific z-coordinate.
118:             * @param z the z-coordinate of the desired ChartRenderer.
119:             * @return the ChartRenderer or <CODE>null</CODE> if none has been found.
120:             */
121:            public AbstractChartRenderer getChartRenderer(int z) {
122:                return chart.getChartRenderer(z);
123:            }
124:
125:            /** Returns the coordinate system.
126:             * @return the Coordinate System for the Chart. Could be <CODE>null</CODE>.
127:             */
128:            public CoordSystem getCoordSystem() {
129:                return chart.getCoordSystem();
130:            }
131:
132:            /** Returns this chart's legend.
133:             * @return the Legend for this Chart. Could be <CODE>null</CODE>.
134:             */
135:            public Legend getLegend() {
136:                return chart.getLegend();
137:            }
138:
139:            /** Returns the title for this chart.
140:             * @return this Chart's Title. Could be <CODE>null</CODE>.
141:             */
142:            public Title getTitle() {
143:                return chart.getTitle();
144:            }
145:
146:            /** Sets the Bounds for this Chart.
147:             * @param r the <CODE>Rectangle</CODE> object defining the bounds
148:             */
149:            public void setBounds(Rectangle r) {
150:                chart.setBounds(r);
151:            }
152:
153:            /** Stores the ChartDataModel for this Chart.
154:             * @param model the ChartDataModel
155:             */
156:            public void setChartDataModel(ChartDataModel model) {
157:                chart.setChartDataModel(model);
158:            }
159:
160:            /** Sets the Map with all ChartRenderers. The keys
161:             * have to be the z-coordinates of the ChartRenderers.
162:             * @param renderer The Map of ChartRenderers.
163:             */
164:            public void setChartRenderer(Map renderer) {
165:                chart.setChartRenderer(renderer);
166:            }
167:
168:            /** Sets the coordinate system for this chart,
169:             * which can be null if the ChartRenderer
170:             * doesn't need a coordinate system, e.g. if it's a
171:             * PieChart.
172:             * @param c The Coordinate System for the Chart.
173:             */
174:            public void setCoordSystem(CoordSystem c) {
175:                chart.setCoordSystem(c);
176:            }
177:
178:            /** Sets the legend for this chart.
179:             * @param l The Legend this Chart contains.
180:             */
181:            public void setLegend(Legend l) {
182:                chart.setLegend(l);
183:            }
184:
185:            /** Sets the title for this chart.
186:             * @param t This Chart's Title.
187:             */
188:            public void setTitle(Title t) {
189:                chart.setTitle(t);
190:            }
191:
192:            /** Computes the preferred size of the ChartPanel.
193:             * @return <code>new java.awt.Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)</code>
194:             */
195:            public Dimension getPreferredSize() {
196:                return new java.awt.Dimension(Integer.MAX_VALUE,
197:                        Integer.MAX_VALUE);
198:            }
199:
200:            /** Paints the ChartPanel. Calls <code>chart.render((Graphics2D)graphics)</code>
201:             * @param graphics the Graphics2D object to paint in
202:             */
203:            public void paint(Graphics graphics) {
204:                chart
205:                        .setBounds(new Rectangle(this .getWidth(), this 
206:                                .getHeight()));
207:                chart.render((Graphics2D) graphics);
208:            }
209:
210:            /** Does the layout of the title, legend and coordinate system and
211:             * calls the render method of all those including the ChartRenderers.
212:             * @param g the <CODE>Graphics2D</CODE> object to paint in.
213:             * Just calls paint(Graphics).
214:             */
215:            public void render(Graphics2D g) {
216:                paint(g);
217:            }
218:
219:            // Variables declaration - do not modify//GEN-BEGIN:variables
220:            // End of variables declaration//GEN-END:variables
221:
222:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.