Source Code Cross Referenced for PieLabelRecord.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-2007, 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:         * PieLabelRecord.java
029:         * -------------------
030:         * (C) Copyright 2004, 2007, by Object Refinery Limited and Contributors.
031:         *
032:         * Original Author:  David Gilbert (for Object Refinery Limited);
033:         * Contributor(s):   -;
034:         *
035:         * $Id: PieLabelRecord.java,v 1.2.2.2 2007/06/14 15:04:21 mungady Exp $
036:         *
037:         * Changes
038:         * -------
039:         * 08-Mar-2004 : Version 1 (DG);
040:         * 14-Jun-2007 : Implemented Serializable, updated API docs (DG);
041:         *
042:         */
043:
044:        package org.jfree.chart.plot;
045:
046:        import java.io.Serializable;
047:
048:        import org.jfree.text.TextBox;
049:
050:        /**
051:         * A structure that retains information about the label for a section in a pie 
052:         * chart.
053:         */
054:        public class PieLabelRecord implements  Comparable, Serializable {
055:
056:            /** The section key. */
057:            private Comparable key;
058:
059:            /** The angle of the centre of the section (in radians). */
060:            private double angle;
061:
062:            /** The base y-coordinate. */
063:            private double baseY;
064:
065:            /** The allocated y-coordinate. */
066:            private double allocatedY;
067:
068:            /** The label. */
069:            private TextBox label;
070:
071:            /** The label height. */
072:            private double labelHeight;
073:
074:            /** The gap. */
075:            private double gap;
076:
077:            /** The link percent. */
078:            private double linkPercent;
079:
080:            /**
081:             * Creates a new record.
082:             * 
083:             * @param key  the section key.
084:             * @param angle  the angle to the middle of the section (in radians).
085:             * @param baseY  the base y-coordinate.
086:             * @param label  the section label.
087:             * @param labelHeight  the label height (in Java2D units).
088:             * @param gap  the offset to the left.
089:             * @param linkPercent  the link percent.
090:             */
091:            public PieLabelRecord(Comparable key, double angle, double baseY,
092:                    TextBox label, double labelHeight, double gap,
093:                    double linkPercent) {
094:                this .key = key;
095:                this .angle = angle;
096:                this .baseY = baseY;
097:                this .allocatedY = baseY;
098:                this .label = label;
099:                this .labelHeight = labelHeight;
100:                this .gap = gap;
101:                this .linkPercent = linkPercent;
102:            }
103:
104:            /**
105:             * Returns the base y-coordinate.  This is where the label will appear if 
106:             * there is no overlapping of labels.
107:             * 
108:             * @return The base y-coordinate.
109:             */
110:            public double getBaseY() {
111:                return this .baseY;
112:            }
113:
114:            /**
115:             * Sets the base y-coordinate.
116:             * 
117:             * @param base  the base y-coordinate.
118:             */
119:            public void setBaseY(double base) {
120:                this .baseY = base;
121:            }
122:
123:            /**
124:             * Returns the lower bound of the label.
125:             * 
126:             * @return The lower bound.
127:             */
128:            public double getLowerY() {
129:                return this .allocatedY - this .labelHeight / 2.0;
130:            }
131:
132:            /**
133:             * Returns the upper bound of the label.
134:             * 
135:             * @return The upper bound.
136:             */
137:            public double getUpperY() {
138:                return this .allocatedY + this .labelHeight / 2.0;
139:            }
140:
141:            /**
142:             * Returns the angle of the middle of the section, in radians.
143:             * 
144:             * @return The angle, in radians.
145:             */
146:            public double getAngle() {
147:                return this .angle;
148:            }
149:
150:            /**
151:             * Returns the key for the section that the label applies to.
152:             * 
153:             * @return The key.
154:             */
155:            public Comparable getKey() {
156:                return this .key;
157:            }
158:
159:            /**
160:             * Returns the label.
161:             * 
162:             * @return The label.
163:             */
164:            public TextBox getLabel() {
165:                return this .label;
166:            }
167:
168:            /**
169:             * Returns the label height (you could derive this from the label itself,
170:             * but we cache the value so it can be retrieved quickly).
171:             * 
172:             * @return The label height (in Java2D units).
173:             */
174:            public double getLabelHeight() {
175:                return this .labelHeight;
176:            }
177:
178:            /**
179:             * Returns the allocated y-coordinate.
180:             * 
181:             * @return The allocated y-coordinate.
182:             */
183:            public double getAllocatedY() {
184:                return this .allocatedY;
185:            }
186:
187:            /**
188:             * Sets the allocated y-coordinate.
189:             * 
190:             * @param y  the y-coordinate.
191:             */
192:            public void setAllocatedY(double y) {
193:                this .allocatedY = y;
194:            }
195:
196:            /**
197:             * Returns the gap.
198:             * 
199:             * @return The gap.
200:             */
201:            public double getGap() {
202:                return this .gap;
203:            }
204:
205:            /**
206:             * Returns the link percent.
207:             * 
208:             * @return The link percent.
209:             */
210:            public double getLinkPercent() {
211:                return this .linkPercent;
212:            }
213:
214:            /**
215:             * Compares this object to an arbitrary object.
216:             * 
217:             * @param obj  the object to compare against.
218:             * 
219:             * @return An integer that specifies the relative order of the two objects.
220:             */
221:            public int compareTo(Object obj) {
222:                int result = 0;
223:                if (obj instanceof  PieLabelRecord) {
224:                    PieLabelRecord plr = (PieLabelRecord) obj;
225:                    if (this .baseY < plr.baseY) {
226:                        result = -1;
227:                    } else if (this .baseY > plr.baseY) {
228:                        result = 1;
229:                    }
230:                }
231:                return result;
232:            }
233:
234:            /**
235:             * Returns a string describing the object.  This is used for debugging only.
236:             * 
237:             * @return A string.
238:             */
239:            public String toString() {
240:                return this .baseY + ", " + this.key.toString();
241:            }
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.