jeremias    2003/11/22 11:48:21

  Modified:    src/java/org/apache/fop/tools/anttasks Fop.java
  Log:
  New feature for the Ant task: relativebase="true" uses the directory of each FO-file 
in a fileset as basedir. This is in contrast to the general basedir parameter.
  Submitted by: Joe DeVivo <fop.at.joedevivo.com>
  
  Revision  Changes    Path
  1.10      +28 -2     xml-fop/src/java/org/apache/fop/tools/anttasks/Fop.java
  
  Index: Fop.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/tools/anttasks/Fop.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Fop.java  22 Aug 2003 17:42:42 -0000      1.9
  +++ Fop.java  22 Nov 2003 19:48:21 -0000      1.10
  @@ -85,6 +85,8 @@
    * <li>format -> MIME type of the format to generate ex. "application/pdf"</li>
    * <li>outfile -> output filename</li>
    * <li>baseDir -> directory to work from</li>
  + * <li>relativebase -> (true | false) control whether to use each FO's 
  + *      directory as base directory. false uses the baseDir parameter.</li>
    * <li>userconfig -> file with user configuration (same as the "-c" command
    *      line option)</li>
    * <li>messagelevel -> (error | warn | info | verbose | debug) level to output
  @@ -105,6 +107,7 @@
       private int messageType = Project.MSG_VERBOSE;
       private boolean logFiles = true;
       private boolean force = false;
  +    private boolean relativebase = false;
   
       /**
        * Sets the filename for the userconfig.xml.
  @@ -155,6 +158,25 @@
       }
   
       /**
  +     * Set whether to include files (external-grpahics, instream-foreign-object)
  +     * from a path relative to the .fo file (true) or the working directory (false, 
default)
  +     * only useful for filesets
  +     *
  +     * @param relbase true if paths are relative to file.
  +     */
  +    public void setRelativebase(boolean relbase) {
  +        this.relativebase = relbase;
  +    }
  +    
  +    /**
  +     * Gets the relative base attribute
  +     * @return the relative base attribute
  +     */
  +    public boolean getRelativebase() {
  +        return relativebase;
  +    }
  +
  +    /**
        * Set whether to check dependencies, or to always generate;
        * optional, default is false.
        *
  @@ -429,7 +451,6 @@
                   if (task.getOutdir() != null) {
                       outf = new File(task.getOutdir(), outf.getName());
                   }
  -                
                   // Render if "force" flag is set OR 
                   // OR output file doesn't exist OR
                   // output file is older than input file
  @@ -437,7 +458,8 @@
                       || (task.getFofile().lastModified() > outf.lastModified() )) {
                       render(task.getFofile(), outf, rint);
                       actioncount++;
  -                } else if (outf.exists() && (task.getFofile().lastModified() <= 
outf.lastModified() )) {
  +                } else if (outf.exists() 
  +                        && (task.getFofile().lastModified() <= outf.lastModified() 
)) {
                       skippedcount++;
                   }
               }
  @@ -468,6 +490,10 @@
                   }
   
                   try {
  +                    if (task.getRelativebase()) {
  +                        this.baseURL = f.getParentFile().toURL().
  +                                         toExternalForm();
  +                    }
                       if (this.baseURL == null) {
                           this.baseURL = fs.getDir(task.getProject()).toURL().
                                             toExternalForm();
  
  
  

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

Reply via email to