Source Code Cross Referenced for ElementLayoutInformation.java in  » Report » pentaho-report » org » jfree » report » util » 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.util 
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:         * ElementLayoutInformation.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report.util;
030:
031:        import org.jfree.report.util.geom.StrictBounds;
032:        import org.jfree.report.util.geom.StrictDimension;
033:        import org.jfree.report.util.geom.StrictPoint;
034:
035:        /**
036:         * A small carrier class to encapsulate the common layout parameters. This information is
037:         * a utility class, don't expect to find one bound to an element.
038:         *
039:         * @author Thomas Morgner
040:         * @deprecated Is no longer needed. Remove it.
041:         */
042:        public class ElementLayoutInformation {
043:            /**
044:             * The absolute position of the element.
045:             */
046:            private StrictPoint absolutePosition;
047:
048:            /**
049:             * The current minimum size for the element.
050:             */
051:            private StrictDimension minimumSize;
052:
053:            /**
054:             * The current maximum size for the element.
055:             */
056:            private StrictDimension maximumSize;
057:
058:            /**
059:             * The current preferred size for the element.
060:             */
061:            private StrictDimension preferredSize;
062:
063:            /**
064:             * Creates a new instance.
065:             * <p/>
066:             * The position will be <code>rect.x, rect.y</code> and all dimensions are set to
067:             * <code>rect.width, rect.height</code>.
068:             *
069:             * @param rect the rectangle that will be the base for this ElementLayoutInformation.
070:             * @throws java.lang.NullPointerException if the given rectangle is null.
071:             */
072:            public ElementLayoutInformation(final StrictBounds rect) {
073:                if (rect == null) {
074:                    throw new NullPointerException();
075:                }
076:                absolutePosition = new StrictPoint(rect.getX(), rect.getY());
077:                final StrictDimension fdim = new StrictDimension(rect
078:                        .getWidth(), rect.getHeight());
079:                maximumSize = fdim;
080:                minimumSize = fdim;
081:                preferredSize = fdim;
082:            }
083:
084:            /**
085:             * Creates a new instance.
086:             * <p/>
087:             * The preferred size will be undefined (<code>null</code>).
088:             *
089:             * @param absolutePosition the absolute position for the element.
090:             * @param minimumSize      the minimum size for the element.
091:             * @param maximumSize      the maximum size for the element.
092:             * @throws java.lang.NullPointerException if one of the parameters is <code>null</code>.
093:             */
094:            public ElementLayoutInformation(final StrictPoint absolutePosition,
095:                    final StrictDimension minimumSize,
096:                    final StrictDimension maximumSize) {
097:                this (absolutePosition, minimumSize, maximumSize, null);
098:            }
099:
100:            /**
101:             * Creates a new instance.
102:             * <p/>
103:             * If the preferred size is <code>null</code>, then it is left undefined.
104:             *
105:             * @param absolutePosition the absolute position for the element
106:             * @param minimumSize      the minimum size for the element
107:             * @param maximumSize      the maximum size for the element
108:             * @param preferredSize    the preferred size or <code>null</code> if not known.
109:             * @throws java.lang.NullPointerException if the position or max/min size is
110:             *                                        <code>null</code>.
111:             */
112:            public ElementLayoutInformation(final StrictPoint absolutePosition,
113:                    final StrictDimension minimumSize,
114:                    final StrictDimension maximumSize,
115:                    final StrictDimension preferredSize) {
116:                if (absolutePosition == null) {
117:                    throw new NullPointerException();
118:                }
119:                if (minimumSize == null) {
120:                    throw new NullPointerException();
121:                }
122:                if (maximumSize == null) {
123:                    throw new NullPointerException();
124:                }
125:                this .absolutePosition = (StrictPoint) absolutePosition.clone();
126:                // the minsize cannot be greater than the max size ...
127:                this .minimumSize = unionMin(maximumSize, minimumSize);
128:                this .maximumSize = (StrictDimension) maximumSize.clone();
129:                if (preferredSize != null) {
130:                    this .preferredSize = (StrictDimension) preferredSize
131:                            .clone();
132:                }
133:            }
134:
135:            /**
136:             * Gets the absolute positon defined in this LayoutInformation.
137:             *
138:             * @return a clone of the absolute position.
139:             */
140:            public StrictPoint getAbsolutePosition() {
141:                return (StrictPoint) absolutePosition.clone();
142:            }
143:
144:            /**
145:             * Gets the minimum size defined in this LayoutInformation.
146:             *
147:             * @return a clone of the minimum size.
148:             */
149:            public StrictDimension getMinimumSize() {
150:                return (StrictDimension) minimumSize.clone();
151:            }
152:
153:            /**
154:             * Gets the maximum size defined in this LayoutInformation.
155:             *
156:             * @return a clone of the maximum size.
157:             */
158:            public StrictDimension getMaximumSize() {
159:                return (StrictDimension) maximumSize.clone();
160:            }
161:
162:            /**
163:             * Gets the preferred size defined in this LayoutInformation.
164:             *
165:             * @return a clone of the preferred size.
166:             */
167:            public StrictDimension getPreferredSize() {
168:                if (preferredSize == null) {
169:                    return null;
170:                }
171:                return (StrictDimension) preferredSize.clone();
172:            }
173:
174:            /**
175:             * Create a minimum dimension of the given 2 dimension objects. If pref is not given,
176:             * the max parameter is returned unchanged.
177:             * <p/>
178:             * This is used to limit the element bounds to the preferred size or the maximum size
179:             * (in case the user misconfigured anything).
180:             *
181:             * @param max  the maximum size as retrieved from the element.
182:             * @param pref the preferred size.
183:             * @return the minimum dimension.
184:             */
185:            public static StrictDimension unionMin(final StrictDimension max,
186:                    final StrictDimension pref) {
187:                if (pref == null) {
188:                    return max;
189:                }
190:                return new StrictDimension(Math.min(pref.getWidth(), max
191:                        .getWidth()), Math.min(pref.getHeight(), max
192:                        .getHeight()));
193:            }
194:
195:            /**
196:             * Returns a string representing the object (useful for debugging).
197:             *
198:             * @return A string.
199:             */
200:            public String toString() {
201:                final StringBuffer b = new StringBuffer();
202:                b.append("ElementLayoutInformation: \n");
203:                b.append("    AbsolutePos: ");
204:                b.append(absolutePosition);
205:                b.append("\n    MinSize: ");
206:                b.append(minimumSize);
207:                b.append("\n    PrefSize: ");
208:                b.append(preferredSize);
209:                b.append("\n    MaxSize: ");
210:                b.append(maximumSize);
211:                b.append('\n');
212:                return b.toString();
213:            }
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.