Source Code Cross Referenced for PlotDefinition.java in  » Chart » cewolf-1.0 » de » laures » cewolf » taglib » 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 » cewolf 1.0 » de.laures.cewolf.taglib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ================================================================
002:         * Cewolf : Chart enabling Web Objects Framework
003:         * ================================================================
004:         *
005:         * Project Info:  http://cewolf.sourceforge.net
006:         * Project Lead:  Guido Laures (guido@laures.de);
007:         *
008:         * (C) Copyright 2002, by Guido Laures and contributers
009:         *
010:         * This library is free software; you can redistribute it and/or modify it under the terms
011:         * of the GNU Lesser General Public License as published by the Free Software Foundation;
012:         * either version 2.1 of
013:         * the License, or (at your option) any later version.
014:         *
015:         * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
016:         * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
017:         * See the GNU Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public License along with this
020:         * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
021:         * Boston, MA 02111-1307, USA.
022:         */
023:        package de.laures.cewolf.taglib;
024:
025:        import java.io.Serializable;
026:        import java.util.Map;
027:
028:        import org.apache.commons.logging.Log;
029:        import org.apache.commons.logging.LogFactory;
030:        import org.jfree.chart.plot.CategoryPlot;
031:        import org.jfree.chart.plot.DrawingSupplier;
032:        import org.jfree.chart.plot.Plot;
033:        import org.jfree.chart.plot.XYPlot;
034:        import org.jfree.chart.renderer.AbstractRenderer;
035:        import org.jfree.chart.renderer.category.CategoryItemRenderer;
036:        import org.jfree.chart.renderer.xy.XYItemRenderer;
037:        import org.jfree.data.category.CategoryDataset;
038:        import org.jfree.data.general.Dataset;
039:        import org.jfree.data.xy.IntervalXYDataset;
040:        import org.jfree.data.xy.OHLCDataset;
041:        import org.jfree.data.xy.XYDataset;
042:
043:        import de.laures.cewolf.ChartValidationException;
044:        import de.laures.cewolf.DatasetProduceException;
045:        import de.laures.cewolf.DatasetProducer;
046:
047:        /**
048:         * (sub) Plot definition for combined/overlaid charts.
049:         * 
050:         * @author Chris McCann
051:         * @author Guido Laures
052:         */
053:        public class PlotDefinition implements  DataAware, Serializable,
054:                TaglibConstants, PlotConstants {
055:
056:            private transient Log log = LogFactory.getLog(getClass());
057:
058:            private String type;
059:            private String xAxisLabel; // [tb]
060:            private String yAxisLabel; // [tb]
061:
062:            private DataContainer dataAware = new DataContainer();
063:            private transient Plot plot;
064:            private transient DrawingSupplier drawingSupplier = null;
065:
066:            public Plot getPlot(int chartType) throws DatasetProduceException,
067:                    ChartValidationException {
068:                log.debug("Plot.getPlot: chartType: " + chartType);
069:                if (plot == null) {
070:                    int rendererIndex = PlotTypes.getRendererIndex(type);
071:
072:                    Dataset data = (Dataset) getDataset();
073:                    log.debug("Plot.getPlot: data name: "
074:                            + data.getClass().getName());
075:                    AbstractRenderer rend = PlotTypes
076:                            .getRenderer(rendererIndex);
077:                    log.debug("Plot.getPlot: rendererIndex: " + rendererIndex);
078:                    if (chartType == ChartConstants.OVERLAY_XY
079:                            || chartType == ChartConstants.COMBINED_XY) {
080:                        switch (rendererIndex) {
081:                        case XY_AREA:
082:                        case XY_LINE:
083:                        case XY_SHAPES_AND_LINES:
084:                        case SCATTER:
085:                        case STEP:
086:                            check(data, XYDataset.class, rendererIndex);
087:                            plot = new XYPlot((XYDataset) data, null, null,
088:                                    (XYItemRenderer) rend);
089:                            break;
090:                        case XY_VERTICAL_BAR:
091:                            check(data, IntervalXYDataset.class, rendererIndex);
092:                            plot = new XYPlot((IntervalXYDataset) data, null,
093:                                    null, (XYItemRenderer) rend);
094:                            break;
095:                        case CANDLESTICK:
096:                        case HIGH_LOW:
097:                            check(data, OHLCDataset.class, rendererIndex);
098:                            plot = new XYPlot((OHLCDataset) data, null, null,
099:                                    (XYItemRenderer) rend);
100:                            break;
101:                        //case SIGNAL :
102:                        //	check(data, SignalsDataset.class, rendererIndex);
103:                        //	plot = new XYPlot((SignalsDataset) data, null, null, (XYItemRenderer) rend);
104:                        default:
105:                            throw new AttributeValidationException(chartType
106:                                    + ".type", type);
107:                        }
108:                    } else if (chartType == ChartConstants.OVERLAY_CATEGORY) {
109:                        switch (rendererIndex) {
110:                        case AREA:
111:                        case VERTICAL_BAR:
112:                        case LINE:
113:                        case SHAPES_AND_LINES:
114:                            check(data, CategoryDataset.class, rendererIndex);
115:                            plot = new CategoryPlot((CategoryDataset) data,
116:                                    null, null, (CategoryItemRenderer) rend);
117:                            break;
118:                        default:
119:                            throw new AttributeValidationException(chartType
120:                                    + ".type", type);
121:                        }
122:                    }
123:                }
124:                plot.setDrawingSupplier(drawingSupplier);
125:                return plot;
126:            }
127:
128:            public Object getDataset() throws DatasetProduceException {
129:                return dataAware.getDataset();
130:            }
131:
132:            /**
133:             * Gets the y-axis label. [tb]
134:             *
135:             * @return the y-axis label.
136:             */
137:            public String getXaxislabel() {
138:                return xAxisLabel;
139:            }
140:
141:            /**
142:             * Sets the x-axis label [tb]
143:             *
144:             * @return the x-axis label
145:             */
146:            public String getYaxislabel() {
147:                return yAxisLabel;
148:            }
149:
150:            /**
151:             * Sets the x-axis label [tb]
152:             *
153:             * @param xAxisLabel New value of property xAxisLabel.
154:             */
155:            public void setXaxislabel(String xAxisLabel) {
156:                this .xAxisLabel = xAxisLabel;
157:            }
158:
159:            /**
160:             * Sets the y-axis label [tb]
161:             *
162:             * @param yAxisLabel New value of property yAxisLabel.
163:             */
164:            public void setYaxislabel(String yAxisLabel) {
165:                this .yAxisLabel = yAxisLabel;
166:            }
167:
168:            /**
169:             * Sets the type.
170:             * @param type The type to set
171:             */
172:            public void setType(String type) {
173:                this .type = type;
174:            }
175:
176:            /**
177:             * Gets the type.
178:             * @return type of plot as a String
179:             */
180:            public String getType() {
181:                return this .type;
182:            }
183:
184:            public void check(Dataset data, Class clazz, int plotType)
185:                    throws IncompatibleDatasetException {
186:                if (!clazz.isInstance(data)) {
187:                    throw new IncompatibleDatasetException("Plots of type "
188:                            + PlotTypes.typeNames[plotType]
189:                            + " need a dataset of type " + clazz.getName());
190:                }
191:            }
192:
193:            public void setDataProductionConfig(DatasetProducer dsp,
194:                    Map params, boolean useCache) {
195:                log.debug("setDataProductionConfig(" + dsp + ", " + params);
196:                dataAware.setDataProductionConfig(dsp, params, useCache);
197:            }
198:
199:            /**
200:             * Sets the drawingSupplier.
201:             * @param drawingSupplier The drawingSupplier to set
202:             */
203:            public void setDrawingSupplier(DrawingSupplier drawingSupplier) {
204:                this.drawingSupplier = drawingSupplier;
205:            }
206:
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.