Source Code Cross Referenced for MeterInterval.java in  » Chart » jfreechart » org » jfree » chart » plot » 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.plot 
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-2005, 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:         * MeterInterval.java
029:         * ------------------
030:         * (C) Copyright 2005, by Object Refinery Limited and Contributors.
031:         *
032:         * Original Author:  David Gilbert (for Object Refinery Limited);
033:         * Contributor(s):   -;
034:         *
035:         * $Id: MeterInterval.java,v 1.4.2.1 2005/10/25 20:52:07 mungady Exp $
036:         *
037:         * Changes
038:         * -------
039:         * 22-Mar-2005 : Version 1 (DG);
040:         * 29-Mar-2005 : Fixed serialization (DG);
041:         * 
042:         */
043:
044:        package org.jfree.chart.plot;
045:
046:        import java.awt.BasicStroke;
047:        import java.awt.Color;
048:        import java.awt.Paint;
049:        import java.awt.Stroke;
050:        import java.io.IOException;
051:        import java.io.ObjectInputStream;
052:        import java.io.ObjectOutputStream;
053:        import java.io.Serializable;
054:
055:        import org.jfree.data.Range;
056:        import org.jfree.io.SerialUtilities;
057:        import org.jfree.util.ObjectUtilities;
058:        import org.jfree.util.PaintUtilities;
059:
060:        /**
061:         * An interval to be highlighted on a {@link MeterPlot}.  Instances of this
062:         * class are immutable.
063:         */
064:        public class MeterInterval implements  Serializable {
065:
066:            /** For serialization. */
067:            private static final long serialVersionUID = 1530982090622488257L;
068:
069:            /** The interval label. */
070:            private String label;
071:
072:            /** The interval range. */
073:            private Range range;
074:
075:            /** The outline paint (used for the arc marking the interval). */
076:            private transient Paint outlinePaint;
077:
078:            /** The outline stroke (used for the arc marking the interval). */
079:            private transient Stroke outlineStroke;
080:
081:            /** The background paint for the interval. */
082:            private transient Paint backgroundPaint;
083:
084:            /**
085:             * Creates a new interval.
086:             * 
087:             * @param label  the label (<code>null</code> not permitted).
088:             * @param range  the range (<code>null</code> not permitted).
089:             */
090:            public MeterInterval(String label, Range range) {
091:                this (label, range, Color.yellow, new BasicStroke(2.0f), null);
092:            }
093:
094:            /**
095:             * Creates a new interval.
096:             * 
097:             * @param label  the label (<code>null</code> not permitted).
098:             * @param range  the range (<code>null</code> not permitted).
099:             * @param outlinePaint  the outline paint (<code>null</code> permitted).
100:             * @param outlineStroke  the outline stroke (<code>null</code> permitted).
101:             * @param backgroundPaint  the background paint (<code>null</code> 
102:             *                         permitted).
103:             */
104:            public MeterInterval(String label, Range range, Paint outlinePaint,
105:                    Stroke outlineStroke, Paint backgroundPaint) {
106:                if (label == null) {
107:                    throw new IllegalArgumentException("Null 'label' argument.");
108:                }
109:                if (range == null) {
110:                    throw new IllegalArgumentException("Null 'range' argument.");
111:                }
112:                this .label = label;
113:                this .range = range;
114:                this .outlinePaint = outlinePaint;
115:                this .outlineStroke = outlineStroke;
116:                this .backgroundPaint = backgroundPaint;
117:            }
118:
119:            /**
120:             * Returns the label.
121:             * 
122:             * @return The label (never <code>null</code>).
123:             */
124:            public String getLabel() {
125:                return this .label;
126:            }
127:
128:            /**
129:             * Returns the range.
130:             * 
131:             * @return The range (never <code>null</code>).
132:             */
133:            public Range getRange() {
134:                return this .range;
135:            }
136:
137:            /**
138:             * Returns the background paint.  If <code>null</code>, the background
139:             * should remain unfilled.
140:             * 
141:             * @return The background paint (possibly <code>null</code>).
142:             */
143:            public Paint getBackgroundPaint() {
144:                return this .backgroundPaint;
145:            }
146:
147:            /**
148:             * Returns the outline paint.
149:             * 
150:             * @return The outline paint (possibly <code>null</code>).
151:             */
152:            public Paint getOutlinePaint() {
153:                return this .outlinePaint;
154:            }
155:
156:            /**
157:             * Returns the outline stroke.
158:             * 
159:             * @return The outline stroke (possibly <code>null</code>).
160:             */
161:            public Stroke getOutlineStroke() {
162:                return this .outlineStroke;
163:            }
164:
165:            /**
166:             * Checks this instance for equality with an arbitrary object.
167:             * 
168:             * @param obj  the object (<code>null</code> permitted).
169:             * 
170:             * @return A boolean.
171:             */
172:            public boolean equals(Object obj) {
173:                if (obj == this ) {
174:                    return true;
175:                }
176:                if (!(obj instanceof  MeterInterval)) {
177:                    return false;
178:                }
179:                MeterInterval that = (MeterInterval) obj;
180:                if (!this .label.equals(that.label)) {
181:                    return false;
182:                }
183:                if (!this .range.equals(that.range)) {
184:                    return false;
185:                }
186:                if (!PaintUtilities.equal(this .outlinePaint, that.outlinePaint)) {
187:                    return false;
188:                }
189:                if (!ObjectUtilities.equal(this .outlineStroke,
190:                        that.outlineStroke)) {
191:                    return false;
192:                }
193:                if (!PaintUtilities.equal(this .backgroundPaint,
194:                        that.backgroundPaint)) {
195:                    return false;
196:                }
197:                return true;
198:            }
199:
200:            /**
201:             * Provides serialization support.
202:             *
203:             * @param stream  the output stream.
204:             *
205:             * @throws IOException  if there is an I/O error.
206:             */
207:            private void writeObject(ObjectOutputStream stream)
208:                    throws IOException {
209:                stream.defaultWriteObject();
210:                SerialUtilities.writePaint(this .outlinePaint, stream);
211:                SerialUtilities.writeStroke(this .outlineStroke, stream);
212:                SerialUtilities.writePaint(this .backgroundPaint, stream);
213:            }
214:
215:            /**
216:             * Provides serialization support.
217:             *
218:             * @param stream  the input stream.
219:             *
220:             * @throws IOException  if there is an I/O error.
221:             * @throws ClassNotFoundException  if there is a classpath problem.
222:             */
223:            private void readObject(ObjectInputStream stream)
224:                    throws IOException, ClassNotFoundException {
225:                stream.defaultReadObject();
226:                this.outlinePaint = SerialUtilities.readPaint(stream);
227:                this.outlineStroke = SerialUtilities.readStroke(stream);
228:                this.backgroundPaint = SerialUtilities.readPaint(stream);
229:            }
230:
231:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.