Source Code Cross Referenced for AbstractChartRenderer.java in  » Chart » charting-0.94 » de » progra » charting » render » 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.render 
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:            ChartRenderer.java
021:            Created on 26. Juni 2001, 22:52
022:         */
023:
024:        package de.progra.charting.render;
025:
026:        import java.awt.Rectangle;
027:        import de.progra.charting.CoordSystem;
028:        import java.awt.geom.AffineTransform;
029:        import java.awt.Shape;
030:        import de.progra.charting.PointToPixelTranslator;
031:        import java.awt.Graphics2D;
032:        import java.awt.Dimension;
033:        import de.progra.charting.model.ChartDataModel;
034:
035:        /**
036:         * This class is the superclass for all the different ChartRenderer.
037:         * @author  mueller
038:         * @version 1.0
039:         */
040:        public abstract class AbstractChartRenderer implements  Renderer {
041:
042:            protected Rectangle bounds;
043:
044:            protected CoordSystem coord;
045:
046:            protected PointToPixelTranslator p;
047:
048:            protected ChartDataModel model;
049:
050:            protected RowColorModel rcm;
051:
052:            /** Creates new AbstractChartRenderer
053:             * @param model the DataModel that should be rendered
054:             */
055:            protected AbstractChartRenderer(ChartDataModel model) {
056:                this .model = model;
057:            }
058:
059:            /** Creates new AbstractChartRenderer
060:             * @param rcm the RowColorModel that defines the correspondence between row titles and colors
061:             * @param p the Object used to translate values into points
062:             * @param model the DataModel that should be rendered
063:             * @deprecated Use the constructor 
064:                <code>AbstractChartRenderer(CoordSystem cs, 
065:                                            ChartDataModel model)</code>
066:             *  instead.
067:             */
068:            public AbstractChartRenderer(PointToPixelTranslator p,
069:                    ChartDataModel model) {
070:                this (model);
071:                this .p = p;
072:            }
073:
074:            /** Creates new AbstractChartRenderer
075:             * @param cs the CoordSystem which contains the AffineTransforms to translate
076:             * into pixel space
077:             * @param rcm the RowColorModel that defines the correspondence between row titles and colors
078:             * @param model the DataModel that should be rendered
079:             */
080:            public AbstractChartRenderer(CoordSystem cs, ChartDataModel model) {
081:                this (model);
082:                this .coord = cs;
083:            }
084:
085:            /** Gets the bounds for this renderer.
086:             * @return the bounds of this renderer. If <code>setBounds</code> has not
087:             * been called before, the bounds computed from
088:             * <code>getPreferredSize</code> is returned.
089:             */
090:            public Rectangle getBounds() {
091:                return bounds;
092:            }
093:
094:            /** Returns the preferred size needed for the renderer.
095:             * @return a non-null Dimension object
096:             */
097:            public Dimension getPreferredSize() {
098:                return new Dimension(Integer.MIN_VALUE, Integer.MIN_VALUE);
099:            }
100:
101:            /** Calls <code>renderChart(g)</code> and crops the output to the desired
102:             * bounds. This way you can manually set small maximum and minimum values 
103:             * which automatically gets reflected in the CoordSystem but the ChartRenderer
104:             * doesn't need to care.
105:             * @param g the Graphics2D object in which to render
106:             */
107:            public void render(Graphics2D g) {
108:                Rectangle bounds = getBounds();
109:                Shape clip = g.getClip();
110:                g.setClip((int) bounds.getX(), (int) bounds.getY(),
111:                        (int) bounds.getWidth(), (int) bounds.getHeight());
112:                renderChart(g);
113:                g.setClip(clip);
114:            }
115:
116:            /** Finally renders the chart in the clipped rectangle. */
117:            public abstract void renderChart(Graphics2D g);
118:
119:            /** Sets the bounds the layout manager has assigned to
120:             * this renderer. Those, of course, have to be
121:             * considered in the rendering process.
122:             * @param bounds the new bounds for the renderer.
123:             */
124:            public void setBounds(Rectangle bounds) {
125:                this .bounds = bounds;
126:            }
127:
128:            /** Sets the ChartDataModel whose DataSets are rendered.
129:             * @param model the ChartDataModel
130:             */
131:            public void setChartDataModel(ChartDataModel model) {
132:                this .model = model;
133:            }
134:
135:            /** Returns the ChartDataModel whose DataSets are rendered.
136:             * @return a ChartDataModel which contains the Chart's data
137:             */
138:            public ChartDataModel getChartDataModel() {
139:                return model;
140:            }
141:
142:            /** Sets the PointToPixelTranslator. 
143:             * @param p the PointToPixelTranslator
144:             * @deprecated Has been made obsolete by using AffineTransforms
145:             */
146:            public void setPointToPixelTranslator(PointToPixelTranslator p) {
147:                this .p = p;
148:            }
149:
150:            /** Returns the PointToPixelTranslator.
151:             * @return the PointToPixelTranslator currently in use
152:             * @deprecated Has been made obsolete by using AffineTransforms
153:             */
154:            public PointToPixelTranslator getPointToPixelTranslator() {
155:                return p;
156:            }
157:
158:            /** Returns the current CoordSystem. */
159:            public CoordSystem getCoordSystem() {
160:                return coord;
161:            }
162:
163:            /** Sets the CoordSystem which contains the AffineTransforms to
164:             * translate into pixel space.
165:             * @param cs the new CoordSystem 
166:             */
167:            public void setCoordSystem(CoordSystem cs) {
168:                coord = cs;
169:            }
170:
171:            /** Returns the currently defined AffineTransform for any y-axis.
172:             * @param axis the y-axis to be used.
173:             */
174:            public AffineTransform getTransform(int axis) {
175:                return getCoordSystem().getTransform(axis);
176:            }
177:
178:            /** Sets a RowColorModel to define the correlation of row titles and colors used for the Legend.
179:             * @param rcm the RowColorModel
180:             */
181:            public void setRowColorModel(RowColorModel rcm) {
182:                this .rcm = rcm;
183:            }
184:
185:            /** Returns the RowColorModel currently in use.
186:             * @return a RowColorModel
187:             */
188:            public RowColorModel getRowColorModel() {
189:                return rcm;
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.