Source Code Cross Referenced for ParagraphRenderBox.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:         * ParagraphRenderBox.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.ElementAlignment;
032:        import org.jfree.report.layout.model.context.BoxDefinition;
033:        import org.jfree.report.layout.style.ParagraphPoolboxStyleSheet;
034:        import org.jfree.report.style.ElementStyleKeys;
035:        import org.jfree.report.style.StyleSheet;
036:        import org.jfree.report.util.InstanceID;
037:
038:        /**
039:         * Creation-Date: 03.04.2007, 13:38:00
040:         *
041:         * @author Thomas Morgner
042:         */
043:        public class ParagraphRenderBox extends BlockRenderBox {
044:            private static class LineBoxRenderBox extends BlockRenderBox {
045:                protected LineBoxRenderBox(final StyleSheet styleSheet,
046:                        final Object stateKey) {
047:                    super (styleSheet, BoxDefinition.EMPTY, stateKey);
048:                }
049:            }
050:
051:            private ParagraphPoolBox pool;
052:            private LineBoxRenderBox lineboxContainer;
053:            private ElementAlignment textAlignment;
054:            private ElementAlignment lastLineAlignment;
055:            private long lineBoxAge;
056:            private long minorLayoutAge;
057:            private int poolSize;
058:            private Object rawValue;
059:
060:            public ParagraphRenderBox(final StyleSheet styleSheet,
061:                    final BoxDefinition boxDefinition, final Object stateKey) {
062:                super (styleSheet, boxDefinition, stateKey);
063:
064:                pool = new ParagraphPoolBox(new ParagraphPoolboxStyleSheet(
065:                        styleSheet), stateKey);
066:                pool.setParent(this );
067:
068:                //    // yet another helper box. Level 2
069:                //    lineboxContainer = new LineBoxRenderBox(styleSheet);
070:                //    lineboxContainer.setParent(this);
071:
072:                // level 3 means: Add all lineboxes to the paragraph
073:                // This gets auto-generated ..
074:                this .textAlignment = (ElementAlignment) styleSheet
075:                        .getStyleProperty(ElementStyleKeys.ALIGNMENT,
076:                                ElementAlignment.LEFT);
077:                this .lastLineAlignment = textAlignment;
078:            }
079:
080:            //
081:            //  public void appyStyle(LayoutContext context, OutputProcessorMetaData metaData)
082:            //  {
083:            //    super.appyStyle(context, metaData);
084:            //    CSSValue alignVal = context.getValue(TextStyleKeys.TEXT_ALIGN);
085:            //    CSSValue alignLastVal = context.getValue(TextStyleKeys.TEXT_ALIGN_LAST);
086:            //    this.textAlignment = createAlignment(alignVal);
087:            //    if (textAlignment == TextAlign.JUSTIFY)
088:            //    {
089:            //      this.lastLineAlignment = createAlignment(alignLastVal);
090:            //    }
091:            //    else
092:            //    {
093:            //      this.lastLineAlignment = textAlignment;
094:            //    }
095:            //
096:            //    pool.appyStyle(context, metaData);
097:            //    lineboxContainer.appyStyle(context, metaData);
098:            //  }
099:
100:            /**
101:             * Derive creates a disconnected node that shares all the properties of the original node. The derived node will no
102:             * longer have any parent, silbling, child or any other relationships with other nodes.
103:             *
104:             * @return
105:             */
106:            public RenderNode derive(final boolean deepDerive) {
107:                final ParagraphRenderBox box = (ParagraphRenderBox) super 
108:                        .derive(deepDerive);
109:                box.pool = (ParagraphPoolBox) pool.derive(deepDerive);
110:                box.pool.setParent(box);
111:
112:                if (lineboxContainer != null) {
113:                    box.lineboxContainer = (LineBoxRenderBox) lineboxContainer
114:                            .derive(deepDerive);
115:                    box.lineboxContainer.setParent(box);
116:                }
117:                if (!deepDerive) {
118:                    box.lineBoxAge = 0;
119:                }
120:                return box;
121:            }
122:
123:            /**
124:             * Derive creates a disconnected node that shares all the properties of the original node. The derived node will no
125:             * longer have any parent, silbling, child or any other relationships with other nodes.
126:             *
127:             * @return
128:             */
129:            public RenderNode hibernate() {
130:                final ParagraphRenderBox box = (ParagraphRenderBox) super 
131:                        .derive(false);
132:                box.setHibernated(true);
133:                box.pool = (ParagraphPoolBox) pool.hibernate();
134:                box.pool.setParent(box);
135:                if (lineboxContainer != null) {
136:                    box.lineboxContainer = (LineBoxRenderBox) lineboxContainer
137:                            .hibernate();
138:                }
139:                box.lineBoxAge = 0;
140:                return box;
141:            }
142:
143:            public final void addChild(final RenderNode child) {
144:                pool.addChild(child);
145:            }
146:
147:            protected void addDirectly(final RenderNode child) {
148:                if (child instanceof  ParagraphPoolBox) {
149:                    final ParagraphPoolBox poolBox = (ParagraphPoolBox) child;
150:                    poolBox.trim();
151:                }
152:                super .addGeneratedChild(child);
153:            }
154:
155:            /**
156:             * Removes all children.
157:             */
158:            public final void clear() {
159:                pool.clear();
160:                if (lineboxContainer != null) {
161:                    lineboxContainer.clear();
162:                }
163:                super .clear();
164:                lineBoxAge = 0;
165:            }
166:
167:            public final void clearLayout() {
168:                super .clear();
169:                minorLayoutAge = 0;
170:                //lineBoxAge = 0;
171:            }
172:
173:            public boolean isAppendable() {
174:                return pool.isAppendable();
175:            }
176:
177:            public boolean isEmpty() {
178:                return pool.isEmpty();
179:            }
180:
181:            public boolean isDiscardable() {
182:                return pool.isDiscardable();
183:            }
184:
185:            public ElementAlignment getLastLineAlignment() {
186:                return lastLineAlignment;
187:            }
188:
189:            public ElementAlignment getTextAlignment() {
190:                return textAlignment;
191:            }
192:
193:            public RenderBox getLineboxContainer() {
194:                return lineboxContainer;
195:            }
196:
197:            public boolean isComplexParagraph() {
198:                return lineboxContainer != null;
199:            }
200:
201:            public RenderBox createLineboxContainer() {
202:                if (lineboxContainer == null) {
203:                    this .lineboxContainer = new LineBoxRenderBox(pool
204:                            .getStyleSheet(), getStateKey());
205:                    this .lineboxContainer.setParent(this );
206:                }
207:                return lineboxContainer;
208:            }
209:
210:            public ParagraphPoolBox getPool() {
211:                return pool;
212:            }
213:
214:            public long getLineBoxAge() {
215:                return lineBoxAge;
216:            }
217:
218:            public void setLineBoxAge(final long lineBoxAge) {
219:                this .lineBoxAge = lineBoxAge;
220:            }
221:
222:            public long getMinorLayoutAge() {
223:                return minorLayoutAge;
224:            }
225:
226:            public void setMinorLayoutAge(final long minorLayoutAge) {
227:                this .minorLayoutAge = minorLayoutAge;
228:            }
229:
230:            /**
231:             * The public-id for the paragraph is the pool-box.
232:             *
233:             * @return
234:             */
235:            public InstanceID getInstanceId() {
236:                return pool.getInstanceId();
237:            }
238:
239:            public int getPoolSize() {
240:                return poolSize;
241:            }
242:
243:            public void setPoolSize(final int poolSize) {
244:                this .poolSize = poolSize;
245:            }
246:
247:            public void setRawValue(final Object rawValue) {
248:                this .rawValue = rawValue;
249:            }
250:
251:            public Object getRawValue() {
252:                return rawValue;
253:            }
254:
255:            public void close() {
256:                pool.close();
257:                super.close();
258:            }
259:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.