Source Code Cross Referenced for PlotCanvas.java in  » Chart » jcckit » jcckit » 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 » jcckit » jcckit.plot 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
003:         *
004:         * This library is free software; you can redistribute it and/or modify
005:         * it under the terms of the GNU Lesser General Public License as published by
006:         * the Free Software Foundation; either version 2.1 of the License, or
007:         * (at your option) any later version.
008:         *
009:         * This program is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012:         * GNU Lesser General Public License for more details
013:         * (http://www.gnu.org/copyleft/lesser.html).
014:         *
015:         * You should have received a copy of the GNU Lesser General Public License
016:         * along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018:         */
019:        package jcckit.plot;
020:
021:        import jcckit.data.DataPlot;
022:        import jcckit.graphic.Anchor;
023:        import jcckit.graphic.ClippingRectangle;
024:        import jcckit.util.ConfigParameters;
025:
026:        /**
027:         * An abstract canvas containg a single {@link Plot}.
028:         * The canvas is specified by a {@link ClippingRectangle}, called 
029:         * <em>paper</em>. A horizontal and vertical {@link Anchor} determine
030:         * the position of the paper on the actual device.
031:         * 
032:         * @author Franz-Josef Elmer
033:         */
034:        public class PlotCanvas implements  PlotListener {
035:            /** Configuration parameter key. */
036:            public static final String PAPER_KEY = "paper",
037:                    HORIZONTAL_ANCHOR_KEY = "horizontalAnchor",
038:                    VERTICAL_ANCHOR_KEY = "verticalAnchor", PLOT_KEY = "plot";
039:            private final ClippingRectangle _paper;
040:            private final Anchor _horizontalAnchor;
041:            private final Anchor _verticalAnchor;
042:            private final Plot _plot;
043:
044:            /**
045:             * Creates an instance from the specified configuration parameters.
046:             * <table border=1 cellpadding=5>
047:             * <tr><th>Key &amp; Default Value</th><th>Type</th><th>Mandatory</th>
048:             *     <th>Description</th></tr>
049:             * <tr><td><tt>horizontalAnchor = center</tt></td>
050:             *     <td><tt>String</tt></td><td>no</td>
051:             *     <td>Horizontal position of the paper relative to the device
052:             *         border. Possible values are <tt>left</tt>, <tt>center</tt>,
053:             *         and <tt>right</tt>.</td></tr>
054:             * <tr><td><tt>paper = 0,&nbsp;0,&nbsp;1,&nbsp;0.6</tt></td>
055:             *     <td><tt>double[]</tt></td><td>no</td>
056:             *     <td>Rectangle defining the paper. The first two values determine
057:             *         the x- and y- coordinates (in device-independent units) 
058:             *         of the lower-left corner. The last two values determine the 
059:             *         upper-right corner.</td></tr>
060:             * <tr><td><tt>plot = </tt>default values of {@link Plot}</td>
061:             *     <td><tt>ConfigParameters</tt></td><td>no</td>
062:             *     <td>Definition of the {@link Plot}.</td></tr>
063:             * <tr><td><tt>verticalAnchor = center</tt></td>
064:             *     <td><tt>String</tt></td><td>no</td>
065:             *     <td>Vertical position of the paper relative to the device
066:             *         border. Possible values are <tt>top</tt>, <tt>center</tt>,
067:             *         and <tt>bottom</tt>.</td></tr>
068:             * </table>
069:             * <p>
070:             * Note, that this instance registers itself at the  
071:             * wrapped {@link Plot} instance.
072:             */
073:            public PlotCanvas(ConfigParameters config) {
074:                double[] paper = config.getDoubleArray(PAPER_KEY, new double[] {
075:                        0, 0, 1, 0.6 });
076:                _paper = new ClippingRectangle(paper[0], paper[1], paper[2],
077:                        paper[3]);
078:                _horizontalAnchor = Anchor.getHorizontalAnchor(config,
079:                        HORIZONTAL_ANCHOR_KEY, Anchor.CENTER);
080:                _verticalAnchor = Anchor.getVerticalAnchor(config,
081:                        VERTICAL_ANCHOR_KEY, Anchor.CENTER);
082:                _plot = new Plot(config.getNode(PLOT_KEY));
083:                _plot.addPlotListener(this );
084:            }
085:
086:            /** Returns the paper definition. */
087:            public ClippingRectangle getPaper() {
088:                return _paper;
089:            }
090:
091:            /** Returns the horizontal anchor. */
092:            public Anchor getHorizontalAnchor() {
093:                return _horizontalAnchor;
094:            }
095:
096:            /** Returns the vertical anchor. */
097:            public Anchor getVerticalAnchor() {
098:                return _verticalAnchor;
099:            }
100:
101:            /** Returns the plot. */
102:            public Plot getPlot() {
103:                return _plot;
104:            }
105:
106:            /** 
107:             * Connects the wrapped {@link Plot} instance with the specified
108:             * {@link DataPlot}.
109:             * @param dataPlot Data to be connected with this plot canvas.
110:             *        Can be <tt>null</tt> in order to disconnect this instance from
111:             *        a <tt>DataPlot</tt>.
112:             */
113:            public void connect(DataPlot dataPlot) {
114:                _plot.connect(dataPlot);
115:            }
116:
117:            /**
118:             * Handles the spcified event. Here nothing is done. But
119:             * subclass may override this method.
120:             */
121:            public void plotChanged(PlotEvent event) {
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.