Source Code Cross Referenced for ElementDefaultStyleSheet.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:         * ElementDefaultStyleSheet.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report.style;
030:
031:        import java.awt.BasicStroke;
032:        import java.awt.Color;
033:        import java.awt.Stroke;
034:
035:        import org.jfree.report.ElementAlignment;
036:        import org.jfree.report.util.geom.StrictBounds;
037:
038:        /**
039:         * The default element style sheet. This style sheet defines default attribute values for
040:         * all elements.
041:         * <p/>
042:         * The default valignment was modified to top.
043:         *
044:         * @author Thomas Morgner
045:         */
046:        public class ElementDefaultStyleSheet extends ElementStyleSheet {
047:            /**
048:             * The default paint.
049:             */
050:            public static final Color DEFAULT_PAINT = Color.black;
051:            public static final Stroke DEFAULT_STROKE = new BasicStroke();
052:
053:            /**
054:             * The default font.
055:             * @deprecated 
056:             */
057:            public static final FontDefinition DEFAULT_FONT_DEFINITION = new FontDefinition(
058:                    "Serif", 10);
059:
060:            /**
061:             * A shared default style-sheet.
062:             */
063:            private static ElementDefaultStyleSheet defaultStyle;
064:            /**
065:             * a flag indicating the read-only state of this style sheet.
066:             */
067:            private boolean locked;
068:
069:            /**
070:             * Creates a new style sheet.
071:             */
072:            protected ElementDefaultStyleSheet(final String name) {
073:                super (name);
074:                setStyleProperty(ElementStyleKeys.BOX_SIZING,
075:                        BoxSizing.BORDER_BOX);
076:                setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(0));
077:                setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(0));
078:                setStyleProperty(ElementStyleKeys.MAX_WIDTH, new Float(
079:                        Short.MAX_VALUE));
080:                setStyleProperty(ElementStyleKeys.MAX_HEIGHT, new Float(
081:                        Short.MAX_VALUE));
082:
083:                setStyleProperty(TextStyleKeys.LINEHEIGHT, new Float(0));
084:                setStyleProperty(TextStyleKeys.RESERVED_LITERAL, "..");
085:                setStyleProperty(TextStyleKeys.BOLD, Boolean.FALSE);
086:                setStyleProperty(TextStyleKeys.ITALIC, Boolean.FALSE);
087:                setStyleProperty(TextStyleKeys.UNDERLINED, Boolean.FALSE);
088:                setStyleProperty(TextStyleKeys.STRIKETHROUGH, Boolean.FALSE);
089:                setStyleProperty(TextStyleKeys.EMBEDDED_FONT, Boolean.FALSE);
090:                setStyleProperty(TextStyleKeys.FONT_SMOOTH, FontSmooth.AUTO);
091:                setStyleProperty(TextStyleKeys.FONT, "Serif");
092:                setStyleProperty(TextStyleKeys.FONTSIZE, new Integer(10));
093:                setStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE,
094:                        WhitespaceCollapse.PRESERVE);
095:                setStyleProperty(TextStyleKeys.TRIM_TEXT_CONTENT, Boolean.FALSE);
096:                setStyleProperty(TextStyleKeys.TEXT_WRAP, TextWrap.WRAP);
097:
098:                setStyleProperty(BOUNDS, new StrictBounds().getLockedInstance());
099:                setStyleProperty(ElementStyleKeys.PAINT, DEFAULT_PAINT);
100:                setStyleProperty(ElementStyleKeys.STROKE, DEFAULT_STROKE);
101:                setStyleProperty(ElementStyleKeys.VALIGNMENT,
102:                        ElementAlignment.TOP);
103:                setStyleProperty(ElementStyleKeys.ALIGNMENT,
104:                        ElementAlignment.LEFT);
105:                setStyleProperty(TextStyleKeys.VERTICAL_TEXT_ALIGNMENT,
106:                        VerticalTextAlign.BASELINE);
107:                setStyleProperty(ElementStyleKeys.VISIBLE, Boolean.TRUE);
108:
109:                setStyleProperty(ElementStyleKeys.ELEMENT_LAYOUT_CACHEABLE,
110:                        Boolean.TRUE);
111:                setStyleProperty(ElementStyleKeys.OVERFLOW_X, Boolean.FALSE);
112:                setStyleProperty(ElementStyleKeys.OVERFLOW_Y, Boolean.FALSE);
113:
114:                setStyleProperty(ElementStyleKeys.BORDER_TOP_WIDTH,
115:                        new Float(0));
116:                setStyleProperty(ElementStyleKeys.BORDER_LEFT_WIDTH, new Float(
117:                        0));
118:                setStyleProperty(ElementStyleKeys.BORDER_BOTTOM_WIDTH,
119:                        new Float(0));
120:                setStyleProperty(ElementStyleKeys.BORDER_RIGHT_WIDTH,
121:                        new Float(0));
122:                setStyleProperty(ElementStyleKeys.BORDER_BREAK_WIDTH,
123:                        new Float(0));
124:
125:                setStyleProperty(ElementStyleKeys.BORDER_TOP_COLOR, Color.black);
126:                setStyleProperty(ElementStyleKeys.BORDER_LEFT_COLOR,
127:                        Color.black);
128:                setStyleProperty(ElementStyleKeys.BORDER_BOTTOM_COLOR,
129:                        Color.black);
130:                setStyleProperty(ElementStyleKeys.BORDER_RIGHT_COLOR,
131:                        Color.black);
132:                setStyleProperty(ElementStyleKeys.BORDER_BREAK_COLOR,
133:                        Color.black);
134:
135:                setStyleProperty(ElementStyleKeys.BORDER_TOP_STYLE,
136:                        BorderStyle.NONE);
137:                setStyleProperty(ElementStyleKeys.BORDER_LEFT_STYLE,
138:                        BorderStyle.NONE);
139:                setStyleProperty(ElementStyleKeys.BORDER_BOTTOM_STYLE,
140:                        BorderStyle.NONE);
141:                setStyleProperty(ElementStyleKeys.BORDER_RIGHT_STYLE,
142:                        BorderStyle.NONE);
143:                setStyleProperty(ElementStyleKeys.BORDER_BREAK_STYLE,
144:                        BorderStyle.NONE);
145:
146:                setStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH,
147:                        new Float(0));
148:                setStyleProperty(
149:                        ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT,
150:                        new Float(0));
151:                setStyleProperty(
152:                        ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH,
153:                        new Float(0));
154:                setStyleProperty(
155:                        ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT,
156:                        new Float(0));
157:                setStyleProperty(
158:                        ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH,
159:                        new Float(0));
160:                setStyleProperty(
161:                        ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT,
162:                        new Float(0));
163:                setStyleProperty(
164:                        ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH,
165:                        new Float(0));
166:                setStyleProperty(
167:                        ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT,
168:                        new Float(0));
169:
170:                setStyleProperty(ElementStyleKeys.PADDING_TOP, new Float(0));
171:                setStyleProperty(ElementStyleKeys.PADDING_LEFT, new Float(0));
172:                setStyleProperty(ElementStyleKeys.PADDING_RIGHT, new Float(0));
173:                setStyleProperty(ElementStyleKeys.PADDING_BOTTOM, new Float(0));
174:                setStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE,
175:                        Boolean.TRUE);
176:
177:                setLocked(true);
178:            }
179:
180:            /**
181:             * Gets the locked state of this stylesheet. After the first initialization the
182:             * stylesheet gets locked, so that it could not be changed anymore.
183:             *
184:             * @return true, if this stylesheet is readonly.
185:             */
186:            protected boolean isLocked() {
187:                return locked;
188:            }
189:
190:            /**
191:             * Defines the locked-state for this stylesheet.
192:             *
193:             * @param locked true, if the stylesheet is locked and read-only, false otherwise.
194:             */
195:            protected void setLocked(final boolean locked) {
196:                this .locked = locked;
197:            }
198:
199:            /**
200:             * Returns the default element style sheet.
201:             *
202:             * @return the style-sheet.
203:             */
204:            public static ElementDefaultStyleSheet getDefaultStyle() {
205:                if (defaultStyle == null) {
206:                    defaultStyle = new ElementDefaultStyleSheet("GlobalElement");
207:                }
208:                return defaultStyle;
209:            }
210:
211:            /**
212:             * Sets a style property (or removes the style if the value is <code>null</code>).
213:             *
214:             * @param key   the style key (<code>null</code> not permitted).
215:             * @param value the value.
216:             * @throws NullPointerException          if the given key is null.
217:             * @throws ClassCastException            if the value cannot be assigned with the given
218:             *                                       key.
219:             * @throws UnsupportedOperationException as this style sheet is read only.
220:             */
221:            public void setStyleProperty(final StyleKey key, final Object value) {
222:                if (isLocked()) {
223:                    throw new UnsupportedOperationException(
224:                            "This stylesheet is readonly");
225:                } else {
226:                    super .setStyleProperty(key, value);
227:                }
228:            }
229:
230:            /**
231:             * Clones the style-sheet. The assigned parent style sheets are not cloned. The
232:             * stylesheets are not assigned to the contained stylesheet collection, you have to
233:             * reassign them manually ...
234:             *
235:             * @return the clone.
236:             */
237:            public ElementStyleSheet getCopy() {
238:                return this ;
239:            }
240:
241:            /**
242:             * Returns true, if this stylesheet is one of the global default stylesheets. Global
243:             * default stylesheets are unmodifiable and shared among all element stylesheets.
244:             *
245:             * @return always true.
246:             */
247:            public boolean isGlobalDefault() {
248:                return true;
249:            }
250:
251:            protected StyleSheetCarrier createCarrier(
252:                    final ElementStyleSheet styleSheet) {
253:                throw new UnsupportedOperationException(
254:                        "Cannot add other stylesheets as parent to the global default stylesheet");
255:            }
256:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.