Source Code Cross Referenced for ChartRenderingInfo.java in  » Chart » jfreechart » org » jfree » chart » 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 » jfreechart » org.jfree.chart 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ===========================================================
002:         * JFreeChart : a free chart library for the Java(tm) platform
003:         * ===========================================================
004:         *
005:         * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors.
006:         *
007:         * Project Info:  http://www.jfree.org/jfreechart/index.html
008:         *
009:         * This library is free software; you can redistribute it and/or modify it 
010:         * under the terms of the GNU Lesser General Public License as published by 
011:         * the Free Software Foundation; either version 2.1 of the License, or 
012:         * (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful, but 
015:         * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
016:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
017:         * License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library; if not, write to the Free Software
021:         * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
022:         * USA.  
023:         *
024:         * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
025:         * in the United States and other countries.]
026:         *
027:         * -----------------------
028:         * ChartRenderingInfo.java
029:         * -----------------------
030:         * (C) Copyright 2002-2006, by Object Refinery Limited.
031:         *
032:         * Original Author:  David Gilbert (for Object Refinery Limited);
033:         * Contributor(s):   -;
034:         *
035:         * $Id: ChartRenderingInfo.java,v 1.4.2.4 2006/12/01 11:37:03 mungady Exp $
036:         *
037:         * Changes
038:         * -------
039:         * 22-Jan-2002 : Version 1 (DG);
040:         * 05-Feb-2002 : Added a new constructor, completed Javadoc comments (DG);
041:         * 05-Mar-2002 : Added a clear() method (DG);
042:         * 23-May-2002 : Renamed DrawInfo --> ChartRenderingInfo (DG);
043:         * 26-Sep-2002 : Fixed errors reported by Checkstyle (DG);
044:         * 17-Sep-2003 : Added PlotRenderingInfo (DG);
045:         * 01-Nov-2005 : Updated equals() method (DG);
046:         * 30-Nov-2005 : Removed get/setPlotArea() (DG);
047:         * ------------- JFREECHART 1.0.x ---------------------------------------------
048:         * 01-Dec-2006 : Fixed equals() and clone() (DG);
049:         *
050:         */
051:
052:        package org.jfree.chart;
053:
054:        import java.awt.geom.Rectangle2D;
055:        import java.io.IOException;
056:        import java.io.ObjectInputStream;
057:        import java.io.ObjectOutputStream;
058:        import java.io.Serializable;
059:
060:        import org.jfree.chart.entity.EntityCollection;
061:        import org.jfree.chart.entity.StandardEntityCollection;
062:        import org.jfree.chart.plot.PlotRenderingInfo;
063:        import org.jfree.io.SerialUtilities;
064:        import org.jfree.util.ObjectUtilities;
065:        import org.jfree.util.PublicCloneable;
066:
067:        /**
068:         * A structure for storing rendering information from one call to the
069:         * JFreeChart.draw() method.
070:         * <P>
071:         * An instance of the {@link JFreeChart} class can draw itself within an 
072:         * arbitrary rectangle on any <code>Graphics2D</code>.  It is assumed that 
073:         * client code will sometimes render the same chart in more than one view, so 
074:         * the {@link JFreeChart} instance does not retain any information about its 
075:         * rendered dimensions.  This information can be useful sometimes, so you have 
076:         * the option to collect the information at each call to 
077:         * <code>JFreeChart.draw()</code>, by passing an instance of this
078:         * <code>ChartRenderingInfo</code> class.
079:         */
080:        public class ChartRenderingInfo implements  Cloneable, Serializable {
081:
082:            /** For serialization. */
083:            private static final long serialVersionUID = 2751952018173406822L;
084:
085:            /** The area in which the chart is drawn. */
086:            private transient Rectangle2D chartArea;
087:
088:            /** Rendering info for the chart's plot (and subplots, if any). */
089:            private PlotRenderingInfo plotInfo;
090:
091:            /** 
092:             * Storage for the chart entities.  Since retaining entity information for 
093:             * charts with a large number of data points consumes a lot of memory, it 
094:             * is intended that you can set this to <code>null</code> to prevent the 
095:             * information being collected.
096:             */
097:            private EntityCollection entities;
098:
099:            /**
100:             * Constructs a new ChartRenderingInfo structure that can be used to 
101:             * collect information about the dimensions of a rendered chart.
102:             */
103:            public ChartRenderingInfo() {
104:                this (new StandardEntityCollection());
105:            }
106:
107:            /**
108:             * Constructs a new instance. If an entity collection is supplied, it will 
109:             * be populated with information about the entities in a chart.  If it is 
110:             * <code>null</code>, no entity information (including tool tips) will
111:             * be collected.
112:             *
113:             * @param entities  an entity collection (<code>null</code> permitted).
114:             */
115:            public ChartRenderingInfo(EntityCollection entities) {
116:                this .chartArea = new Rectangle2D.Double();
117:                this .plotInfo = new PlotRenderingInfo(this );
118:                this .entities = entities;
119:            }
120:
121:            /**
122:             * Returns the area in which the chart was drawn.
123:             *
124:             * @return The area in which the chart was drawn.
125:             * 
126:             * @see #setChartArea(Rectangle2D)
127:             */
128:            public Rectangle2D getChartArea() {
129:                return this .chartArea;
130:            }
131:
132:            /**
133:             * Sets the area in which the chart was drawn.
134:             *
135:             * @param area  the chart area.
136:             * 
137:             * @see #getChartArea()
138:             */
139:            public void setChartArea(Rectangle2D area) {
140:                this .chartArea.setRect(area);
141:            }
142:
143:            /**
144:             * Returns the collection of entities maintained by this instance.
145:             *
146:             * @return The entity collection (possibly <code>null</code>).
147:             * 
148:             * @see #setEntityCollection(EntityCollection)
149:             */
150:            public EntityCollection getEntityCollection() {
151:                return this .entities;
152:            }
153:
154:            /**
155:             * Sets the entity collection.
156:             *
157:             * @param entities  the entity collection (<code>null</code> permitted).
158:             * 
159:             * @see #getEntityCollection()
160:             */
161:            public void setEntityCollection(EntityCollection entities) {
162:                this .entities = entities;
163:            }
164:
165:            /**
166:             * Clears the information recorded by this object.
167:             */
168:            public void clear() {
169:                this .chartArea.setRect(0.0, 0.0, 0.0, 0.0);
170:                this .plotInfo = new PlotRenderingInfo(this );
171:                if (this .entities != null) {
172:                    this .entities.clear();
173:                }
174:            }
175:
176:            /**
177:             * Returns the rendering info for the chart's plot.
178:             * 
179:             * @return The rendering info for the plot.
180:             */
181:            public PlotRenderingInfo getPlotInfo() {
182:                return this .plotInfo;
183:            }
184:
185:            /**
186:             * Tests this object for equality with an arbitrary object.
187:             * 
188:             * @param obj  the object to test against (<code>null</code> permitted).
189:             * 
190:             * @return A boolean.
191:             */
192:            public boolean equals(Object obj) {
193:                if (obj == this ) {
194:                    return true;
195:                }
196:                if (!(obj instanceof  ChartRenderingInfo)) {
197:                    return false;
198:                }
199:                ChartRenderingInfo that = (ChartRenderingInfo) obj;
200:                if (!ObjectUtilities.equal(this .chartArea, that.chartArea)) {
201:                    return false;
202:                }
203:                if (!ObjectUtilities.equal(this .plotInfo, that.plotInfo)) {
204:                    return false;
205:                }
206:                if (!ObjectUtilities.equal(this .entities, that.entities)) {
207:                    return false;
208:                }
209:                return true;
210:            }
211:
212:            /**
213:             * Returns a clone of this object.
214:             * 
215:             * @return A clone.
216:             * 
217:             * @throws CloneNotSupportedException if the object cannot be cloned.
218:             */
219:            public Object clone() throws CloneNotSupportedException {
220:                ChartRenderingInfo clone = (ChartRenderingInfo) super .clone();
221:                if (this .chartArea != null) {
222:                    clone.chartArea = (Rectangle2D) this .chartArea.clone();
223:                }
224:                if (this .entities instanceof  PublicCloneable) {
225:                    PublicCloneable pc = (PublicCloneable) this .entities;
226:                    clone.entities = (EntityCollection) pc.clone();
227:                }
228:                return clone;
229:            }
230:
231:            /**
232:             * Provides serialization support.
233:             *
234:             * @param stream  the output stream.
235:             *
236:             * @throws IOException  if there is an I/O error.
237:             */
238:            private void writeObject(ObjectOutputStream stream)
239:                    throws IOException {
240:                stream.defaultWriteObject();
241:                SerialUtilities.writeShape(this .chartArea, stream);
242:            }
243:
244:            /**
245:             * Provides serialization support.
246:             *
247:             * @param stream  the input stream.
248:             *
249:             * @throws IOException  if there is an I/O error.
250:             * @throws ClassNotFoundException  if there is a classpath problem.
251:             */
252:            private void readObject(ObjectInputStream stream)
253:                    throws IOException, ClassNotFoundException {
254:                stream.defaultReadObject();
255:                this .chartArea = (Rectangle2D) SerialUtilities
256:                        .readShape(stream);
257:            }
258:
259:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.