Source Code Cross Referenced for AbstractSymbolFactory.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.graphic.GraphPoint;
022:        import jcckit.graphic.GraphicAttributes;
023:        import jcckit.graphic.GraphicalElement;
024:        import jcckit.util.ConfigParameters;
025:        import jcckit.util.Factory;
026:
027:        /**
028:         * Abstract superclass of all {@link SymbolFactory SymbolFactories}.
029:         * Subclasses have to implement {@link #createPlainSymbol createPlainSymbol()}.
030:         *
031:         * @author Franz-Josef Elmer
032:         */
033:        public abstract class AbstractSymbolFactory implements  SymbolFactory {
034:            /** Size of all symbols. */
035:            protected final double _size;
036:
037:            /** Attributes of all symbols. */
038:            protected final GraphicAttributes _attributes;
039:
040:            /**
041:             * Creates an instance from the specified configuration parameters.
042:             * <table border=1 cellpadding=5>
043:             * <tr><th>Key &amp; Default Value</th><th>Type</th><th>Mandatory</th>
044:             *     <th>Description</th></tr>
045:             * <tr><td><tt>size = </tt>0.01</td>
046:             *     <td><tt>double</tt></td><td>no</td>
047:             *     <td>Size of the symbol in device-independent units.</td></tr>
048:             * <tr><td><tt>attributes</tt></td>
049:             *     <td><tt>ConfigParameters</tt></td><td>no</td>
050:             *     <td>Configuration parameters for the attributes of the symbol.
051:             *         <tt>className</tt> has to be a class which is an instance of
052:             *         {@link GraphicAttributes}.</td></tr>
053:             * </table>
054:             */
055:            public AbstractSymbolFactory(ConfigParameters config) {
056:                _size = config.getDouble(SIZE_KEY, DEFAULT_SIZE);
057:                _attributes = (GraphicAttributes) Factory.createOrGet(config
058:                        .getNode(ATTRIBUTES_KEY), null);
059:            }
060:
061:            /** 
062:             * Creates a symbol.
063:             * Evaluate <tt>hintFromPreviousPoint</tt> if it is a {@link AttributesHint}.
064:             * Calls {@link #createSymbol(GraphPoint, GraphicAttributes, Hint, Hint)}.
065:             * @param point Symbol position.
066:             * @param hintFromPreviousPoint Hint from the previous point.
067:             * @param hintFromPreviousCurve Hint from the previous curve.
068:             */
069:            public Symbol createSymbol(GraphPoint point,
070:                    Hint hintFromPreviousPoint, Hint hintFromPreviousCurve) {
071:                GraphicAttributes attributes = _attributes;
072:                Hint hintForNextPoint = hintFromPreviousPoint;
073:                if (hintFromPreviousPoint instanceof  AttributesHint) {
074:                    attributes = ((AttributesHint) hintFromPreviousPoint)
075:                            .getAttributes();
076:                    hintForNextPoint = ((AttributesHint) hintFromPreviousPoint)
077:                            .getNextHint();
078:                }
079:                return createSymbol(point, attributes, hintForNextPoint,
080:                        hintFromPreviousCurve);
081:            }
082:
083:            /**
084:             * Creates a symbol.
085:             * Uses {@link #createPlainSymbol createPlainSymbol()}.
086:             * @param point Symbol position.
087:             * @param attributes Symbol attributes.
088:             * @param hintForNextPoint Hint for the next point. Will be delivered
089:             *        unchanged in the return <tt>Symbol</tt> object.
090:             * @param hintFromPreviousCurve Hint from the previous curve.
091:             *        Will be delivered unchanged in the return <tt>Symbol</tt> object.
092:             *        Subclasses may override this behavior.
093:             */
094:            protected Symbol createSymbol(GraphPoint point,
095:                    GraphicAttributes attributes, Hint hintForNextPoint,
096:                    Hint hintFromPreviousCurve) {
097:                return new Symbol(createPlainSymbol(point, _size, attributes),
098:                        hintForNextPoint, hintFromPreviousCurve);
099:            }
100:
101:            /**
102:             * Creates a symbol for the legend at the specified position.
103:             * Uses {@link #createPlainSymbol createPlainSymbol()} 
104:             * @param centerPosition Center position of the symbol.
105:             * @param size The size of the symbol. Will be ignored because the value
106:             *         given in the constructor will be used.
107:             */
108:            public GraphicalElement createLegendSymbol(
109:                    GraphPoint centerPosition, double size) {
110:                return createPlainSymbol(centerPosition, _size, _attributes);
111:            }
112:
113:            /**
114:             * Creates the graphical element of the plain symbol.
115:             * @param centerPosition Center position of the symbol.
116:             * @param size The size of the symbol.
117:             * @param attributes The attributes of the symbol.
118:             */
119:            protected abstract GraphicalElement createPlainSymbol(
120:                    GraphPoint centerPosition, double size,
121:                    GraphicAttributes attributes);
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.