Source Code Cross Referenced for Watermark.java in  » Report » pentaho-report » org » jfree » report » 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 
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:         * Watermark.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report;
030:
031:        import org.jfree.report.style.BandDefaultStyleSheet;
032:        import org.jfree.report.style.BandStyleKeys;
033:        import org.jfree.report.style.ElementDefaultStyleSheet;
034:        import org.jfree.report.style.ElementStyleKeys;
035:
036:        /**
037:         * A report band used to print information at the background of every page in the report. There is an option to suppress
038:         * the printing on the first page and the last page of the report (this is often useful if you are using a report header
039:         * and/or report footer).
040:         * <p/>
041:         * A watermark section cannot have subreports.
042:         *
043:         * @author David Gilbert
044:         */
045:        public class Watermark extends Band implements  RootLevelBand {
046:            /**
047:             * A empty array defined here for performance reasons.
048:             */
049:            private static final SubReport[] EMPTY_SUB_REPORT = new SubReport[0];
050:
051:            /**
052:             * A default style sheet for shape elements. This defined a default stroke for all shapes.
053:             */
054:            private static class WatermarkDefaultStyleSheet extends
055:                    BandDefaultStyleSheet {
056:                /**
057:                 * Creates a new style-sheet. The stylesheet is not modifiable
058:                 */
059:                protected WatermarkDefaultStyleSheet() {
060:                    // unlock the write protection
061:                    setLocked(false);
062:                    setStyleProperty(ElementStyleKeys.HEIGHT, new Float(-100));
063:                    setLocked(true);
064:                }
065:            }
066:
067:            /**
068:             * A shared default style sheet for shape elements.
069:             */
070:            private static ElementDefaultStyleSheet defaultStyle;
071:
072:            /**
073:             * Returns the default style-sheet for shape elements.
074:             *
075:             * @return a default style sheet that can be shared among shape elements.
076:             */
077:            public static synchronized ElementDefaultStyleSheet getDefaultStyle() {
078:                if (defaultStyle == null) {
079:                    defaultStyle = new WatermarkDefaultStyleSheet();
080:                }
081:                return defaultStyle;
082:            }
083:
084:            /**
085:             * Constructs a watermark band.
086:             */
087:            public Watermark() {
088:            }
089:
090:            /**
091:             * Returns the global stylesheet for the watermark bands. This stylesheet provides the predefined default values for
092:             * some of the stylekeys.
093:             *
094:             * @return the global default stylesheet.
095:             */
096:            protected ElementDefaultStyleSheet createGlobalDefaultStyle() {
097:                return Watermark.getDefaultStyle();
098:            }
099:
100:            /**
101:             * Constructs a page footer containing no elements.
102:             *
103:             * @param onFirstPage defines, whether the page header will be printed on the first page
104:             * @param onLastPage  defines, whether the page footer will be printed on the last page.
105:             */
106:            public Watermark(final boolean onFirstPage, final boolean onLastPage) {
107:                super ();
108:                if (onFirstPage == false) {
109:                    setDisplayOnFirstPage(onFirstPage);
110:                }
111:                if (onLastPage == false) {
112:                    setDisplayOnLastPage(onLastPage);
113:                }
114:            }
115:
116:            /**
117:             * Returns true if the header should be shown on page 1, and false otherwise.
118:             *
119:             * @return true or false.
120:             */
121:            public boolean isDisplayOnFirstPage() {
122:                return getStyle().getBooleanStyleProperty(
123:                        BandStyleKeys.DISPLAY_ON_FIRSTPAGE);
124:            }
125:
126:            /**
127:             * Defines whether the header should be shown on the first page.
128:             *
129:             * @param b a flag indicating whether or not the header is shown on the first page.
130:             */
131:            public void setDisplayOnFirstPage(final boolean b) {
132:                getStyle().setBooleanStyleProperty(
133:                        BandStyleKeys.DISPLAY_ON_FIRSTPAGE, b);
134:            }
135:
136:            /**
137:             * Returns true if the header should be shown on the last page, and false otherwise.
138:             *
139:             * @return true or false.
140:             */
141:            public boolean isDisplayOnLastPage() {
142:                return getStyle().getBooleanStyleProperty(
143:                        BandStyleKeys.DISPLAY_ON_LASTPAGE);
144:            }
145:
146:            /**
147:             * Defines whether the header should be shown on the last page.
148:             *
149:             * @param b a flag indicating whether or not the header is shown on the last page.
150:             */
151:            public void setDisplayOnLastPage(final boolean b) {
152:                getStyle().setBooleanStyleProperty(
153:                        BandStyleKeys.DISPLAY_ON_LASTPAGE, b);
154:            }
155:
156:            /**
157:             * Assigns the report definition. Don't play with that function, unless you know what you are doing. You might get
158:             * burned.
159:             *
160:             * @param reportDefinition the report definition.
161:             */
162:            public void setReportDefinition(
163:                    final ReportDefinition reportDefinition) {
164:                super .setReportDefinition(reportDefinition);
165:            }
166:
167:            /**
168:             * Returns the number of subreports on this band. This returns zero, as page-bands cannot have subreports.
169:             *
170:             * @return the subreport count.
171:             */
172:            public int getSubReportCount() {
173:                return 0;
174:            }
175:
176:            /**
177:             * Throws an IndexOutOfBoundsException as page-footer cannot have sub-reports.
178:             *
179:             * @param index the index.
180:             * @return nothing, as an exception is thrown instead.
181:             */
182:            public SubReport getSubReport(final int index) {
183:                throw new IndexOutOfBoundsException(
184:                        "Watermark bands cannot have subreports.");
185:            }
186:
187:            /**
188:             * Returns an empty array, as page-footer cannot have subreports.
189:             *
190:             * @return the sub-reports as array.
191:             */
192:            public SubReport[] getSubReports() {
193:                return EMPTY_SUB_REPORT;
194:            }
195:
196:            /**
197:             * Returns true if the footer should be shown on all subreports.
198:             *
199:             * @return true or false.
200:             */
201:            public boolean isSticky() {
202:                return getStyle().getBooleanStyleProperty(BandStyleKeys.STICKY,
203:                        false);
204:            }
205:
206:            /**
207:             * Defines whether the footer should be shown on all subreports.
208:             *
209:             * @param b a flag indicating whether or not the footer is shown on the first page.
210:             */
211:            public void setSticky(final boolean b) {
212:                getStyle().setBooleanStyleProperty(BandStyleKeys.STICKY, b);
213:            }
214:
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.