Source Code Cross Referenced for Region.java in  » Graphic-Library » fop » org » apache » fop » fo » pagination » 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.pagination 
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: Region.java 426576 2006-07-28 15:44:37Z jeremias $ */
019:
020:        package org.apache.fop.fo.pagination;
021:
022:        import java.awt.Rectangle;
023:
024:        import org.xml.sax.Locator;
025:
026:        import org.apache.fop.apps.FOPException;
027:        import org.apache.fop.datatypes.FODimension;
028:        import org.apache.fop.datatypes.Numeric;
029:        import org.apache.fop.fo.FONode;
030:        import org.apache.fop.fo.FObj;
031:        import org.apache.fop.fo.PropertyList;
032:        import org.apache.fop.fo.ValidationException;
033:        import org.apache.fop.fo.expr.PropertyException;
034:        import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
035:
036:        /**
037:         * This is an abstract base class for pagination regions
038:         */
039:        public abstract class Region extends FObj {
040:            // The value of properties relevant for fo:region
041:            private CommonBorderPaddingBackground commonBorderPaddingBackground;
042:            // private ToBeImplementedProperty clip
043:            private int displayAlign;
044:            private int overflow;
045:            private String regionName;
046:            private Numeric referenceOrientation;
047:            private int writingMode;
048:            // End of property values
049:
050:            private SimplePageMaster layoutMaster;
051:
052:            /**
053:             * @see org.apache.fop.fo.FONode#FONode(FONode)
054:             */
055:            protected Region(FONode parent) {
056:                super (parent);
057:                layoutMaster = (SimplePageMaster) parent;
058:            }
059:
060:            /**
061:             * @see org.apache.fop.fo.FObj#bind(PropertyList)
062:             */
063:            public void bind(PropertyList pList) throws FOPException {
064:                commonBorderPaddingBackground = pList
065:                        .getBorderPaddingBackgroundProps();
066:                // clip = pList.get(PR_CLIP);
067:                displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum();
068:                overflow = pList.get(PR_OVERFLOW).getEnum();
069:                regionName = pList.get(PR_REGION_NAME).getString();
070:                referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION)
071:                        .getNumeric();
072:                writingMode = pList.getWritingMode();
073:
074:                // regions may have name, or default
075:                if (regionName.equals("")) {
076:                    regionName = getDefaultRegionName();
077:                } else {
078:                    // check that name is OK. Not very pretty.
079:                    if (isReserved(getRegionName())
080:                            && !getRegionName().equals(getDefaultRegionName())) {
081:                        throw new ValidationException("region-name '"
082:                                + regionName + "' for " + this .getName()
083:                                + " is not permitted.", locator);
084:                    }
085:                }
086:
087:                //TODO do we need context for getBPPaddingAndBorder() and getIPPaddingAndBorder()?
088:                if (getUserAgent().validateStrictly()
089:                        && (getCommonBorderPaddingBackground()
090:                                .getBPPaddingAndBorder(false, null) != 0 || getCommonBorderPaddingBackground()
091:                                .getIPPaddingAndBorder(false, null) != 0)) {
092:                    throw new PropertyException(
093:                            "Border and padding for region \"" + regionName
094:                                    + "\" must be '0' (See 6.4.13 in XSL 1.0).");
095:                }
096:            }
097:
098:            /**
099:             * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
100:             * XSL Content Model: empty
101:             */
102:            protected void validateChildNode(Locator loc, String nsURI,
103:                    String localName) throws ValidationException {
104:                invalidChildError(loc, nsURI, localName);
105:            }
106:
107:            /**
108:             * @param pageRefRect reference dimension of the page area.
109:             * @param spm the simple page master this region belongs to.
110:             * @return the rectangle for the viewport area
111:             */
112:            public abstract Rectangle getViewportRectangle(
113:                    FODimension pageRefRect, SimplePageMaster spm);
114:
115:            /**
116:             * Returns the default region name (xsl-region-before, xsl-region-start,
117:             * etc.)
118:             * @return the default region name
119:             */
120:            protected abstract String getDefaultRegionName();
121:
122:            /**
123:             * Checks to see if a given region name is one of the reserved names
124:             *
125:             * @param name a region name to check
126:             * @return true if the name parameter is a reserved region name
127:             */
128:            protected boolean isReserved(String name) /*throws FOPException*/{
129:                return (name.equals("xsl-region-before")
130:                        || name.equals("xsl-region-start")
131:                        || name.equals("xsl-region-end")
132:                        || name.equals("xsl-region-after")
133:                        || name.equals("xsl-before-float-separator") || name
134:                        .equals("xsl-footnote-separator"));
135:            }
136:
137:            /**
138:             * @see org.apache.fop.fo.FObj#generatesReferenceAreas()
139:             */
140:            public boolean generatesReferenceAreas() {
141:                return true;
142:            }
143:
144:            /**
145:             * Returns a sibling region for this region.
146:             * @param regionId the Constants ID of the FO representing the region
147:             * @return the requested region
148:             */
149:            protected Region getSiblingRegion(int regionId) {
150:                // Ask parent for region
151:                return layoutMaster.getRegion(regionId);
152:            }
153:
154:            /**
155:             * @return the Background Properties (border and padding are not used here).
156:             */
157:            public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
158:                return commonBorderPaddingBackground;
159:            }
160:
161:            /** @return the "region-name" property. */
162:            public String getRegionName() {
163:                return regionName;
164:            }
165:
166:            /** @return the "writing-mode" property. */
167:            public int getWritingMode() {
168:                return writingMode;
169:            }
170:
171:            /** @return the "overflow" property. */
172:            public int getOverflow() {
173:                return overflow;
174:            }
175:
176:            /** @return the display-align property. */
177:            public int getDisplayAlign() {
178:                return displayAlign;
179:            }
180:
181:            /** @return the "reference-orientation" property. */
182:            public int getReferenceOrientation() {
183:                return referenceOrientation.getValue();
184:            }
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.