Source Code Cross Referenced for AbstractChartDataModel.java in  » Chart » charting-0.94 » de » progra » charting » model » 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 » charting 0.94 » de.progra.charting.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:            JOpenChart Java Charting Library and Toolkit
003:            Copyright (C) 2001  Sebastian Müller
004:            http://jopenchart.sourceforge.net
005:
006:            This library is free software; you can redistribute it and/or
007:            modify it under the terms of the GNU Lesser General Public
008:            License as published by the Free Software Foundation; either
009:            version 2.1 of the License, or (at your option) any later version.
010:
011:            This library is distributed in the hope that it will be useful,
012:            but WITHOUT ANY WARRANTY; without even the implied warranty of
013:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:            Lesser General Public License for more details.
015:
016:            You should have received a copy of the GNU Lesser General Public
017:            License along with this library; if not, write to the Free Software
018:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:
020:            AbstractChartDataModel.java
021:            Created on 28. Juni 2001, 18:58
022:         */
023:
024:        package de.progra.charting.model;
025:
026:        import de.progra.charting.event.ChartDataModelListener;
027:        import de.progra.charting.event.ChartDataModelEvent;
028:        import javax.swing.event.EventListenerList;
029:        import de.progra.charting.CoordSystem;
030:        import java.util.ArrayList;
031:        import java.util.Arrays;
032:        import java.util.TreeSet;
033:        import java.util.Set;
034:        import java.util.HashMap;
035:
036:        /**
037:         * This class implements the event-handling methods for a chart model.
038:         * @author  mueller
039:         * @version 1.0
040:         */
041:        public abstract class AbstractChartDataModel implements  ChartDataModel {
042:
043:            /** The listener list. */
044:            protected EventListenerList listener = new EventListenerList();
045:
046:            /** Flag defining the automatic scaling of max and min values. */
047:            protected boolean autoscale = false;
048:
049:            /** Flag defining the manual scaling of max and min values. */
050:            protected boolean manualscale = false;
051:
052:            /** Maximum and minimum column values to be displayed. */
053:            protected double maxcolumn, mincolumn;
054:
055:            /** Maximum and minimum values to be displayed. */
056:            protected Number maxvalue, minvalue;
057:
058:            /** Creates new AbstractChartDataModel */
059:            public AbstractChartDataModel() {
060:            }
061:
062:            /** Removes a ChartDataModelListener.
063:             * @param l the ChartDataListener
064:             */
065:            public void removeChartDataModelListener(ChartDataModelListener l) {
066:                listener.remove(ChartDataModelListener.class, l);
067:            }
068:
069:            /** Adds a ChartDataModelListener.
070:             * @param l the ChartDataModelListener
071:             */
072:            public void addChartDataModelListener(ChartDataModelListener l) {
073:                listener.add(ChartDataModelListener.class, l);
074:            }
075:
076:            /** Determines if the column values are numeric.
077:             * @return <CODE>false</CODE> per default
078:             */
079:            public boolean isColumnNumeric() {
080:                return false;
081:            }
082:
083:            /** Provides an empty implementation for not-editable DataModels.
084:             * @param set the DataSet in which the value should be set
085:             * @param index the index in the DataSet where the value should be stored
086:             * @param value the value object
087:             */
088:            public void setValueAt(int set, int index, Object value) {
089:            }
090:
091:            /** Returns the class of the column values.
092:             * @return <CODE>Object.class</CODE> per default
093:             */
094:            public Class getColumnClass() {
095:                return Object.class;
096:            }
097:
098:            /** Promotes a new ChartDataModelEvent.
099:             * @param src the source object of the event.
100:             */
101:            public void fireChartDataModelChangedEvent(Object src) {
102:                ChartDataModelEvent e = new ChartDataModelEvent(src);
103:                Object[] ls = listener.getListenerList();
104:                for (int i = (ls.length - 2); i >= 0; i -= 2) {
105:                    if (ls[i] == ChartDataModelListener.class) {
106:                        ((ChartDataModelListener) ls[i + 1])
107:                                .chartDataChanged(e);
108:                    }
109:                }
110:            }
111:
112:            /** Returns the Axis Binding for a specific DataSet, ie the Axis on
113:             * which the DataSet should be plotted
114:             * @param set the DataSet whose Axis binding should be determined
115:             * @return <code>DataSet.FIRST_YAXIS</code> by default.
116:             */
117:            public int getAxisBinding(int set) {
118:                return CoordSystem.FIRST_YAXIS;
119:            }
120:
121:            /** Provides a default empty implementation.
122:             * @param set the DataSet
123:             * @param axis the Axis binding
124:             */
125:            public void setAxisBinding(int set, int axis) {
126:            }
127:
128:            public void setAutoScale(boolean b) {
129:                autoscale = b;
130:            }
131:
132:            public boolean isAutoScale() {
133:                return autoscale;
134:            }
135:
136:            /** Enables the manual axis scaling. Set the desired
137:             * maximum and minimum values using the setMaximum...Value
138:             * functions.
139:             */
140:            public void setManualScale(boolean b) {
141:                manualscale = b;
142:            }
143:
144:            /** Returns true if the manual axis scaling is enabled. This overrides
145:             * the enabled automatic axis scaling.
146:             */
147:            public boolean isManualScale() {
148:                return manualscale;
149:            }
150:
151:            /** Sets the maximum x-axis value. */
152:            public void setMaximumColumnValue(double d) {
153:                maxcolumn = d;
154:            }
155:
156:            /** Sets the minimum x-axis value. */
157:            public void setMinimumColumnValue(double d) {
158:                mincolumn = d;
159:            }
160:
161:            /** Sets the maximum y-axis value. */
162:            public void setMaximumValue(Number n) {
163:                maxvalue = n;
164:            }
165:
166:            /** Sets the minimum y-axis value. */
167:            public void setMinimumValue(Number n) {
168:                minvalue = n;
169:            }
170:
171:            public double getManualMaximumColumnValue() {
172:                return maxcolumn;
173:            }
174:
175:            public double getManualMinimumColumnValue() {
176:                return mincolumn;
177:            }
178:
179:            public Number getManualMaximumValue() {
180:                return maxvalue;
181:            }
182:
183:            public Number getManualMinimumValue() {
184:                return minvalue;
185:            }
186:
187:            /** Returns the title of the DataSet.
188:             * @param set the DataSet identifier
189:             * @return the the number of
190:             * the DataSet per default.
191:             */
192:            public String getDataSetName(int set) {
193:                return "Dataset " + set;
194:            }
195:
196:            /** Compares this ChartDataModel with another object. 
197:             * @param o the object to compare with
198:             * @return true, if o is an AbstractChartDataModel, the number of
199:             * DataSets is equal and all DataSet names and column values are equal.
200:             */
201:            public boolean equals(Object o) {
202:                if (o == null)
203:                    return false;
204:                try {
205:                    AbstractChartDataModel model = (AbstractChartDataModel) o;
206:
207:                    if (getDataSetNumber() != model.getDataSetNumber()) {
208:                        return false;
209:                    }
210:
211:                    for (int i = 0; i < getDataSetNumber(); i++) {
212:                        if (!getDataSetName(i).equals(model.getDataSetName(i))) {
213:                            return false;
214:                        }
215:
216:                        for (int j = 0; j < getDataSetLength(j); j++) {
217:                            if (!getColumnValueAt(j).equals(
218:                                    model.getColumnValueAt(j))) {
219:                                return false;
220:                            }
221:                        }
222:                    }
223:                } catch (Exception e) {
224:                    return false;
225:                }
226:
227:                return true;
228:            }
229:
230:            protected abstract TreeSet getOrderedValues(int axis);
231:
232:            protected abstract double getFirstColumnValue();
233:
234:            protected abstract double getLastColumnValue();
235:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.