Source Code Cross Referenced for Block.java in  » Graphic-Library » fop » org » apache » fop » fo » flow » 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 » Graphic Library » fop » org.apache.fop.fo.flow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        /* $Id: Block.java 554094 2007-07-07 00:04:25Z adelmelle $ */
019:
020:        package org.apache.fop.fo.flow;
021:
022:        import java.awt.Color;
023:
024:        import org.xml.sax.Locator;
025:
026:        import org.apache.fop.apps.FOPException;
027:        import org.apache.fop.datatypes.Length;
028:        import org.apache.fop.datatypes.Numeric;
029:        import org.apache.fop.fo.CharIterator;
030:        import org.apache.fop.fo.FONode;
031:        import org.apache.fop.fo.FObjMixed;
032:        import org.apache.fop.fo.NullCharIterator;
033:        import org.apache.fop.fo.PropertyList;
034:        import org.apache.fop.fo.ValidationException;
035:        import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
036:        import org.apache.fop.fo.properties.CommonFont;
037:        import org.apache.fop.fo.properties.CommonHyphenation;
038:        import org.apache.fop.fo.properties.CommonMarginBlock;
039:        import org.apache.fop.fo.properties.CommonRelativePosition;
040:        import org.apache.fop.fo.properties.KeepProperty;
041:        import org.apache.fop.fo.properties.SpaceProperty;
042:
043:        /**
044:         * Class modelling the fo:block object.
045:         */
046:        public class Block extends FObjMixed {
047:
048:            // used for FO validation
049:            private boolean blockOrInlineItemFound = false;
050:            private boolean initialPropertySetFound = false;
051:
052:            // The value of properties relevant for fo:block.
053:            private CommonBorderPaddingBackground commonBorderPaddingBackground;
054:            private CommonFont commonFont;
055:            private CommonHyphenation commonHyphenation;
056:            private CommonMarginBlock commonMarginBlock;
057:            private CommonRelativePosition commonRelativePosition;
058:            private int breakAfter;
059:            private int breakBefore;
060:            private Color color;
061:            private int hyphenationKeep;
062:            private Numeric hyphenationLadderCount;
063:            private int intrusionDisplace;
064:            private KeepProperty keepTogether;
065:            private KeepProperty keepWithNext;
066:            private KeepProperty keepWithPrevious;
067:            private Length lastLineEndIndent;
068:            private int linefeedTreatment;
069:            private SpaceProperty lineHeight;
070:            private int lineHeightShiftAdjustment;
071:            private int lineStackingStrategy;
072:            private Numeric orphans;
073:            private int whiteSpaceTreatment;
074:            private int span;
075:            private int textAlign;
076:            private int textAlignLast;
077:            private Length textIndent;
078:            private int whiteSpaceCollapse;
079:            private Numeric widows;
080:            private int wrapOption;
081:
082:            // Unused but valid items, commented out for performance:
083:            //     private CommonAccessibility commonAccessibility;
084:            //     private CommonAural commonAural;
085:            //     private Length textDepth;
086:            //     private Length textAltitude;
087:            //     private int visibility;
088:            // End of property values
089:
090:            /**
091:             * @param parent FONode that is the parent of this object
092:             *
093:             */
094:            public Block(FONode parent) {
095:                super (parent);
096:            }
097:
098:            /**
099:             * @see org.apache.fop.fo.FObj#bind(PropertyList)
100:             */
101:            public void bind(PropertyList pList) throws FOPException {
102:                super .bind(pList);
103:                commonBorderPaddingBackground = pList
104:                        .getBorderPaddingBackgroundProps();
105:                commonFont = pList.getFontProps();
106:                commonHyphenation = pList.getHyphenationProps();
107:                commonMarginBlock = pList.getMarginBlockProps();
108:                commonRelativePosition = pList.getRelativePositionProps();
109:
110:                breakAfter = pList.get(PR_BREAK_AFTER).getEnum();
111:                breakBefore = pList.get(PR_BREAK_BEFORE).getEnum();
112:                color = pList.get(PR_COLOR).getColor(getUserAgent());
113:                hyphenationKeep = pList.get(PR_HYPHENATION_KEEP).getEnum();
114:                hyphenationLadderCount = pList.get(PR_HYPHENATION_LADDER_COUNT)
115:                        .getNumeric();
116:                intrusionDisplace = pList.get(PR_INTRUSION_DISPLACE).getEnum();
117:                keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
118:                keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep();
119:                keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep();
120:                lastLineEndIndent = pList.get(PR_LAST_LINE_END_INDENT)
121:                        .getLength();
122:                linefeedTreatment = pList.get(PR_LINEFEED_TREATMENT).getEnum();
123:                lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
124:                lineHeightShiftAdjustment = pList.get(
125:                        PR_LINE_HEIGHT_SHIFT_ADJUSTMENT).getEnum();
126:                lineStackingStrategy = pList.get(PR_LINE_STACKING_STRATEGY)
127:                        .getEnum();
128:                orphans = pList.get(PR_ORPHANS).getNumeric();
129:                whiteSpaceTreatment = pList.get(PR_WHITE_SPACE_TREATMENT)
130:                        .getEnum();
131:                span = pList.get(PR_SPAN).getEnum();
132:                textAlign = pList.get(PR_TEXT_ALIGN).getEnum();
133:                textAlignLast = pList.get(PR_TEXT_ALIGN_LAST).getEnum();
134:                textIndent = pList.get(PR_TEXT_INDENT).getLength();
135:                whiteSpaceCollapse = pList.get(PR_WHITE_SPACE_COLLAPSE)
136:                        .getEnum();
137:                widows = pList.get(PR_WIDOWS).getNumeric();
138:                wrapOption = pList.get(PR_WRAP_OPTION).getEnum();
139:            }
140:
141:            /**
142:             * @see org.apache.fop.fo.FONode#startOfNode
143:             */
144:            protected void startOfNode() throws FOPException {
145:                super .startOfNode();
146:                getFOEventHandler().startBlock(this );
147:            }
148:
149:            /**
150:             * @see org.apache.fop.fo.FONode#endOfNode
151:             */
152:            protected void endOfNode() throws FOPException {
153:                super .endOfNode();
154:                getFOEventHandler().endBlock(this );
155:            }
156:
157:            /**
158:             * @return the Common Margin Properties-Block.
159:             */
160:            public CommonMarginBlock getCommonMarginBlock() {
161:                return commonMarginBlock;
162:            }
163:
164:            /**
165:             * @return the Common Border, Padding, and Background Properties.
166:             */
167:            public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
168:                return commonBorderPaddingBackground;
169:            }
170:
171:            /**
172:             * @return the Common Font Properties.
173:             */
174:            public CommonFont getCommonFont() {
175:                return commonFont;
176:            }
177:
178:            /**
179:             * @return the Common Hyphenation Properties.
180:             */
181:            public CommonHyphenation getCommonHyphenation() {
182:                return commonHyphenation;
183:            }
184:
185:            /** @return the "break-after" property. */
186:            public int getBreakAfter() {
187:                return breakAfter;
188:            }
189:
190:            /** @return the "break-before" property. */
191:            public int getBreakBefore() {
192:                return breakBefore;
193:            }
194:
195:            /** @return the "hyphenation-ladder-count" property.  */
196:            public Numeric getHyphenationLadderCount() {
197:                return hyphenationLadderCount;
198:            }
199:
200:            /** @return the "keep-with-next" property.  */
201:            public KeepProperty getKeepWithNext() {
202:                return keepWithNext;
203:            }
204:
205:            /** @return the "keep-with-previous" property.  */
206:            public KeepProperty getKeepWithPrevious() {
207:                return keepWithPrevious;
208:            }
209:
210:            /** @return the "keep-together" property.  */
211:            public KeepProperty getKeepTogether() {
212:                return keepTogether;
213:            }
214:
215:            /** @return the "orphans" property.  */
216:            public int getOrphans() {
217:                return orphans.getValue();
218:            }
219:
220:            /** @return the "widows" property.  */
221:            public int getWidows() {
222:                return widows.getValue();
223:            }
224:
225:            /** @return the "line-stacking-strategy" property.  */
226:            public int getLineStackingStrategy() {
227:                return lineStackingStrategy;
228:            }
229:
230:            /**
231:             * @return the "color" property.
232:             */
233:            public Color getColor() {
234:                return color;
235:            }
236:
237:            /**
238:             * @return the "line-height" property.
239:             */
240:            public SpaceProperty getLineHeight() {
241:                return lineHeight;
242:            }
243:
244:            /**
245:             * @return the "span" property.
246:             */
247:            public int getSpan() {
248:                return this .span;
249:            }
250:
251:            /**
252:             * @return the "text-align" property.
253:             */
254:            public int getTextAlign() {
255:                return textAlign;
256:            }
257:
258:            /**
259:             * @return the "text-align-last" property.
260:             */
261:            public int getTextAlignLast() {
262:                return textAlignLast;
263:            }
264:
265:            /**
266:             * @return the "text-indent" property.
267:             */
268:            public Length getTextIndent() {
269:                return textIndent;
270:            }
271:
272:            /**
273:             * @return the "last-line-end-indent" property.
274:             */
275:            public Length getLastLineEndIndent() {
276:                return lastLineEndIndent;
277:            }
278:
279:            /**
280:             * @return the "wrap-option" property.
281:             */
282:            public int getWrapOption() {
283:                return wrapOption;
284:            }
285:
286:            /**
287:             * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
288:             * XSL Content Model: marker* initial-property-set? (#PCDATA|%inline;|%block;)*
289:             * Additionally: "An fo:bidi-override that is a descendant of an fo:leader
290:             *  or of the fo:inline child of an fo:footnote may not have block-level
291:             *  children, unless it has a nearer ancestor that is an 
292:             *  fo:inline-container."
293:             */
294:            protected void validateChildNode(Locator loc, String nsURI,
295:                    String localName) throws ValidationException {
296:                if (FO_URI.equals(nsURI)) {
297:                    if (localName.equals("marker")) {
298:                        if (blockOrInlineItemFound || initialPropertySetFound) {
299:                            nodesOutOfOrderError(loc, "fo:marker",
300:                                    "initial-property-set? (#PCDATA|%inline;|%block;)");
301:                        }
302:                    } else if (localName.equals("initial-property-set")) {
303:                        if (initialPropertySetFound) {
304:                            tooManyNodesError(loc, "fo:initial-property-set");
305:                        } else if (blockOrInlineItemFound) {
306:                            nodesOutOfOrderError(loc,
307:                                    "fo:initial-property-set",
308:                                    "(#PCDATA|%inline;|%block;)");
309:                        } else {
310:                            initialPropertySetFound = true;
311:                        }
312:                    } else if (isBlockOrInlineItem(nsURI, localName)) {
313:                        blockOrInlineItemFound = true;
314:                    } else {
315:                        invalidChildError(loc, nsURI, localName);
316:                    }
317:                }
318:            }
319:
320:            /**
321:             * Accessor for the linefeed-treatment property
322:             * 
323:             * @return the enum value of linefeed-treatment
324:             */
325:            public int getLinefeedTreatment() {
326:                return linefeedTreatment;
327:            }
328:
329:            /**
330:             * Accessor for the white-space-treatment property
331:             * 
332:             * @return the enum value of white-space-treatment
333:             */
334:            public int getWhitespaceTreatment() {
335:                return whiteSpaceTreatment;
336:            }
337:
338:            /**
339:             * Accessor for the white-space-collapse property
340:             * 
341:             * @return the enum value of white-space-collapse
342:             */
343:            public int getWhitespaceCollapse() {
344:                return whiteSpaceCollapse;
345:            }
346:
347:            /**
348:             * @return Returns the commonRelativePosition.
349:             */
350:            public CommonRelativePosition getCommonRelativePosition() {
351:                return this .commonRelativePosition;
352:            }
353:
354:            /**
355:             * @return Returns the hyphenationKeep.
356:             */
357:            public int getHyphenationKeep() {
358:                return this .hyphenationKeep;
359:            }
360:
361:            /**
362:             * @return Returns the intrusionDisplace.
363:             */
364:            public int getIntrusionDisplace() {
365:                return this .intrusionDisplace;
366:            }
367:
368:            /**
369:             * @return Returns the lineHeightShiftAdjustment.
370:             */
371:            public int getLineHeightShiftAdjustment() {
372:                return this .lineHeightShiftAdjustment;
373:            }
374:
375:            /** @see org.apache.fop.fo.FONode#charIterator() */
376:            public CharIterator charIterator() {
377:                return NullCharIterator.getInstance();
378:            }
379:
380:            /** @see org.apache.fop.fo.FONode#getLocalName() */
381:            public String getLocalName() {
382:                return "block";
383:            }
384:
385:            /**
386:             * @see org.apache.fop.fo.FObj#getNameId()
387:             */
388:            public int getNameId() {
389:                return FO_BLOCK;
390:            }
391:
392:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.