Source Code Cross Referenced for LogicalPageBox.java in  » Report » pentaho-report » org » jfree » report » layout » model » 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.layout.model 
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:         * LogicalPageBox.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report.layout.model;
030:
031:        import org.jfree.report.PageDefinition;
032:        import org.jfree.report.layout.model.context.BoxDefinition;
033:        import org.jfree.report.layout.style.SimpleStyleSheet;
034:        import org.jfree.report.util.InstanceID;
035:
036:        /**
037:         * The logical page is the root-structure of the generated content. This object is a slotted container.
038:         *
039:         * @author Thomas Morgner
040:         */
041:        public class LogicalPageBox extends BlockRenderBox {
042:
043:            // All breaks along the major-axis.
044:            private PageBreakPositionList allVerticalBreaks;
045:            private long pageOffset;
046:            private long pageEnd;
047:
048:            private WatermarkAreaBox watermarkArea;
049:            private PageAreaBox headerArea;
050:            private PageAreaBox footerArea;
051:            private DefaultPageGrid pageGrid;
052:            private InstanceID contentAreaId;
053:            private String pageName;
054:
055:            public LogicalPageBox(final PageDefinition pageDefinition) {
056:                super (SimpleStyleSheet.EMPTY_STYLE, BoxDefinition.EMPTY, null);
057:                this .headerArea = new PageAreaBox(getStyleSheet(),
058:                        BoxDefinition.EMPTY);
059:                this .headerArea.setName("Logical-Page-Header-Area");
060:                this .headerArea.setLogicalPage(this );
061:                this .footerArea = new PageAreaBox(getStyleSheet(),
062:                        BoxDefinition.EMPTY);
063:                this .footerArea.setName("Logical-Page-Footer-Area");
064:                this .footerArea.setLogicalPage(this );
065:
066:                final BoxDefinition boxDefinition = new BoxDefinition();
067:                boxDefinition
068:                        .setPreferredHeight(new RenderLength(100000, true));
069:                this .watermarkArea = new WatermarkAreaBox(getStyleSheet(),
070:                        boxDefinition);
071:                this .watermarkArea.setName("Logical-Page-Watermark-Area");
072:                this .watermarkArea.setLogicalPage(this );
073:
074:                final BlockRenderBox contentArea = new BlockRenderBox(
075:                        getStyleSheet(), BoxDefinition.EMPTY, null);
076:                contentArea.setName("Logical-Page-Content-Area");
077:                addChild(contentArea);
078:                contentAreaId = contentArea.getInstanceId();
079:                this .pageGrid = new DefaultPageGrid(pageDefinition);
080:
081:                this .allVerticalBreaks = new PageBreakPositionList(null, 1);
082:            }
083:
084:            public BlockRenderBox getContentArea() {
085:                final BlockRenderBox blockRenderBox = (BlockRenderBox) findNodeById(contentAreaId);
086:                if (blockRenderBox == null) {
087:                    throw new IllegalStateException(
088:                            "Cloning or deriving must have failed: No content area.");
089:                }
090:                return blockRenderBox;
091:            }
092:
093:            public BlockRenderBox getHeaderArea() {
094:                return headerArea;
095:            }
096:
097:            public BlockRenderBox getFooterArea() {
098:                return footerArea;
099:            }
100:
101:            public WatermarkAreaBox getWatermarkArea() {
102:                return watermarkArea;
103:            }
104:
105:            public LogicalPageBox getLogicalPage() {
106:                return this ;
107:            }
108:
109:            public long getPageWidth() {
110:                return pageGrid.getMaximumPageWidth();
111:            }
112:
113:            public PageGrid getPageGrid() {
114:                return pageGrid;
115:            }
116:
117:            public long getPageOffset() {
118:                return pageOffset;
119:            }
120:
121:            public void setPageOffset(final long pageOffset) {
122:                this .pageOffset = pageOffset;
123:            }
124:
125:            public long getPageEnd() {
126:                return pageEnd;
127:            }
128:
129:            public void setPageEnd(final long pageEnd) {
130:                this .pageEnd = pageEnd;
131:            }
132:
133:            public long[] getPhysicalBreaks(final int axis) {
134:                if (axis == RenderNode.HORIZONTAL_AXIS) {
135:                    return pageGrid.getHorizontalBreaks();
136:                }
137:                return pageGrid.getVerticalBreaks();
138:            }
139:
140:            public long getPageHeight() {
141:                return pageGrid.getMaximumPageHeight();
142:            }
143:
144:            /**
145:             * Derive creates a disconnected node that shares all the properties of the
146:             * original node. The derived node will no longer have any parent, silbling,
147:             * child or any other relationships with other nodes.
148:             *
149:             * @return
150:             */
151:            public RenderNode deriveFrozen(final boolean deepDerive) {
152:                final LogicalPageBox box = (LogicalPageBox) super 
153:                        .deriveFrozen(deepDerive);
154:                box.headerArea = (PageAreaBox) headerArea
155:                        .deriveFrozen(deepDerive);
156:                box.headerArea.setLogicalPage(box);
157:                box.footerArea = (PageAreaBox) footerArea
158:                        .deriveFrozen(deepDerive);
159:                box.footerArea.setLogicalPage(box);
160:                box.watermarkArea = (WatermarkAreaBox) watermarkArea
161:                        .deriveFrozen(deepDerive);
162:                box.watermarkArea.setLogicalPage(box);
163:                //
164:                //    box.subFlows.clear();
165:                //
166:                //    for (int i = 0; i < subFlows.size(); i++)
167:                //    {
168:                //      NormalFlowRenderBox flowRenderBox = (NormalFlowRenderBox) subFlows.get(i);
169:                //      box.subFlows.add(flowRenderBox.deriveFrozen(deepDerive));
170:                //    }
171:
172:                return box;
173:            }
174:
175:            /**
176:             * Derive creates a disconnected node that shares all the properties of the
177:             * original node. The derived node will no longer have any parent, silbling,
178:             * child or any other relationships with other nodes.
179:             *
180:             * @return
181:             */
182:            public RenderNode derive(final boolean deepDerive) {
183:                final LogicalPageBox box = (LogicalPageBox) super 
184:                        .derive(deepDerive);
185:                box.headerArea = (PageAreaBox) headerArea.derive(deepDerive);
186:                box.headerArea.setLogicalPage(box);
187:                box.footerArea = (PageAreaBox) footerArea.derive(deepDerive);
188:                box.footerArea.setLogicalPage(box);
189:                box.watermarkArea = (WatermarkAreaBox) watermarkArea
190:                        .derive(deepDerive);
191:                box.watermarkArea.setLogicalPage(box);
192:                //    box.subFlows.clear();
193:                //
194:                //    for (int i = 0; i < subFlows.size(); i++)
195:                //    {
196:                //      NormalFlowRenderBox flowRenderBox = (NormalFlowRenderBox) subFlows.get(i);
197:                //      box.subFlows.add(flowRenderBox.deriveForAdvance(deepDerive));
198:                //    }
199:
200:                return box;
201:            }
202:
203:            /**
204:             * Derives an hibernation copy. The resulting object should get stripped of
205:             * all unnecessary caching information and all objects, which will be
206:             * regenerated when the layouting restarts. Size does matter here.
207:             *
208:             * @return
209:             */
210:            public RenderNode hibernate() {
211:                final LogicalPageBox box = (LogicalPageBox) super .hibernate();
212:                box.headerArea = (PageAreaBox) headerArea.hibernate();
213:                box.headerArea.setLogicalPage(box);
214:                box.footerArea = (PageAreaBox) footerArea.hibernate();
215:                box.footerArea.setLogicalPage(box);
216:                box.watermarkArea = (WatermarkAreaBox) watermarkArea
217:                        .hibernate();
218:                box.watermarkArea.setLogicalPage(box);
219:
220:                //    box.subFlows.clear();
221:                //
222:                //    for (int i = 0; i < subFlows.size(); i++)
223:                //    {
224:                //      NormalFlowRenderBox flowRenderBox = (NormalFlowRenderBox) subFlows.get(i);
225:                //      box.subFlows.add(flowRenderBox.hibernate());
226:                //    }
227:
228:                return box;
229:            }
230:
231:            /**
232:             * Clones this node. Be aware that cloning can get you into deep trouble, as
233:             * the relations this node has may no longer be valid.
234:             *
235:             * @return
236:             */
237:            public Object clone() {
238:                try {
239:                    final LogicalPageBox o = (LogicalPageBox) super .clone();
240:                    o.pageGrid = (DefaultPageGrid) pageGrid.clone();
241:                    o.allVerticalBreaks = allVerticalBreaks;
242:                    return o;
243:                } catch (CloneNotSupportedException e) {
244:                    throw new IllegalStateException(
245:                            "Cloning *must* be supported.");
246:                }
247:            }
248:
249:            public void setAllVerticalBreaks(
250:                    final PageBreakPositionList allVerticalBreaks) {
251:                this .allVerticalBreaks = allVerticalBreaks;
252:            }
253:
254:            public PageBreakPositionList getAllVerticalBreaks() {
255:                return allVerticalBreaks;
256:            }
257:
258:            public long computePageEnd() {
259:                final long pageOffset = getPageOffset();
260:                final PageBreakPositionList allVerticalBreaks = getAllVerticalBreaks();
261:                final long lastMasterBreak = allVerticalBreaks
262:                        .getLastMasterBreak();
263:                if (pageOffset == lastMasterBreak) {
264:                    return getHeight();
265:                }
266:
267:                return allVerticalBreaks
268:                        .findNextMajorBreakPosition(pageOffset + 1);
269:            }
270:
271:            public String getPageName() {
272:                return pageName;
273:            }
274:
275:            public void setPageName(final String pageName) {
276:                this.pageName = pageName;
277:            }
278:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.