vmote 2003/09/10 11:42:23
Modified: src/java/org/apache/fop/area/inline Character.java
InlineArea.java InlineParent.java Leader.java
Space.java Viewport.java Word.java
src/java/org/apache/fop/render AbstractRenderer.java
src/java/org/apache/fop/render/xml XMLRenderer.java
Added: src/java/org/apache/fop/area/inline InlineAreaVisitor.java
Log:
add InlineAreaVisitor interface to make Area Tree more independent of Rendering
Revision Changes Path
1.2 +15 -16 xml-fop/src/java/org/apache/fop/area/inline/Character.java
Index: Character.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/inline/Character.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Character.java 11 Mar 2003 13:05:40 -0000 1.1
+++ Character.java 10 Sep 2003 18:42:22 -0000 1.2
@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,16 +42,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.area.inline;
-import org.apache.fop.render.Renderer;
-
/**
* Single character inline area.
* This inline area holds a single character.
@@ -69,12 +67,13 @@
}
/**
- * Render this inline area.
+ * Handle InlineAreaVisitor request by passing this back to it.
*
- * @param renderer the renderer to render this character area
+ * @param visitor the InlineAreaVisitor wishing to process this.
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
*/
- public void render(Renderer renderer) {
- renderer.renderCharacter(this);
+ public void acceptVisitor(InlineAreaVisitor visitor) {
+ visitor.serveVisitor(this);
}
/**
1.2 +15 -16 xml-fop/src/java/org/apache/fop/area/inline/InlineArea.java
Index: InlineArea.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/inline/InlineArea.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InlineArea.java 11 Mar 2003 13:05:40 -0000 1.1
+++ InlineArea.java 10 Sep 2003 18:42:22 -0000 1.2
@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,17 +42,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.area.inline;
import org.apache.fop.area.Area;
import org.apache.fop.area.Trait;
-import org.apache.fop.render.Renderer;
import org.apache.fop.traits.BorderProps;
/**
@@ -76,14 +75,14 @@
protected int verticalPosition = 0;
/**
- * Render this inline area.
+ * Handle a visitor (usually a renderer) for this inline area.
* Inline areas that extend this class are expected
- * to implement this method to render themselves in
- * the renderer.
+ * to pass themselves back to the visitor so that the visitor can process
+ * them, usually by rendering them.
*
- * @param renderer the renderer to render this inline area
+ * @param visitor the InlineAreaVisitor that will process this
*/
- public void render(Renderer renderer) {
+ public void acceptVisitor(InlineAreaVisitor visitor) {
}
/**
1.2 +15 -15 xml-fop/src/java/org/apache/fop/area/inline/InlineParent.java
Index: InlineParent.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/inline/InlineParent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InlineParent.java 11 Mar 2003 13:05:40 -0000 1.1
+++ InlineParent.java 10 Sep 2003 18:42:22 -0000 1.2
@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,16 +42,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.area.inline;
import org.apache.fop.area.Area;
-import org.apache.fop.render.Renderer;
import java.util.List;
import java.util.ArrayList;
@@ -78,12 +77,13 @@
}
/**
- * Render this area.
+ * Handle InlineAreaVisitor request by passing this back to it.
*
- * @param renderer the renderer to render this area in
+ * @param visitor the InlineAreaVisitor wishing to process this.
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
*/
- public void render(Renderer renderer) {
- renderer.renderInlineParent(this);
+ public void acceptVisitor(InlineAreaVisitor visitor) {
+ visitor.serveVisitor(this);
}
/**
1.2 +16 -15 xml-fop/src/java/org/apache/fop/area/inline/Leader.java
Index: Leader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/inline/Leader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Leader.java 11 Mar 2003 13:05:40 -0000 1.1
+++ Leader.java 10 Sep 2003 18:42:22 -0000 1.2
@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,15 +42,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.area.inline;
-import org.apache.fop.render.Renderer;
import org.apache.fop.fo.properties.RuleStyle;
/**
@@ -110,12 +109,14 @@
}
/**
- * Render this leader in the current renderer.
+ * Handle InlineAreaVisitor request by passing this back to it.
*
- * @param renderer the renderer to render this inline area
+ * @param visitor the InlineAreaVisitor wishing to process this.
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
*/
- public void render(Renderer renderer) {
- renderer.renderLeader(this);
+ public void acceptVisitor(InlineAreaVisitor visitor) {
+ visitor.serveVisitor(this);
}
+
}
1.2 +16 -16 xml-fop/src/java/org/apache/fop/area/inline/Space.java
Index: Space.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/inline/Space.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Space.java 11 Mar 2003 13:05:40 -0000 1.1
+++ Space.java 10 Sep 2003 18:42:22 -0000 1.2
@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,16 +42,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.area.inline;
-import org.apache.fop.render.Renderer;
-
/**
* Inline space area.
* This is used for adding a inline space to the output.
@@ -59,11 +57,13 @@
public class Space extends InlineArea {
/**
- * Render this inlien space area.
+ * Handle InlineAreaVisitor request by passing this back to it.
*
- * @param renderer the renderer to render this inline area
+ * @param visitor the InlineAreaVisitor wishing to process this.
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
*/
- public void render(Renderer renderer) {
- renderer.renderInlineSpace(this);
+ public void acceptVisitor(InlineAreaVisitor visitor) {
+ visitor.serveVisitor(this);
}
+
}
1.2 +15 -15 xml-fop/src/java/org/apache/fop/area/inline/Viewport.java
Index: Viewport.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/inline/Viewport.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Viewport.java 11 Mar 2003 13:05:40 -0000 1.1
+++ Viewport.java 10 Sep 2003 18:42:22 -0000 1.2
@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,16 +42,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.area.inline;
import org.apache.fop.area.Area;
-import org.apache.fop.render.Renderer;
import java.io.IOException;
import java.awt.geom.Rectangle2D;
@@ -126,12 +125,13 @@
}
/**
- * Render this inline area.
+ * Handle InlineAreaVisitor request by passing this back to it.
*
- * @param renderer the renderer to render this inline area
+ * @param visitor the InlineAreaVisitor wishing to process this.
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
*/
- public void render(Renderer renderer) {
- renderer.renderViewport(this);
+ public void acceptVisitor(InlineAreaVisitor visitor) {
+ visitor.serveVisitor(this);
}
private void writeObject(java.io.ObjectOutputStream out)
1.2 +15 -16 xml-fop/src/java/org/apache/fop/area/inline/Word.java
Index: Word.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/inline/Word.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Word.java 11 Mar 2003 13:05:40 -0000 1.1
+++ Word.java 10 Sep 2003 18:42:22 -0000 1.2
@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [EMAIL PROTECTED]
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,16 +42,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.area.inline;
-import org.apache.fop.render.Renderer;
-
/**
* A word inline area.
* This is really a collection character inline areas collected together
@@ -71,12 +69,13 @@
}
/**
- * Render the word to the renderer.
+ * Handle InlineAreaVisitor request by passing this back to it.
*
- * @param renderer the renderer to render this word
+ * @param visitor the InlineAreaVisitor wishing to process this.
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
*/
- public void render(Renderer renderer) {
- renderer.renderWord(this);
+ public void acceptVisitor(InlineAreaVisitor visitor) {
+ visitor.serveVisitor(this);
}
/**
1.1
xml-fop/src/java/org/apache/fop/area/inline/InlineAreaVisitor.java
Index: InlineAreaVisitor.java
===================================================================
/*
* $Id: InlineAreaVisitor.java,v 1.1 2003/09/10 18:42:22 vmote Exp $
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
*
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
*
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <[EMAIL PROTECTED]>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.fop.area.inline;
/**
* <p>Implements the GoF Visitor design pattern to allow access to inline areas
* without knowing what subclass of InlineArea is being accessed. This is used
* primarily to keep the area tree classes isolated from any classes (typically
* renderers) that might need access to them.</p>
*/
public interface InlineAreaVisitor {
/**
* Handle a visitor request to process an inline viewport.
*
* @param viewport The viewport area
*/
void serveVisitor(Viewport viewport);
/**
* Handle a visitor request to process an inline word.
*
* @param area The word area
*/
void serveVisitor(Word area);
/**
* Handle a visitor request to process an inline parent area.
*
* @param ip The inline parent area
*/
void serveVisitor(InlineParent ip);
/**
* Handle a visitor request to process an inline character.
*
* @param ch The inline character
*/
void serveVisitor(org.apache.fop.area.inline.Character ch);
/**
* Handle a visitor request to process an inline space.
*
* @param space The inline space
*/
void serveVisitor(Space space);
/**
* Handle a visitor request to process an inline leader area.
*
* @param area The inline leader area.
*/
void serveVisitor(Leader area);
}
1.13 +76 -3 xml-fop/src/java/org/apache/fop/render/AbstractRenderer.java
Index: AbstractRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/AbstractRenderer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AbstractRenderer.java 1 Sep 2003 14:19:34 -0000 1.12
+++ AbstractRenderer.java 10 Sep 2003 18:42:22 -0000 1.13
@@ -84,6 +84,7 @@
import org.apache.fop.area.inline.ForeignObject;
import org.apache.fop.area.inline.Image;
import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.area.inline.InlineAreaVisitor;
import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.area.inline.Leader;
import org.apache.fop.area.inline.Space;
@@ -106,7 +107,7 @@
* handle viewports. This keeps track of the current block and inline position.
*/
public abstract class AbstractRenderer extends AbstractLogEnabled
- implements Renderer, Configurable {
+ implements Renderer, Configurable, InlineAreaVisitor {
/**
* user agent
@@ -552,7 +553,7 @@
for (int count = 0; count < children.size(); count++) {
InlineArea inline = (InlineArea) children.get(count);
- inline.render(this);
+ inline.acceptVisitor(this);
}
}
@@ -640,7 +641,7 @@
int saveIP = currentBlockIPPosition;
Iterator iter = ip.getChildAreas().iterator();
while (iter.hasNext()) {
- ((InlineArea) iter.next()).render(this);
+ ((InlineArea) iter.next()).acceptVisitor(this);
}
currentBlockIPPosition = saveIP + ip.getWidth();
}
@@ -736,6 +737,78 @@
getLogger().warn("Some XML content will be ignored. "
+ "No handler defined for XML: " + namespace);
}
+ }
+
+ /**
+ * Render the specified Viewport.
+ * Required by InlineAreaVisitor interface, which is used to determine which
+ * InlineArea subclass should be rendered.
+ *
+ * @param viewport The Viewport area to be rendered
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
+ */
+ public void serveVisitor(Viewport viewport) {
+ renderViewport(viewport);
+ }
+
+ /**
+ * Render the specified Word.
+ * Required by InlineAreaVisitor interface, which is used to determine which
+ * InlineArea subclass should be rendered.
+ *
+ * @param area The Word area to be rendered
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
+ */
+ public void serveVisitor(Word area) {
+ renderWord(area);
+ }
+
+ /**
+ * Render the specified InlineParent.
+ * Required by InlineAreaVisitor interface, which is used to determine which
+ * InlineArea subclass should be rendered.
+ *
+ * @param ip The InlineParent area to be rendered
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
+ */
+ public void serveVisitor(InlineParent ip) {
+ renderInlineParent(ip);
+ }
+
+ /**
+ * Render the specified Character.
+ * Required by InlineAreaVisitor interface, which is used to determine which
+ * InlineArea subclass should be rendered.
+ *
+ * @param ch The Character area to be rendered
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
+ */
+ public void serveVisitor(org.apache.fop.area.inline.Character ch) {
+ renderCharacter(ch);
+ }
+
+ /**
+ * Render the specified Space.
+ * Required by InlineAreaVisitor interface, which is used to determine which
+ * InlineArea subclass should be rendered.
+ *
+ * @param space The Space area to be rendered
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
+ */
+ public void serveVisitor(Space space) {
+ renderInlineSpace(space);
+ }
+
+ /**
+ * Render the specified Leader.
+ * Required by InlineAreaVisitor interface, which is used to determine which
+ * InlineArea subclass should be rendered.
+ *
+ * @param area The Leader area to be rendered
+ * @see org.apache.fop.area.inline.InlineAreaVisitor
+ */
+ public void serveVisitor(Leader area) {
+ renderLeader(area);
}
}
1.10 +1 -1 xml-fop/src/java/org/apache/fop/render/xml/XMLRenderer.java
Index: XMLRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/xml/XMLRenderer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XMLRenderer.java 28 Aug 2003 17:27:42 -0000 1.9
+++ XMLRenderer.java 10 Sep 2003 18:42:22 -0000 1.10
@@ -274,7 +274,7 @@
for (int count = 0; count < children.size(); count++) {
InlineArea inline = (InlineArea) children.get(count);
- inline.render(this);
+ inline.acceptVisitor(this);
}
writeEndTag("</title>");
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]