Source Code Cross Referenced for AbstractStyleSheet.java in  » Report » pentaho-report » org » jfree » report » style » 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 » Report » pentaho report » org.jfree.report.style 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * ===========================================
003:         * JFreeReport : a free Java reporting library
004:         * ===========================================
005:         *
006:         * Project Info:  http://reporting.pentaho.org/
007:         *
008:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
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 the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015:         * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016:         * See the GNU Lesser General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU Lesser General Public License along with this
019:         * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020:         * Boston, MA 02111-1307, USA.
021:         *
022:         * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023:         * in the United States and other countries.]
024:         *
025:         * ------------
026:         * AbstractStyleSheet.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report.style;
030:
031:        import org.jfree.report.util.InstanceID;
032:
033:        /**
034:         * Creation-Date: 22.04.2007, 16:48:33
035:         *
036:         * @author Thomas Morgner
037:         */
038:        public abstract class AbstractStyleSheet implements  StyleSheet {
039:
040:            /**
041:             * The instance id of this ElementStyleSheet. This id is shared among all clones.
042:             */
043:            private InstanceID id;
044:
045:            protected AbstractStyleSheet() {
046:                this .id = new InstanceID();
047:            }
048:
049:            /**
050:             * Returns the value of a style.  If the style is not found in this style-sheet, the code looks in the parent
051:             * style-sheets.  If the style is not found in any of the parent style-sheets, then <code>null</code> is returned.
052:             *
053:             * @param key the style key.
054:             * @return the value.
055:             */
056:            public Object getStyleProperty(final StyleKey key) {
057:                return getStyleProperty(key, null);
058:            }
059:
060:            /**
061:             * Returns a boolean style (defaults to false if the style is not found).
062:             *
063:             * @param key the style key.
064:             * @return <code>true</code> or <code>false</code>.
065:             */
066:            public boolean getBooleanStyleProperty(final StyleKey key) {
067:                final Boolean b = (Boolean) getStyleProperty(key, null);
068:                if (b == null) {
069:                    return false;
070:                }
071:                return b.booleanValue();
072:            }
073:
074:            /**
075:             * Returns a boolean style.
076:             *
077:             * @param key          the style key.
078:             * @param defaultValue the default value.
079:             * @return true or false.
080:             */
081:            public boolean getBooleanStyleProperty(final StyleKey key,
082:                    final boolean defaultValue) {
083:                final Boolean b = (Boolean) getStyleProperty(key, null);
084:                if (b == null) {
085:                    return defaultValue;
086:                }
087:                return b.booleanValue();
088:            }
089:
090:            /**
091:             * Returns an integer style.
092:             *
093:             * @param key the style key.
094:             * @param def the default value.
095:             * @return the style value.
096:             */
097:            public int getIntStyleProperty(final StyleKey key, final int def) {
098:                final Number i = (Number) getStyleProperty(key, null);
099:                if (i == null) {
100:                    return def;
101:                }
102:                return i.intValue();
103:            }
104:
105:            /**
106:             * Returns an double style.
107:             *
108:             * @param key the style key.
109:             * @param def the default value.
110:             * @return the style value.
111:             */
112:            public double getDoubleStyleProperty(final StyleKey key,
113:                    final double def) {
114:                final Number i = (Number) getStyleProperty(key, null);
115:                if (i == null) {
116:                    return def;
117:                }
118:                return i.doubleValue();
119:            }
120:
121:            /**
122:             * Returns the font for this style-sheet.
123:             *
124:             * @return the font.
125:             */
126:            public FontDefinition getFontDefinitionProperty() {
127:                final String name = (String) getStyleProperty(TextStyleKeys.FONT);
128:                final int size = getIntStyleProperty(TextStyleKeys.FONTSIZE, -1);
129:                final boolean bold = getBooleanStyleProperty(TextStyleKeys.BOLD);
130:                final boolean italic = getBooleanStyleProperty(TextStyleKeys.ITALIC);
131:                final boolean underlined = getBooleanStyleProperty(TextStyleKeys.UNDERLINED);
132:                final boolean strike = getBooleanStyleProperty(TextStyleKeys.STRIKETHROUGH);
133:                final boolean embed = getBooleanStyleProperty(TextStyleKeys.EMBEDDED_FONT);
134:                final String encoding = (String) getStyleProperty(TextStyleKeys.FONTENCODING);
135:
136:                return new FontDefinition(name, size, bold, italic, underlined,
137:                        strike, encoding, embed);
138:            }
139:
140:            /**
141:             * Returns the ID of the stylesheet. The ID does identify an element stylesheet an all all cloned instances of that
142:             * stylesheet.
143:             *
144:             * @return the ID of this stylesheet.
145:             */
146:            public InstanceID getId() {
147:                return id;
148:            }
149:
150:            public Object[] toArray(final StyleKey[] keys) {
151:                final Object[] data = new Object[keys.length];
152:                for (int i = 0; i < keys.length; i++) {
153:                    final StyleKey key = keys[i];
154:                    final int identifier = key.getIdentifier();
155:                    data[identifier] = getStyleProperty(key, null);
156:                }
157:                return data;
158:            }
159:
160:            public long getChangeTracker() {
161:                return 0;
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.