Source Code Cross Referenced for AbstractGraphics.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: AbstractGraphics.java 554423 2007-07-08 19:47:53Z adelmelle $ */
019:
020:        package org.apache.fop.fo.flow;
021:
022:        import org.apache.fop.apps.FOPException;
023:        import org.apache.fop.datatypes.Length;
024:        import org.apache.fop.fo.FONode;
025:        import org.apache.fop.fo.FObj;
026:        import org.apache.fop.fo.PropertyList;
027:        import org.apache.fop.fo.properties.CommonAccessibility;
028:        import org.apache.fop.fo.properties.CommonAural;
029:        import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
030:        import org.apache.fop.fo.properties.CommonMarginInline;
031:        import org.apache.fop.fo.properties.CommonRelativePosition;
032:        import org.apache.fop.fo.properties.KeepProperty;
033:        import org.apache.fop.fo.properties.LengthRangeProperty;
034:        import org.apache.fop.fo.properties.SpaceProperty;
035:
036:        /**
037:         * Common base class for instream-foreign-object and external-graphics
038:         * flow formatting objects.
039:         */
040:        public abstract class AbstractGraphics extends FObj {
041:
042:            // The value of properties relevant for fo:instream-foreign-object
043:            // and external-graphics.
044:            private CommonBorderPaddingBackground commonBorderPaddingBackground;
045:            private Length alignmentAdjust;
046:            private int alignmentBaseline;
047:            private Length baselineShift;
048:            private LengthRangeProperty blockProgressionDimension;
049:            // private ToBeImplementedProperty clip;
050:            private Length contentHeight;
051:            private Length contentWidth;
052:            private int displayAlign;
053:            private int dominantBaseline;
054:            private Length height;
055:            private String id;
056:            private LengthRangeProperty inlineProgressionDimension;
057:            private SpaceProperty lineHeight;
058:            private int overflow;
059:            private int scaling;
060:            private int textAlign;
061:            private Length width;
062:
063:            // Unused but valid items, commented out for performance:
064:            //     private CommonAccessibility commonAccessibility;
065:            //     private CommonAural commonAural;
066:            //     private CommonMarginInline commonMarginInline;
067:            //     private CommonRelativePosition commonRelativePosition;
068:            //     private String contentType;
069:            //     private KeepProperty keepWithNext;
070:            //     private KeepProperty keepWithPrevious;
071:            //     private int scalingMethod;
072:            // End of property values
073:
074:            /**
075:             * constructs an instream-foreign-object object (called by Maker).
076:             *
077:             * @param parent the parent formatting object
078:             */
079:            public AbstractGraphics(FONode parent) {
080:                super (parent);
081:            }
082:
083:            /**
084:             * @see org.apache.fop.fo.FObj#bind(PropertyList)
085:             */
086:            public void bind(PropertyList pList) throws FOPException {
087:                commonBorderPaddingBackground = pList
088:                        .getBorderPaddingBackgroundProps();
089:                alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength();
090:                alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE).getEnum();
091:                baselineShift = pList.get(PR_BASELINE_SHIFT).getLength();
092:                blockProgressionDimension = pList.get(
093:                        PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
094:                // clip = pList.get(PR_CLIP);
095:                contentHeight = pList.get(PR_CONTENT_HEIGHT).getLength();
096:                contentWidth = pList.get(PR_CONTENT_WIDTH).getLength();
097:                displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum();
098:                dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum();
099:                height = pList.get(PR_HEIGHT).getLength();
100:                id = pList.get(PR_ID).getString();
101:                inlineProgressionDimension = pList.get(
102:                        PR_INLINE_PROGRESSION_DIMENSION).getLengthRange();
103:                lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
104:                overflow = pList.get(PR_OVERFLOW).getEnum();
105:                scaling = pList.get(PR_SCALING).getEnum();
106:                textAlign = pList.get(PR_TEXT_ALIGN).getEnum();
107:                width = pList.get(PR_WIDTH).getLength();
108:            }
109:
110:            /**
111:             * Given the ipd and the content width calculates the
112:             * required x offset based on the text-align property
113:             * @param ipd the inline-progression-dimension of the object
114:             * @param cwidth the calculated content width of the object
115:             * @return the X offset
116:             */
117:            public int computeXOffset(int ipd, int cwidth) {
118:                int xoffset = 0;
119:                switch (textAlign) {
120:                case EN_CENTER:
121:                    xoffset = (ipd - cwidth) / 2;
122:                    break;
123:                case EN_END:
124:                    xoffset = ipd - cwidth;
125:                    break;
126:                case EN_START:
127:                    break;
128:                case EN_JUSTIFY:
129:                default:
130:                    break;
131:                }
132:                return xoffset;
133:            }
134:
135:            /**
136:             * Given the bpd and the content height calculates the
137:             * required y offset based on the display-align property
138:             * @param bpd the block-progression-dimension of the object
139:             * @param cheight the calculated content height of the object
140:             * @return the Y offset
141:             */
142:            public int computeYOffset(int bpd, int cheight) {
143:                int yoffset = 0;
144:                switch (displayAlign) {
145:                case EN_BEFORE:
146:                    break;
147:                case EN_AFTER:
148:                    yoffset = bpd - cheight;
149:                    break;
150:                case EN_CENTER:
151:                    yoffset = (bpd - cheight) / 2;
152:                    break;
153:                case EN_AUTO:
154:                default:
155:                    break;
156:                }
157:                return yoffset;
158:            }
159:
160:            /**
161:             * @return the "id" property.
162:             */
163:            public String getId() {
164:                return id;
165:            }
166:
167:            /**
168:             * @return the Common Border, Padding, and Background Properties.
169:             */
170:            public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
171:                return commonBorderPaddingBackground;
172:            }
173:
174:            /**
175:             * @return the "line-height" property.
176:             */
177:            public SpaceProperty getLineHeight() {
178:                return lineHeight;
179:            }
180:
181:            /**
182:             * @return the "inline-progression-dimension" property.
183:             */
184:            public LengthRangeProperty getInlineProgressionDimension() {
185:                return inlineProgressionDimension;
186:            }
187:
188:            /**
189:             * @return the "block-progression-dimension" property.
190:             */
191:            public LengthRangeProperty getBlockProgressionDimension() {
192:                return blockProgressionDimension;
193:            }
194:
195:            /**
196:             * @return the "height" property.
197:             */
198:            public Length getHeight() {
199:                return height;
200:            }
201:
202:            /**
203:             * @return the "width" property.
204:             */
205:            public Length getWidth() {
206:                return width;
207:            }
208:
209:            /**
210:             * @return the "content-height" property.
211:             */
212:            public Length getContentHeight() {
213:                return contentHeight;
214:            }
215:
216:            /**
217:             * @return the "content-width" property.
218:             */
219:            public Length getContentWidth() {
220:                return contentWidth;
221:            }
222:
223:            /**
224:             * @return the "scaling" property.
225:             */
226:            public int getScaling() {
227:                return scaling;
228:            }
229:
230:            /**
231:             * @return the "overflow" property.
232:             */
233:            public int getOverflow() {
234:                return overflow;
235:            }
236:
237:            /**
238:             * @return the "alignment-adjust" property
239:             */
240:            public Length getAlignmentAdjust() {
241:                if (alignmentAdjust.getEnum() == EN_AUTO) {
242:                    final Length intrinsicAlignmentAdjust = this 
243:                            .getIntrinsicAlignmentAdjust();
244:                    if (intrinsicAlignmentAdjust != null) {
245:                        return intrinsicAlignmentAdjust;
246:                    }
247:                }
248:                return alignmentAdjust;
249:            }
250:
251:            /**
252:             * @return the "alignment-baseline" property
253:             */
254:            public int getAlignmentBaseline() {
255:                return alignmentBaseline;
256:            }
257:
258:            /**
259:             * @return the "baseline-shift" property
260:             */
261:            public Length getBaselineShift() {
262:                return baselineShift;
263:            }
264:
265:            /**
266:             * @return the "dominant-baseline" property
267:             */
268:            public int getDominantBaseline() {
269:                return dominantBaseline;
270:            }
271:
272:            /**
273:             * @return the graphics intrinsic width in millipoints
274:             */
275:            public abstract int getIntrinsicWidth();
276:
277:            /**
278:             * @return the graphics intrinsic height in millipoints
279:             */
280:            public abstract int getIntrinsicHeight();
281:
282:            /**
283:             * @return the graphics intrinsic alignment-adjust
284:             */
285:            public abstract Length getIntrinsicAlignmentAdjust();
286:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.