Source Code Cross Referenced for FancyDot.java in  » Chart » Chart2D_1.9.6k » net » sourceforge » chart2d » 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 » Chart2D_1.9.6k » net.sourceforge.chart2d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Chart2D, a java library for drawing two dimensional charts.
003:         * Copyright (C) 2001 Jason J. Simas
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         * Lesser General Public License for more details.
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         *
018:         * The author of this library may be contacted at:
019:         * E-mail:  jjsimas@users.sourceforge.net
020:         * Street Address:  J J Simas, 887 Tico Road, Ojai, CA 93023-3555 USA
021:         */package net.sourceforge.chart2d;
022:
023:        import java.awt.*;
024:        import java.awt.geom.*;
025:        import java.util.*;
026:
027:        /**
028:         * A circle capable of automatic gradient paint and warning region coloring.
029:         */
030:        final class FancyDot extends FancyShape {
031:
032:            private Rectangle2D.Float bounds, clipBounds;
033:            private Ellipse2D.Float dot;
034:            private FancyDot[] warningDots;
035:            private boolean needsUpdate;
036:
037:            /**
038:             * Creates a default fancy dot.
039:             */
040:            FancyDot() {
041:                needsUpdate = true;
042:            }
043:
044:            /**
045:             * Sets the bounds for this bar (specifying the size and location of the bar).
046:             * @param b The bounds.
047:             */
048:            final void setBounds(Rectangle2D.Float b) {
049:                bounds = b;
050:                needsUpdate = true;
051:            }
052:
053:            /**
054:             * Sets the clip bounds for this bar (specifying what will show).
055:             * @param b The bounds.
056:             */
057:            final void setClipBounds(Rectangle2D.Float b) {
058:                clipBounds = b;
059:                needsUpdate = true;
060:            }
061:
062:            /**
063:             * Gets the bounds for this bar (specifying the size and location of the bar).
064:             * @return The bounds.
065:             */
066:            final Rectangle2D.Float getBounds() {
067:                return bounds;
068:            }
069:
070:            /**
071:             * Gets the clip bounds for this bar (specifying what will show).
072:             * @return The bounds.
073:             */
074:            final Rectangle2D.Float getClipBounds() {
075:                return clipBounds;
076:            }
077:
078:            /**
079:             * Paints the dot on the Graphics2D object after calling update.
080:             * @param g2D The Graphics2D object.
081:             */
082:            final void paint(Graphics2D g2D) {
083:
084:                update();
085:
086:                Paint oldPaint = g2D.getPaint();
087:                g2D.setPaint(getPaint());
088:
089:                Shape oldClip = g2D.getClip();
090:                java.awt.geom.Area clipArea = new java.awt.geom.Area(clipBounds);
091:                clipArea.intersect(new java.awt.geom.Area(oldClip));
092:                g2D.setClip(clipArea);
093:
094:                g2D.fill(dot);
095:
096:                if (getOutlineExistence() && bounds.width > 2f
097:                        && bounds.height > 2f) {
098:                    g2D.setPaint(getOutlinePaint());
099:                    g2D.draw(dot);
100:                }
101:
102:                g2D.setPaint(oldPaint);
103:                g2D.setClip(oldClip);
104:
105:                if (getWarningRegions() != null) {
106:                    for (int i = 0; i < warningDots.length; ++i)
107:                        warningDots[i].paint(g2D);
108:                }
109:            }
110:
111:            /**
112:             * Updates the FancyDot.
113:             */
114:            final void update() {
115:
116:                super .update();
117:
118:                if (needsUpdate) {
119:
120:                    dot = new Ellipse2D.Float(bounds.x, bounds.y, bounds.width,
121:                            bounds.height);
122:
123:                    if (getWarningRegions() != null) {
124:
125:                        warningDots = new FancyDot[getWarningRegions().size()];
126:                        for (int i = 0; i < warningDots.length; ++i) {
127:
128:                            FancyDot warningDot = new FancyDot();
129:                            warningDot.setBounds(bounds);
130:                            warningDot.setWarningRegions(null);
131:                            warningDot.setLightBounds(getLightBounds());
132:                            warningDot.setLightSource(getLightSource());
133:                            warningDot
134:                                    .setOutlineExistence(getOutlineExistence());
135:                            warningDot.setOutlineColor(getOutlineColor());
136:                            warningDot.setType(getType());
137:                            warningDot.setGraphBounds(getGraphBounds());
138:                            WarningRegion warningRegion = (WarningRegion) getWarningRegions()
139:                                    .get(i);
140:                            Rectangle2D tempRect2D = bounds
141:                                    .createIntersection(warningRegion
142:                                            .getBackgroundBounds());
143:                            Rectangle2D.Float clipBoundsWR = new Rectangle2D.Float();
144:                            clipBoundsWR.setRect(tempRect2D);
145:                            warningDot.setClipBounds(clipBoundsWR);
146:                            warningDot.setColor(warningRegion
147:                                    .getComponentColor());
148:                            warningDots[i] = warningDot;
149:                        }
150:                    }
151:                    needsUpdate = false;
152:                }
153:            }
154:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.