Source Code Cross Referenced for PaintComponentFunction.java in  » Report » pentaho-report » org » jfree » report » function » 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.function 
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:         * PaintComponentFunction.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report.function;
030:
031:        import java.awt.BorderLayout;
032:        import java.awt.Frame;
033:        import java.io.IOException;
034:        import java.io.ObjectInputStream;
035:
036:        import org.jfree.report.JFreeReportBoot;
037:        import org.jfree.report.event.LayoutEvent;
038:        import org.jfree.report.event.LayoutListener;
039:        import org.jfree.util.Log;
040:
041:        /**
042:         * Paints a AWT or Swing Component, fitting the component into the element bounds. The component must be contained in
043:         * the dataRow.
044:         * <p/>
045:         * In an headless environment this function wont work and will always return null.
046:         *
047:         * @author Thomas Morgner
048:         * @deprecated Use the new Component-Element instead. It uses drawables for this job, and therefore the result looks
049:         *             much better. This method does no longer work, as it depended on implementation details that are no longer
050:         *             in use.
051:         */
052:        public class PaintComponentFunction extends AbstractFunction implements 
053:                LayoutListener {
054:            /**
055:             * Supplies a valid AWT-peer for the draw operation.
056:             */
057:            private transient Frame peerSupply;
058:            /**
059:             * The name of the report element that should receive the image.
060:             */
061:            private String element;
062:
063:            /**
064:             * The field from where to read the AWT-Component.
065:             */
066:            private String field;
067:
068:            /**
069:             * The scale factor.
070:             */
071:            private float scale;
072:
073:            /**
074:             * DefaultConstructor.
075:             */
076:            public PaintComponentFunction() {
077:                if (isHeadless() == false) {
078:                    peerSupply = new Frame();
079:                    peerSupply.setLayout(new BorderLayout());
080:                }
081:                this .scale = 1;
082:            }
083:
084:            /**
085:             * Returns the element used by the function. <P> The element name corresponds to a element in the report. The element
086:             * name must be unique, as the first occurence of the element is used.
087:             *
088:             * @return The field name.
089:             */
090:            public String getElement() {
091:                return element;
092:            }
093:
094:            /**
095:             * Sets the element name for the function. <P> The element name corresponds to a element in the report. The element
096:             * name must be unique, as the first occurence of the element is used.
097:             *
098:             * @param field the field name (null not permitted).
099:             */
100:            public void setElement(final String field) {
101:                if (field == null) {
102:                    throw new NullPointerException();
103:                }
104:                this .element = field;
105:            }
106:
107:            /**
108:             * Returns the field used by the function. The field name corresponds to a column name in the report's data-row.
109:             *
110:             * @return The field name.
111:             */
112:            public String getField() {
113:                return field;
114:            }
115:
116:            /**
117:             * Sets the field name for the function. The field name corresponds to a column name in the report's data-row.
118:             *
119:             * @param field the field name.
120:             */
121:            public void setField(final String field) {
122:                this .field = field;
123:            }
124:
125:            /**
126:             * Tests, whether the report generation is executed in an headless environment.
127:             *
128:             * @return true, if this is an headless environment, false otherwise.
129:             */
130:            protected static boolean isHeadless() {
131:                return "true".equals(JFreeReportBoot.getInstance()
132:                        .getGlobalConfig().getConfigProperty(
133:                                "java.awt.headless", "false"));
134:            }
135:
136:            /**
137:             * Receives notification that the band layouting has completed. <P> The event carries the current report state.
138:             *
139:             * @param event The event.
140:             */
141:            public void layoutComplete(final LayoutEvent event) {
142:                if (isHeadless()) {
143:                    return;
144:                }
145:                Log
146:                        .error("The PaintComponentFunction is no longer valid. Use a component-field instead.");
147:            }
148:
149:            /**
150:             * Return the current expression value. <P> The value depends (obviously) on the expression implementation.
151:             *
152:             * @return the value of the function.
153:             */
154:            public Object getValue() {
155:                return null;
156:            }
157:
158:            /**
159:             * Define a scale factor for the created image. Using a higher scale factor will produce better results. A scale
160:             * factor of 2 will double the resolution. A scale factor of 1 will create 72 dpi images.
161:             *
162:             * @param scale the scale factor.
163:             */
164:            public void setScale(final float scale) {
165:                this .scale = scale;
166:            }
167:
168:            /**
169:             * Gets the scale factor for the created image. Using a higher scale factor will produce better results. A scale
170:             * factor of 2 will double the resolution. A scale factor of 1 will create 72 dpi images.
171:             *
172:             * @return the scale factor.
173:             */
174:            public float getScale() {
175:                return scale;
176:            }
177:
178:            /**
179:             * Return a completly separated copy of this function. The copy does no longer share any changeable objects with the
180:             * original function.
181:             *
182:             * @return a copy of this function.
183:             */
184:            public Expression getInstance() {
185:                final PaintComponentFunction pc = (PaintComponentFunction) super 
186:                        .getInstance();
187:                if (isHeadless() == false) {
188:                    pc.peerSupply = new Frame();
189:                    pc.peerSupply.setLayout(new BorderLayout());
190:                }
191:                return pc;
192:            }
193:
194:            /**
195:             * Helper method for serialization.
196:             *
197:             * @param in the input stream from where to read the serialized object.
198:             * @throws IOException            when reading the stream fails.
199:             * @throws ClassNotFoundException if a class definition for a serialized object could not be found.
200:             */
201:            private void readObject(final ObjectInputStream in)
202:                    throws IOException, ClassNotFoundException {
203:                in.defaultReadObject();
204:                if (isHeadless() == false) {
205:                    peerSupply = new Frame();
206:                    peerSupply.setLayout(new BorderLayout());
207:                }
208:            }
209:
210:            /**
211:             * Not used.
212:             * @param event not used.
213:             */
214:            public void outputComplete(final LayoutEvent event) {
215:            }
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.