Source Code Cross Referenced for Chart2D.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:        /**
024:         * An abstract class for the common methods of GraphChart2D and PieChart2D.
025:         * These are methods for handling the Chart2DProperties object and the LegendProperties object.
026:         * Changes through its set methods are updated upon next repaint() or getImage() calls.
027:         */
028:        public abstract class Chart2D extends Object2D {
029:
030:            private Chart2DProperties chart2DProps;
031:            private LegendProperties legendProps;
032:            private boolean needsUpdate;
033:
034:            /**
035:             * Creates a Chart2D object with its defaults.
036:             * A Chart2DProperties object must be set for this object before it is used.
037:             * An LegendProperties object must be set for this object before it is used.
038:             */
039:            public Chart2D() {
040:                needsUpdate = true;
041:            }
042:
043:            /**
044:             * Sets the Chart2DProperties for this Chart2D.
045:             * @param props The Chart2DProperties.
046:             */
047:            public final void setChart2DProperties(Chart2DProperties props) {
048:
049:                needsUpdate = true;
050:                props.addChart2D(this );
051:                if (chart2DProps != null)
052:                    chart2DProps.removeChart2D(this );
053:                chart2DProps = props;
054:            }
055:
056:            /**
057:             * Sets the LegendProperties for this Chart2D.
058:             * @param props The LegendProperties.
059:             */
060:            public final void setLegendProperties(LegendProperties props) {
061:
062:                needsUpdate = true;
063:                props.addChart2D(this );
064:                if (legendProps != null)
065:                    legendProps.removeChart2D(this );
066:                legendProps = props;
067:            }
068:
069:            /**
070:             * Gets the Chart2DProperties for this Chart2D.
071:             * @return The Chart2DProperties.
072:             */
073:            public final Chart2DProperties getChart2DProperties() {
074:                return chart2DProps;
075:            }
076:
077:            /**
078:             * Gets the LegendProperties for this Chart2D.
079:             * @return The LegendProperties.
080:             */
081:            public final LegendProperties getLegendProperties() {
082:                return legendProps;
083:            }
084:
085:            /**
086:             * Gets whether this object needs to be updated.
087:             * @return If true then needs update.
088:             */
089:            final boolean getNeedsUpdateChart2D() {
090:                return (needsUpdate || getNeedsUpdateObject2D()
091:                        || chart2DProps.getChart2DNeedsUpdate(this ) || legendProps
092:                        .getChart2DNeedsUpdate(this ));
093:            }
094:
095:            /**
096:             * Validates the properties of this object.
097:             * If debug is true then prints a messages indicating whether each property is valid.
098:             * Returns true if all the properties were valid and false otherwise.
099:             * @param debug If true then will print status messages.
100:             * @return If true then valid.
101:             */
102:            final boolean validateChart2D(boolean debug) {
103:
104:                if (debug)
105:                    System.out.println("Validating Chart2D");
106:
107:                boolean valid = true;
108:
109:                if (!validateObject2D(debug))
110:                    valid = false;
111:
112:                if (chart2DProps == null) {
113:                    valid = false;
114:                    if (debug)
115:                        System.out.println("Chart2DProperties is null");
116:                } else if (!chart2DProps.validate(debug))
117:                    valid = false;
118:
119:                if (legendProps == null) {
120:                    valid = false;
121:                    if (debug)
122:                        System.out.println("LegendProperties is null");
123:                } else if (!legendProps.validate(debug))
124:                    valid = false;
125:
126:                if (debug) {
127:                    if (valid)
128:                        System.out.println("Chart2D was valid");
129:                    else
130:                        System.out.println("Chart2D was invalid");
131:                }
132:
133:                return valid;
134:            }
135:
136:            /**
137:             * Updates this object with the settings from the properties objects.
138:             */
139:            final void updateChart2D() {
140:
141:                if (getNeedsUpdateChart2D()) {
142:
143:                    needsUpdate = false;
144:
145:                    updateObject2D();
146:
147:                    chart2DProps.updateChart2D(this );
148:                    legendProps.updateChart2D(this );
149:
150:                    ChartArea chart = (ChartArea) getObjectArea();
151:                    LegendArea legend = chart.getLegend();
152:
153:                    chart.setLabelsPrecisionNum(chart2DProps
154:                            .getChartDataLabelsPrecision());
155:                    chart.setBetweenChartAndLegendGapExistence(chart2DProps
156:                            .getChartBetweenChartAndLegendGapExistence());
157:                    chart
158:                            .setBetweenChartAndLegendGapThicknessModel(chart2DProps
159:                                    .getChartBetweenChartAndLegendGapThicknessModel());
160:
161:                    chart.setLegendExistence(legendProps.getLegendExistence());
162:                    legend.setBorderExistence(legendProps
163:                            .getLegendBorderExistence());
164:                    legend.setBorderThicknessModel(legendProps
165:                            .getLegendBorderThicknessModel());
166:                    legend.setBorderColor(legendProps.getLegendBorderColor());
167:                    legend.setGapExistence(legendProps.getLegendGapExistence());
168:                    legend.setGapThicknessModel(legendProps
169:                            .getLegendGapThicknessModel());
170:                    legend.setBackgroundExistence(legendProps
171:                            .getLegendBackgroundExistence());
172:                    legend.setBackgroundColor(legendProps
173:                            .getLegendBackgroundColor());
174:                    legend.setLabels(legendProps.getLegendLabelsTexts());
175:                    legend.setFontPointModel(legendProps
176:                            .getLegendLabelsFontPointModel());
177:                    legend.setFontName(legendProps.getLegendLabelsFontName());
178:                    legend.setFontColor(legendProps.getLegendLabelsFontColor());
179:                    legend.setFontStyle(legendProps.getLegendLabelsFontStyle());
180:                    legend.setBetweenBulletsGapExistence(legendProps
181:                            .getLegendBetweenLabelsOrBulletsGapExistence());
182:                    legend
183:                            .setBetweenBulletsGapThicknessModel(legendProps
184:                                    .getLegendBetweenLabelsOrBulletsGapThicknessModel());
185:                    legend.setBetweenLabelsGapExistence(legendProps
186:                            .getLegendBetweenLabelsOrBulletsGapExistence());
187:                    legend
188:                            .setBetweenLabelsGapThicknessModel(legendProps
189:                                    .getLegendBetweenLabelsOrBulletsGapThicknessModel());
190:                    legend.setBetweenBulletsAndLabelsGapExistence(legendProps
191:                            .getLegendBetweenLabelsAndBulletsGapExistence());
192:                    legend
193:                            .setBetweenBulletsAndLabelsGapThicknessModel(legendProps
194:                                    .getLegendBetweenLabelsAndBulletsGapThicknessModel());
195:                    legend.setBulletsOutline(legendProps
196:                            .getLegendBulletsOutlineExistence());
197:                    legend.setBulletsOutlineColor(legendProps
198:                            .getLegendBulletsOutlineColor());
199:                    legend.setBulletsSizeModel(legendProps
200:                            .getLegendBulletsSizeModel());
201:                }
202:            }
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.