vmote       2003/08/28 10:27:42

  Modified:    src/java/org/apache/fop/apps FOUserAgent.java
               src/java/org/apache/fop/render AbstractRenderer.java
               src/java/org/apache/fop/render/pdf PDFRenderer.java
               src/java/org/apache/fop/render/ps PSRenderer.java
               src/java/org/apache/fop/render/svg SVGRenderer.java
               src/java/org/apache/fop/render/xml XMLRenderer.java
  Log:
  move renderXML() from apps/FOUserAgent to render/AbstractRenderer
  
  Revision  Changes    Path
  1.3       +1 -40     xml-fop/src/java/org/apache/fop/apps/FOUserAgent.java
  
  Index: FOUserAgent.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/FOUserAgent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FOUserAgent.java  28 Aug 2003 17:13:22 -0000      1.2
  +++ FOUserAgent.java  28 Aug 2003 17:27:42 -0000      1.3
  @@ -55,17 +55,12 @@
   import java.io.IOException;
   import java.io.InputStream;
   
  -// XML
  -import org.w3c.dom.Document;
  -
   // Avalon
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.Logger;
   
   // FOP
   import org.apache.fop.pdf.PDFEncryptionParams;
  -import org.apache.fop.render.XMLHandler;
  -import org.apache.fop.render.RendererContext;
   
   /**
    * The User Agent for fo.
  @@ -186,40 +181,6 @@
        */
       public boolean linkToFootnotes() {
           return true;
  -    }
  -
  -    /**
  -     * Render the xml document with the given xml namespace.
  -     * The Render Context is by the handle to render into the current
  -     * rendering target.
  -     * @param ctx rendering context
  -     * @param doc DOM Document containing the source document
  -     * @param namespace Namespace URI of the document
  -     */
  -    public void renderXML(RendererContext ctx, Document doc,
  -                          String namespace) {
  -        String mime = ctx.getMimeType();
  -        Map mh = (Map) handlers.get(mime);
  -        XMLHandler handler = null;
  -        if (mh != null) {
  -            handler = (XMLHandler) mh.get(namespace);
  -        }
  -        if (handler == null) {
  -            handler = (XMLHandler) defaults.get(mime);
  -        }
  -        if (handler != null) {
  -            try {
  -                handler.handleXML(ctx, doc, namespace);
  -            } catch (Throwable t) {
  -                // could not handle document
  -                getLogger().error("Some XML content will be ignored. "
  -                        + "Could not render XML", t);
  -            }
  -        } else {
  -            // no handler found for document
  -            getLogger().warn("Some XML content will be ignored. "
  -                    + "No handler defined for XML: " + namespace);
  -        }
       }
   
   }
  
  
  
  1.10      +37 -0     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractRenderer.java     28 Aug 2003 17:13:22 -0000      1.9
  +++ AbstractRenderer.java     28 Aug 2003 17:27:42 -0000      1.10
  @@ -58,6 +58,9 @@
   import java.util.List;
   import java.util.Iterator;
   
  +// XML
  +import org.w3c.dom.Document;
  +
   // FOP
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.area.Area;
  @@ -700,6 +703,40 @@
               foua.handlers.put(mime, mh);
           }
           mh.put(ns, handler);
  +    }
  +
  +    /**
  +     * Render the xml document with the given xml namespace.
  +     * The Render Context is by the handle to render into the current
  +     * rendering target.
  +     * @param ctx rendering context
  +     * @param doc DOM Document containing the source document
  +     * @param namespace Namespace URI of the document
  +     */
  +    public void renderXML(FOUserAgent foua, RendererContext ctx, Document doc,
  +                          String namespace) {
  +        String mime = ctx.getMimeType();
  +        Map mh = (Map) foua.handlers.get(mime);
  +        XMLHandler handler = null;
  +        if (mh != null) {
  +            handler = (XMLHandler) mh.get(namespace);
  +        }
  +        if (handler == null) {
  +            handler = (XMLHandler) foua.defaults.get(mime);
  +        }
  +        if (handler != null) {
  +            try {
  +                handler.handleXML(ctx, doc, namespace);
  +            } catch (Throwable t) {
  +                // could not handle document
  +                getLogger().error("Some XML content will be ignored. "
  +                        + "Could not render XML", t);
  +            }
  +        } else {
  +            // no handler found for document
  +            getLogger().warn("Some XML content will be ignored. "
  +                    + "No handler defined for XML: " + namespace);
  +        }
       }
   
   }
  
  
  
  1.14      +1 -1      xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PDFRenderer.java  28 Aug 2003 17:13:22 -0000      1.13
  +++ PDFRenderer.java  28 Aug 2003 17:27:42 -0000      1.14
  @@ -1190,7 +1190,7 @@
                               new Integer((int) pos.getWidth()));
           context.setProperty(PDFXMLHandler.PDF_HEIGHT,
                               new Integer((int) pos.getHeight()));
  -        userAgent.renderXML(context, doc, ns);
  +        renderXML(userAgent, context, doc, ns);
   
       }
   
  
  
  
  1.13      +1 -1      xml-fop/src/java/org/apache/fop/render/ps/PSRenderer.java
  
  Index: PSRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSRenderer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PSRenderer.java   28 Aug 2003 17:13:22 -0000      1.12
  +++ PSRenderer.java   28 Aug 2003 17:27:42 -0000      1.13
  @@ -885,7 +885,7 @@
           context.setProperty(PDFXMLHandler.PDF_HEIGHT,
                               new Integer((int) pos.getHeight()));
           */
  -        userAgent.renderXML(context, doc, ns);
  +        renderXML(userAgent, context, doc, ns);
   
       }
   
  
  
  
  1.9       +1 -1      xml-fop/src/java/org/apache/fop/render/svg/SVGRenderer.java
  
  Index: SVGRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/svg/SVGRenderer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SVGRenderer.java  28 Aug 2003 17:13:22 -0000      1.8
  +++ SVGRenderer.java  28 Aug 2003 17:27:42 -0000      1.9
  @@ -354,7 +354,7 @@
       public void renderForeignObject(ForeignObject fo) {
           org.w3c.dom.Document doc = fo.getDocument();
           String ns = fo.getNameSpace();
  -        userAgent.renderXML(context, doc, ns);
  +        renderXML(userAgent, context, doc, ns);
       }
   
       /**
  
  
  
  1.9       +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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XMLRenderer.java  28 Aug 2003 17:13:22 -0000      1.8
  +++ XMLRenderer.java  28 Aug 2003 17:27:42 -0000      1.9
  @@ -429,7 +429,7 @@
           org.w3c.dom.Document doc = fo.getDocument();
           String ns = fo.getNameSpace();
           context.setProperty(XMLXMLHandler.WRITER, writer);
  -        userAgent.renderXML(context, doc, ns);
  +        renderXML(userAgent, context, doc, ns);
           writeEndTag("</foreignObject>");
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to