You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by gm...@apache.org on 2004/06/26 21:37:13 UTC

cvs commit: xml-fop/test/java/org/apache/fop GenericFOPTestCase.java

gmazza      2004/06/26 12:37:13

  Modified:    src/java/org/apache/fop/apps CommandLineOptions.java
                        Driver.java FOUserAgent.java Fop.java
               src/java/org/apache/fop/fo Constants.java FOTreeBuilder.java
                        FObj.java
               src/java/org/apache/fop/fo/pagination Flow.java
                        LayoutMasterSet.java
               src/java/org/apache/fop/render/awt/viewer PreviewDialog.java
               test/java/org/apache/fop GenericFOPTestCase.java
  Log:
  1. Output constant types (RENDER_PDF, RENDER_PS, etc.) made common between
  CommandLineOptions and Driver, and factored into fo.Constants interface.
  
  2. New Driver(AWTRenderer renderer) constructor added in apps.Driver for
  the AWTRenderer (which does reloading, unique among the output types.)  Note
  reloading currently doesn't work--AWTRenderer not yet functional.
  
  3. Driver.hasData() method removed from API--a search on when it was implemented
  dates it to 2001, when reset() was coded.  Unsure of its need, and so
  removed until we have user requests for it.
  
  4. Renderers abstracted away from API in favor of just calling .setRenderer(int Rendertype),
  and configuring user-configurable options in FOUserAgent.
  
  5. Driver.setRenderer(String <renderer class name>) also dropped.  If external user
  need for it, can be re-implemented fairly easily via a "renderer override" string in FOUserAgent, for which FOTreeHandler can read and use instead.
  
  6. Validity checking added to fo:flow, and convenience functions defining the "%block;"
  parameter entity and neutral containers as defined in 6.2 of spec [1] added to FObj.
  
  [1] http://www.w3.org/TR/2001/REC-xsl-20011015/slice6.html#section-N9447-Formatting-Object-Content
  
  Revision  Changes    Path
  1.23      +35 -60    xml-fop/src/java/org/apache/fop/apps/CommandLineOptions.java
  
  Index: CommandLineOptions.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/CommandLineOptions.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- CommandLineOptions.java	25 Jun 2004 23:35:00 -0000	1.22
  +++ CommandLineOptions.java	26 Jun 2004 19:37:13 -0000	1.23
  @@ -23,6 +23,8 @@
   import java.util.Locale;
   import java.util.Vector;
   
  +import org.apache.fop.fo.Constants;
  +
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.commons.logging.impl.SimpleLog;
  @@ -30,34 +32,7 @@
   /**
    * Options parses the commandline arguments
    */
  -public class CommandLineOptions {
  -
  -    /** input / output not set */
  -    public static final int NOT_SET = 0;
  -    /** input: fo file */
  -    public static final int FO_INPUT = 1;
  -    /** input: xml+xsl file */
  -    public static final int XSLT_INPUT = 2;
  -    /** output: pdf file */
  -    public static final int PDF_OUTPUT = 1;
  -    /** output: screen using swing */
  -    public static final int AWT_OUTPUT = 2;
  -    /** output: mif file */
  -    public static final int MIF_OUTPUT = 3;
  -    /** output: sent swing rendered file to printer */
  -    public static final int PRINT_OUTPUT = 4;
  -    /** output: pcl file */
  -    public static final int PCL_OUTPUT = 5;
  -    /** output: postscript file */
  -    public static final int PS_OUTPUT = 6;
  -    /** output: text file */
  -    public static final int TXT_OUTPUT = 7;
  -    /** output: svg file */
  -    public static final int SVG_OUTPUT = 8;
  -    /** output: XML area tree */
  -    public static final int AREA_OUTPUT = 9;
  -    /** output: RTF file */
  -    public static final int RTF_OUTPUT = 10;
  +public class CommandLineOptions implements Constants {
   
       /* show configuration information */
       private Boolean showConfiguration = Boolean.FALSE;
  @@ -257,12 +232,12 @@
       }
   
       private int parseAWTOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(AWT_OUTPUT);
  +        setOutputMode(RENDER_AWT);
           return 0;
       }
   
       private int parsePDFOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(PDF_OUTPUT);
  +        setOutputMode(RENDER_PDF);
           if ((i + 1 == args.length)
                   || (args[i + 1].charAt(0) == '-')) {
               throw new FOPException("you must specify the pdf output file");
  @@ -273,7 +248,7 @@
       }
   
       private int parseMIFOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(MIF_OUTPUT);
  +        setOutputMode(RENDER_MIF);
           if ((i + 1 == args.length)
                   || (args[i + 1].charAt(0) == '-')) {
               throw new FOPException("you must specify the mif output file");
  @@ -284,7 +259,7 @@
       }
   
       private int parseRTFOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(RTF_OUTPUT);
  +        setOutputMode(RENDER_RTF);
           if ((i + 1 == args.length)
                   || (args[i + 1].charAt(0) == '-')) {
               throw new FOPException("you must specify the rtf output file");
  @@ -295,12 +270,12 @@
       }
   
       private int parsePrintOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(PRINT_OUTPUT);
  +        setOutputMode(RENDER_PRINT);
           return 0;
       }
   
       private int parsePCLOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(PCL_OUTPUT);
  +        setOutputMode(RENDER_PCL);
           if ((i + 1 == args.length)
                   || (args[i + 1].charAt(0) == '-')) {
               throw new FOPException("you must specify the pdf output file");
  @@ -311,7 +286,7 @@
       }
   
       private int parsePostscriptOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(PS_OUTPUT);
  +        setOutputMode(RENDER_PS);
           if ((i + 1 == args.length)
                   || (args[i + 1].charAt(0) == '-')) {
               throw new FOPException("you must specify the PostScript output file");
  @@ -322,7 +297,7 @@
       }
   
       private int parseTextOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(TXT_OUTPUT);
  +        setOutputMode(RENDER_TXT);
           if ((i + 1 == args.length)
                   || (args[i + 1].charAt(0) == '-')) {
               throw new FOPException("you must specify the text output file");
  @@ -333,7 +308,7 @@
       }
   
       private int parseSVGOutputOption(String[] args, int i) throws FOPException {
  -        setOutputMode(SVG_OUTPUT);
  +        setOutputMode(RENDER_SVG);
           if ((i + 1 == args.length)
                   || (args[i + 1].charAt(0) == '-')) {
               throw new FOPException("you must specify the svg output file");
  @@ -348,7 +323,7 @@
               inputmode = FO_INPUT;
               fofile = new File(args[i]);
           } else if (outputmode == NOT_SET) {
  -            outputmode = PDF_OUTPUT;
  +            outputmode = RENDER_PDF;
               outfile = new File(args[i]);
           } else {
               throw new FOPException("Don't know what to do with "
  @@ -358,7 +333,7 @@
       }
   
       private int parseAreaTreeOption(String[] args, int i) throws FOPException {
  -        setOutputMode(AREA_OUTPUT);
  +        setOutputMode(RENDER_XML);
           if ((i + 1 == args.length)
                   || (args[i + 1].charAt(0) == '-')) {
               throw new FOPException("you must specify the area-tree output file");
  @@ -388,7 +363,7 @@
               throw new FOPException("No output file specified");
           }
   
  -        if ((outputmode == AWT_OUTPUT || outputmode == PRINT_OUTPUT) && outfile != null) {
  +        if ((outputmode == RENDER_AWT || outputmode == RENDER_PRINT) && outfile != null) {
               throw new FOPException("Output file may not be specified " +
                   "for AWT or PRINT output");
           }
  @@ -446,26 +421,26 @@
           switch (outputmode) {
           case NOT_SET:
               throw new FOPException("Renderer has not been set!");
  -        case PDF_OUTPUT:
  +        case RENDER_PDF:
               return Driver.RENDER_PDF;
  -        case AWT_OUTPUT:
  +        case RENDER_AWT:
               return Driver.RENDER_AWT;
  -        case MIF_OUTPUT:
  +        case RENDER_MIF:
               return Driver.RENDER_MIF;
  -        case PRINT_OUTPUT:
  +        case RENDER_PRINT:
               return Driver.RENDER_PRINT;
  -        case PCL_OUTPUT:
  +        case RENDER_PCL:
               return Driver.RENDER_PCL;
  -        case PS_OUTPUT:
  +        case RENDER_PS:
               return Driver.RENDER_PS;
  -        case TXT_OUTPUT:
  +        case RENDER_TXT:
               return Driver.RENDER_TXT;
  -        case SVG_OUTPUT:
  +        case RENDER_SVG:
               return Driver.RENDER_SVG;
  -        case AREA_OUTPUT:
  +        case RENDER_XML:
               foUserAgent.getRendererOptions().put("fineDetail", isCoarseAreaXml());
               return Driver.RENDER_XML;
  -        case RTF_OUTPUT:
  +        case RENDER_RTF:
               return Driver.RENDER_RTF;
           default:
               throw new FOPException("Invalid Renderer setting!");
  @@ -505,7 +480,7 @@
       }
   
       /**
  -     * Returns the output mode (output format, ex. NOT_SET or PDF_OUTPUT)
  +     * Returns the output mode (output format, ex. NOT_SET or RENDER_PDF)
        * @return the output mode
        */
       public int getOutputMode() {
  @@ -653,45 +628,45 @@
           case NOT_SET:
               log.info("not set");
               break;
  -        case PDF_OUTPUT:
  +        case RENDER_PDF:
               log.info("pdf");
               log.info("output file: " + outfile.toString());
               break;
  -        case AWT_OUTPUT:
  +        case RENDER_AWT:
               log.info("awt on screen");
               if (outfile != null) {
                   log.error("awt mode, but outfile is set:");
                   log.info("out file: " + outfile.toString());
               }
               break;
  -        case MIF_OUTPUT:
  +        case RENDER_MIF:
               log.info("mif");
               log.info("output file: " + outfile.toString());
               break;
  -        case RTF_OUTPUT:
  +        case RENDER_RTF:
               log.info("rtf");
               log.info("output file: " + outfile.toString());
               break;
  -        case PRINT_OUTPUT:
  +        case RENDER_PRINT:
               log.info("print directly");
               if (outfile != null) {
                   log.error("print mode, but outfile is set:");
                   log.error("out file: " + outfile.toString());
               }
               break;
  -        case PCL_OUTPUT:
  +        case RENDER_PCL:
               log.info("pcl");
               log.info("output file: " + outfile.toString());
               break;
  -        case PS_OUTPUT:
  +        case RENDER_PS:
               log.info("PostScript");
               log.info("output file: " + outfile.toString());
               break;
  -        case TXT_OUTPUT:
  +        case RENDER_TXT:
               log.info("txt");
               log.info("output file: " + outfile.toString());
               break;
  -        case SVG_OUTPUT:
  +        case RENDER_SVG:
               log.info("svg");
               log.info("output file: " + outfile.toString());
               break;
  
  
  
  1.76      +29 -109   xml-fop/src/java/org/apache/fop/apps/Driver.java
  
  Index: Driver.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- Driver.java	25 Jun 2004 23:35:00 -0000	1.75
  +++ Driver.java	26 Jun 2004 19:37:13 -0000	1.76
  @@ -30,6 +30,7 @@
   import org.w3c.dom.Document;
   
   // FOP
  +import org.apache.fop.fo.Constants;
   import org.apache.fop.fo.ElementMapping;
   import org.apache.fop.fo.FOTreeBuilder;
   import org.apache.fop.fo.FOInputHandler;
  @@ -86,62 +87,7 @@
    * driver.render(parser, fileInputSource(args[0]));
    * </PRE>
    */
  -public class Driver {
  -
  -    /**
  -     * private constant to indicate renderer was not defined.
  -     */
  -    private static final int NOT_SET = 0;
  -
  -    /**
  -     * Render to PDF. OutputStream must be set
  -     */
  -    public static final int RENDER_PDF = 1;
  -
  -    /**
  -     * Render to a GUI window. No OutputStream neccessary
  -     */
  -    public static final int RENDER_AWT = 2;
  -
  -    /**
  -     * Render to MIF. OutputStream must be set
  -     */
  -    public static final int RENDER_MIF = 3;
  -
  -    /**
  -     * Render to XML. OutputStream must be set
  -     */
  -    public static final int RENDER_XML = 4;
  -
  -    /**
  -     * Render to PRINT. No OutputStream neccessary
  -     */
  -    public static final int RENDER_PRINT = 5;
  -
  -    /**
  -     * Render to PCL. OutputStream must be set
  -     */
  -    public static final int RENDER_PCL = 6;
  -
  -    /**
  -     * Render to Postscript. OutputStream must be set
  -     */
  -    public static final int RENDER_PS = 7;
  -
  -    /**
  -     * Render to Text. OutputStream must be set
  -     */
  -    public static final int RENDER_TXT = 8;
  -
  -    /**
  -     * Render to SVG. OutputStream must be set
  -     */
  -    public static final int RENDER_SVG = 9;
  -
  -    /**
  -     * Render to RTF. OutputStream must be set
  -     */
  -    public static final int RENDER_RTF = 10;
  +public class Driver implements Constants {
   
       /**
        * the FO tree builder
  @@ -191,6 +137,15 @@
       }
   
       /**
  +     * Constructor for AWTRenderer, which reuses the
  +     * same renderer instance for document reloading
  +     */
  +    public Driver(AWTRenderer renderer) {
  +        this();
  +        setRenderer(renderer);
  +    }
  +
  +    /**
        * Convenience constructor for directly setting input and output.
        * @param source InputSource to take the XSL-FO input from
        * @param stream Target output stream
  @@ -222,8 +177,15 @@
        */
       public void setUserAgent(FOUserAgent agent) {
           userAgent = agent;
  +        if (renderer != null) {
  +            renderer.setUserAgent(userAgent);
  +        }
       }
   
  +    /**
  +     * Get the FOUserAgent instance for this process
  +     * @return the user agent
  +     */
       public FOUserAgent getUserAgent() {
           if (userAgent == null) {
               userAgent = new FOUserAgent();
  @@ -246,14 +208,6 @@
       }
   
       /**
  -     * Indicates whether FOP has already received input data.
  -     * @return true, if input data was received
  -     */
  -    public boolean hasData() {
  -        return (treeBuilder.hasData());
  -    }
  -
  -    /**
        * Set the OutputStream to use to output the result of the Renderer
        * (if applicable)
        * @param stream the stream to output the result of rendering to
  @@ -287,7 +241,7 @@
       }
   
       /**
  -     * Shortcut to set the rendering type to use. Must be one of
  +     * Method to set the rendering type to use. Must be one of
        * <ul>
        * <li>RENDER_PDF</li>
        * <li>RENDER_AWT</li>
  @@ -307,31 +261,31 @@
           rendererType = renderer;
           switch (renderer) {
           case RENDER_PDF:
  -            setRenderer("org.apache.fop.render.pdf.PDFRenderer");
  +            setRenderer(new org.apache.fop.render.pdf.PDFRenderer());
               break;
           case RENDER_AWT:
  -            setRenderer("org.apache.fop.render.awt.AWTRenderer");
  +            setRenderer(new org.apache.fop.render.awt.AWTRenderer());
               break;
           case RENDER_PRINT:
  -            setRenderer("org.apache.fop.render.awt.AWTPrintRenderer");
  +            setRenderer(new org.apache.fop.render.awt.AWTPrintRenderer());
               break;
           case RENDER_PCL:
  -            setRenderer("org.apache.fop.render.pcl.PCLRenderer");
  +            setRenderer(new org.apache.fop.render.pcl.PCLRenderer());
               break;
           case RENDER_PS:
  -            setRenderer("org.apache.fop.render.ps.PSRenderer");
  +            setRenderer(new org.apache.fop.render.ps.PSRenderer());
               break;
           case RENDER_TXT:
  -            setRenderer("org.apache.fop.render.txt.TXTRenderer()");
  +            setRenderer(new org.apache.fop.render.txt.TXTRenderer());
               break;
           case RENDER_MIF:
               //foInputHandler will be set later
               break;
           case RENDER_XML:
  -            setRenderer("org.apache.fop.render.xml.XMLRenderer");
  +            setRenderer(new org.apache.fop.render.xml.XMLRenderer());
               break;
           case RENDER_SVG:
  -            setRenderer("org.apache.fop.render.svg.SVGRenderer");
  +            setRenderer(new org.apache.fop.render.svg.SVGRenderer());
               break;
           case RENDER_RTF:
               //foInputHandler will be set later
  @@ -346,43 +300,9 @@
        * Set the Renderer to use.
        * @param renderer the renderer instance to use
        */
  -    public void setRenderer(Renderer renderer) {
  -        // AWTStarter calls this function directly
  -        if (renderer instanceof AWTRenderer) {
  -            rendererType = RENDER_AWT;
  -        }
  +    private void setRenderer(Renderer renderer) {
           renderer.setUserAgent(getUserAgent());
  -        userAgent.setProducer("FOP Version" + Fop.getVersion());
           this.renderer = renderer;
  -    }
  -
  -    /**
  -     * Set the class name of the Renderer to use as well as the
  -     * producer string for those renderers that can make use of it.
  -     * @param rendererClassName classname of the renderer to use such as
  -     * "org.apache.fop.render.pdf.PDFRenderer"
  -     * @exception IllegalArgumentException if the classname was invalid.
  -     * @see #setRenderer(int)
  -     */
  -    public void setRenderer(String rendererClassName)
  -                throws IllegalArgumentException {
  -        try {
  -            renderer = (Renderer)Class.forName(rendererClassName).newInstance();
  -            renderer.setUserAgent(getUserAgent());
  -            userAgent.setProducer("FOP Version" + Fop.getVersion());
  -        } catch (ClassNotFoundException e) {
  -            throw new IllegalArgumentException("Could not find "
  -                                               + rendererClassName);
  -        } catch (InstantiationException e) {
  -            throw new IllegalArgumentException("Could not instantiate "
  -                                               + rendererClassName);
  -        } catch (IllegalAccessException e) {
  -            throw new IllegalArgumentException("Could not access "
  -                                               + rendererClassName);
  -        } catch (ClassCastException e) {
  -            throw new IllegalArgumentException(rendererClassName
  -                                               + " is not a renderer");
  -        }
       }
   
       /**
  
  
  
  1.11      +2 -2      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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FOUserAgent.java	25 Jun 2004 23:35:00 -0000	1.10
  +++ FOUserAgent.java	26 Jun 2004 19:37:13 -0000	1.11
  @@ -64,7 +64,7 @@
       /** Producer:  Metadata element for the system/software that produces
        * the document. (Some renderers can store this in the document.)
        */
  -    protected String producer = "FOP " + Fop.getVersion();
  +    protected String producer = "FOP Version " + Fop.getVersion();
   
       /** Creator:  Metadata element for the user that created the
        * document. (Some renderers can store this in the document.)
  
  
  
  1.15      +2 -2      xml-fop/src/java/org/apache/fop/apps/Fop.java
  
  Index: Fop.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Fop.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Fop.java	25 Jun 2004 23:35:00 -0000	1.14
  +++ Fop.java	26 Jun 2004 19:37:13 -0000	1.15
  @@ -64,7 +64,7 @@
               // System.exit(0) called to close AWT/SVG-created threads, if any.
               // AWTRenderer closes with window shutdown, so exit() should not
               // be called here
  -            if (options.getOutputMode() != CommandLineOptions.AWT_OUTPUT) {
  +            if (options.getOutputMode() != CommandLineOptions.RENDER_AWT) {
                   System.exit(0);
               }
           } catch (FOPException e) {
  
  
  
  1.7       +32 -2     xml-fop/src/java/org/apache/fop/fo/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Constants.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Constants.java	27 Feb 2004 17:57:40 -0000	1.6
  +++ Constants.java	26 Jun 2004 19:37:13 -0000	1.7
  @@ -21,8 +21,38 @@
   
   public interface Constants {
   
  +    /* These constants are used by apps.CommandLineOptions and
  +       apps.Driver to describe the input (either .FO or .XML/.XSL)
  +       and desired output (PDF, PS, AWT, etc.) of the document */
  +       
  +    /** input / output not set */
  +    int NOT_SET = 0;
  +    /** input: fo file */
  +    int FO_INPUT = 1;
  +    /** input: xml+xsl file */
  +    int XSLT_INPUT = 2;
  +    /** output: pdf file */
  +    int RENDER_PDF = 1;
  +    /** output: screen using swing */
  +    int RENDER_AWT = 2;
  +    /** output: mif file */
  +    int RENDER_MIF = 3;
  +    /** output: sent swing rendered file to printer */
  +    int RENDER_PRINT = 4;
  +    /** output: pcl file */
  +    int RENDER_PCL = 5;
  +    /** output: postscript file */
  +    int RENDER_PS = 6;
  +    /** output: text file */
  +    int RENDER_TXT = 7;
  +    /** output: svg file */
  +    int RENDER_SVG = 8;
  +    /** output: XML area tree */
  +    int RENDER_XML = 9;
  +    /** output: RTF file */
  +    int RENDER_RTF = 10;
  +    
       // element constants
  -
       int FO_BASIC_LINK = 1;
       int FO_BIDI_OVERRIDE = 2;
       int FO_BLOCK = 3;
  
  
  
  1.35      +0 -8      xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java
  
  Index: FOTreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- FOTreeBuilder.java	18 Jun 2004 11:43:25 -0000	1.34
  +++ FOTreeBuilder.java	26 Jun 2004 19:37:13 -0000	1.35
  @@ -305,14 +305,6 @@
           foInputHandler = null;
       }
   
  -    /**
  -     * Indicates if data has been processed.
  -     * @return True if data has been processed
  -     */
  -    public boolean hasData() {
  -        return (rootFObj != null);
  -    }
  -
   }
   
   // code stolen from org.apache.batik.util and modified slightly
  
  
  
  1.47      +34 -0     xml-fop/src/java/org/apache/fop/fo/FObj.java
  
  Index: FObj.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- FObj.java	16 Jun 2004 23:40:58 -0000	1.46
  +++ FObj.java	26 Jun 2004 19:37:13 -0000	1.47
  @@ -441,5 +441,39 @@
           return null;
       }
   
  +    /**
  +     * Convenience method for validity checking.  Checks if the
  +     * incoming node is a member of the "%block;" parameter entity
  +     * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
  +     * @param nsURI namespace URI of incoming invalid node
  +     * @param lName local name (i.e., no prefix) of incoming node 
  +     * @return true if a member, false if not
  +     */
  +    protected static boolean isBlockItem(String nsURI, String lName) {
  +        return (nsURI == FOElementMapping.URI && 
  +            (lName.equals("block") 
  +            || lName.equals("table") 
  +            || lName.equals("table-and-caption") 
  +            || lName.equals("block-container")
  +            || lName.equals("list-block") 
  +            || lName.equals("float")))
  +            || isNeutralItem(nsURI, lName);
  +    }
  +
  +    /**
  +     * Convenience method for validity checking.  Checks if the
  +     * incoming node is a member of the neutral item list
  +     * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
  +     * @param nsURI namespace URI of incoming invalid node
  +     * @param lName local name (i.e., no prefix) of incoming node 
  +     * @return true if a member, false if not
  +     */
  +    protected static boolean isNeutralItem(String nsURI, String lName) {
  +        return (nsURI == FOElementMapping.URI && 
  +            (lName.equals("multi-switch") 
  +            || lName.equals("multi-properties")
  +            || lName.equals("wrapper") 
  +            || lName.equals("retrieve-marker")));
  +    }
   }
   
  
  
  
  1.14      +24 -8     xml-fop/src/java/org/apache/fop/fo/pagination/Flow.java
  
  Index: Flow.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Flow.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Flow.java	16 Jun 2004 23:40:58 -0000	1.13
  +++ Flow.java	26 Jun 2004 19:37:13 -0000	1.14
  @@ -23,6 +23,7 @@
   
   // XML
   import org.xml.sax.Attributes;
  +import org.xml.sax.Locator;
   
   // FOP
   import org.apache.fop.fo.FONode;
  @@ -63,6 +64,28 @@
       }
   
       /**
  +     * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
  +     * XSL/FOP Content Model: (%block;)+
  +     */
  +    protected void validateChildNode(Locator loc, String nsURI, String localName) {
  +        if (!isBlockItem(nsURI, localName)) {
  +            invalidChildError(loc, nsURI, localName);
  +        }
  +    }
  +
  +    /**
  +     * Make sure content model satisfied, if so then tell the
  +     * StructureRenderer that we are at the end of the flow.
  +     * @see org.apache.fop.fo.FONode#end
  +     */
  +    protected void end() {
  +        if (children == null) {
  +            missingChildElementError("(%block;)+");
  +        }
  +        getFOInputHandler().endFlow(this);
  +    }
  +
  +    /**
        * @see org.apache.fop.fo.FObj#addProperties
        */
       protected void addProperties(Attributes attlist) throws FOPException {
  @@ -93,13 +116,6 @@
           //pageSequence.addFlow(this);
   
           getFOInputHandler().startFlow(this);
  -    }
  -
  -    /**
  -     * Tell the StructureRenderer that we are at the end of the flow.
  -     */
  -    protected void end() {
  -        getFOInputHandler().endFlow(this);
       }
   
       /**
  
  
  
  1.13      +1 -1      xml-fop/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
  
  Index: LayoutMasterSet.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LayoutMasterSet.java	20 Jun 2004 07:46:13 -0000	1.12
  +++ LayoutMasterSet.java	26 Jun 2004 19:37:13 -0000	1.13
  @@ -74,7 +74,7 @@
        */
       protected void end() {
           if (children == null) {
  -           missingChildElementError("(simple-page-master|page-sequence-master)+");
  +            missingChildElementError("(simple-page-master|page-sequence-master)+");
           }
       }
   
  
  
  
  1.3       +2 -3      xml-fop/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java
  
  Index: PreviewDialog.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PreviewDialog.java	27 Feb 2004 17:51:22 -0000	1.2
  +++ PreviewDialog.java	26 Jun 2004 19:37:13 -0000	1.3
  @@ -384,8 +384,7 @@
       private class Reloader extends Thread {
           public void run() {
               if (driver == null) {
  -                driver = new Driver();
  -                driver.setRenderer(renderer);
  +                driver = new Driver(renderer);
               } else {
                   driver.reset();
               }
  
  
  
  1.4       +3 -4      xml-fop/test/java/org/apache/fop/GenericFOPTestCase.java
  
  Index: GenericFOPTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/test/java/org/apache/fop/GenericFOPTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GenericFOPTestCase.java	25 Jun 2004 23:35:00 -0000	1.3
  +++ GenericFOPTestCase.java	26 Jun 2004 19:37:13 -0000	1.4
  @@ -112,16 +112,15 @@
   
       private void renderPDF(String fo, String digestIn, String digestOut)
           throws Exception {
  -        PDFRenderer renderer = new PDFRenderer();
           FOUserAgent foUserAgent = new FOUserAgent();
           foUserAgent.setCreationDate(new Date(10000));
  -        renderer.setUserAgent(foUserAgent);
           MessageDigest outDigest = MessageDigest.getInstance("MD5");
           ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
           DigestOutputStream out =
               new DigestOutputStream(new ByteArrayOutputStream(), outDigest);
           Driver driver = new Driver();
  -        driver.setRenderer(renderer);
  +        driver.setUserAgent(foUserAgent);
  +        driver.setRenderer(Driver.RENDER_PDF);
           driver.setOutputStream(out);
           InputSource source = new InputSource(new StringReader(fo));
           DigestFilter filter = new DigestFilter("MD5");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org