Source Code Cross Referenced for InstreamForeignObject.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: InstreamForeignObject.java 554423 2007-07-08 19:47:53Z adelmelle $ */
019:
020:        package org.apache.fop.fo.flow;
021:
022:        import java.awt.geom.Point2D;
023:        import org.apache.fop.apps.FOPException;
024:        import org.apache.fop.datatypes.Length;
025:        import org.apache.fop.fo.FONode;
026:        import org.apache.fop.fo.ValidationException;
027:        import org.apache.fop.fo.XMLObj;
028:        import org.xml.sax.Locator;
029:
030:        /**
031:         * The instream-foreign-object flow formatting object.
032:         * This is an atomic inline object that contains
033:         * xml data.
034:         */
035:        public class InstreamForeignObject extends AbstractGraphics {
036:
037:            // The value of properties relevant for fo:instream-foreign-object.
038:            // All property values contained in AbstractGraphics
039:            // End of property values
040:
041:            //Additional value
042:            private Point2D intrinsicDimensions;
043:
044:            private Length intrinsicAlignmentAdjust;
045:
046:            /**
047:             * constructs an instream-foreign-object object (called by Maker).
048:             *
049:             * @param parent the parent formatting object
050:             */
051:            public InstreamForeignObject(FONode parent) {
052:                super (parent);
053:            }
054:
055:            /**
056:             * Make sure content model satisfied, if so then tell the
057:             * FOEventHandler that we are at the end of the flow.
058:             * @see org.apache.fop.fo.FONode#endOfNode
059:             */
060:            protected void endOfNode() throws FOPException {
061:                if (firstChild == null) {
062:                    missingChildElementError("one (1) non-XSL namespace child");
063:                }
064:                getFOEventHandler().foreignObject(this );
065:            }
066:
067:            /**
068:             * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
069:             * XSL Content Model: one (1) non-XSL namespace child
070:             */
071:            protected void validateChildNode(Locator loc, String nsURI,
072:                    String localName) throws ValidationException {
073:                if (FO_URI.equals(nsURI)) {
074:                    invalidChildError(loc, nsURI, localName);
075:                } else if (firstChild != null) {
076:                    tooManyNodesError(loc, "child element");
077:                }
078:            }
079:
080:            /** @see org.apache.fop.fo.FONode#getLocalName() */
081:            public String getLocalName() {
082:                return "instream-foreign-object";
083:            }
084:
085:            /**
086:             * @see org.apache.fop.fo.FObj#getNameId()
087:             */
088:            public int getNameId() {
089:                return FO_INSTREAM_FOREIGN_OBJECT;
090:            }
091:
092:            /**
093:             * Preloads the image so the intrinsic size is available.
094:             */
095:            private void prepareIntrinsicSize() {
096:                if (intrinsicDimensions == null) {
097:                    XMLObj child = (XMLObj) firstChild;
098:                    Point2D csize = new Point2D.Float(-1, -1);
099:                    intrinsicDimensions = child.getDimension(csize);
100:                    if (intrinsicDimensions == null) {
101:                        log
102:                                .error("Intrinsic dimensions of "
103:                                        + " instream-foreign-object could not be determined");
104:                    }
105:                    intrinsicAlignmentAdjust = child
106:                            .getIntrinsicAlignmentAdjust();
107:                }
108:            }
109:
110:            /**
111:             * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicWidth()
112:             */
113:            public int getIntrinsicWidth() {
114:                prepareIntrinsicSize();
115:                if (intrinsicDimensions != null) {
116:                    return (int) (intrinsicDimensions.getX() * 1000);
117:                } else {
118:                    return 0;
119:                }
120:            }
121:
122:            /**
123:             * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicHeight()
124:             */
125:            public int getIntrinsicHeight() {
126:                prepareIntrinsicSize();
127:                if (intrinsicDimensions != null) {
128:                    return (int) (intrinsicDimensions.getY() * 1000);
129:                } else {
130:                    return 0;
131:                }
132:            }
133:
134:            /**
135:             * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicAlignmentAdjust()
136:             */
137:            public Length getIntrinsicAlignmentAdjust() {
138:                prepareIntrinsicSize();
139:                return intrinsicAlignmentAdjust;
140:            }
141:
142:            /** @see org.apache.fop.fo.FONode#addChildNode(org.apache.fop.fo.FONode) */
143:            protected void addChildNode(FONode child) throws FOPException {
144:                super .addChildNode(child);
145:            }
146:
147:            /** @return the XMLObj child node of the instream-foreign-object. */
148:            public XMLObj getChildXMLObj() {
149:                return (XMLObj) firstChild;
150:            }
151:
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.