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 vm...@apache.org on 2003/10/10 17:40:31 UTC

cvs commit: xml-fop/src/java/org/apache/fop/image ImageFactory.java

vmote       2003/10/10 08:40:31

  Modified:    src/java/org/apache/fop/area AreaTree.java
                        AreaTreeControl.java
               src/java/org/apache/fop/fo/pagination LayoutMasterSet.java
                        PageSequence.java
               src/java/org/apache/fop/image ImageFactory.java
  Log:
  open up access in misc places by either adding accessor methods or by loosening acess control
  
  Revision  Changes    Path
  1.6       +4 -0      xml-fop/src/java/org/apache/fop/area/AreaTree.java
  
  Index: AreaTree.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTree.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AreaTree.java	6 Oct 2003 16:38:48 -0000	1.5
  +++ AreaTree.java	10 Oct 2003 15:40:31 -0000	1.6
  @@ -284,4 +284,8 @@
           return data;
       }
   
  +    public AreaTreeControl getAreaTreeControl() {
  +        return atControl;
  +    }
  +
   }
  
  
  
  1.2       +10 -1     xml-fop/src/java/org/apache/fop/area/AreaTreeControl.java
  
  Index: AreaTreeControl.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTreeControl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AreaTreeControl.java	6 Oct 2003 16:38:48 -0000	1.1
  +++ AreaTreeControl.java	10 Oct 2003 15:40:31 -0000	1.2
  @@ -57,6 +57,9 @@
   // Avalon
   import org.apache.avalon.framework.logger.Logger;
   
  +// Java
  +import java.util.Set;
  +
   /**
    * An interface for classes that are conceptually the parent class of the
    * area.AreaTree object. The purpose of the interface is to keep the AreaTree
  @@ -75,5 +78,11 @@
        * @return the Logger being used with this FO Tree
        */
       Logger getLogger();
  +
  +    /**
  +     * The current set of IDs in the document.
  +     * @return the Set of IDReferences in the document.
  +     */
  +    Set getIDReferences();
   
   }
  
  
  
  1.4       +2 -2      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LayoutMasterSet.java	16 Sep 2003 05:21:06 -0000	1.3
  +++ LayoutMasterSet.java	10 Oct 2003 15:40:31 -0000	1.4
  @@ -176,7 +176,7 @@
        * duplicate, that it maps to the same region-class.
        * @throws FOPException if there's a name duplication
        */
  -    protected void checkRegionNames() throws FOPException {
  +    public void checkRegionNames() throws FOPException {
           Map allRegions = new java.util.HashMap();
           for (Iterator spm = simplePageMasters.values().iterator();
                   spm.hasNext();) {
  @@ -210,7 +210,7 @@
        * @param regionName name of the region
        * @return true when the region name specified has a region in this LayoutMasterSet
        */
  -    protected boolean regionNameExists(String regionName) {
  +    public boolean regionNameExists(String regionName) {
           for (Iterator e = simplePageMasters.values().iterator();
                   e.hasNext();) {
               if (((SimplePageMaster)e.next()).regionNameExists(regionName)) {
  
  
  
  1.15      +12 -12    xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java
  
  Index: PageSequence.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PageSequence.java	19 Sep 2003 18:17:40 -0000	1.14
  +++ PageSequence.java	10 Oct 2003 15:40:31 -0000	1.15
  @@ -70,10 +70,10 @@
       //
       // intial-page-number types
       //
  -    private static final int EXPLICIT = 0;
  -    private static final int AUTO = 1;
  -    private static final int AUTO_EVEN = 2;
  -    private static final int AUTO_ODD = 3;
  +    public static final int EXPLICIT = 0;
  +    public static final int AUTO = 1;
  +    public static final int AUTO_EVEN = 2;
  +    public static final int AUTO_ODD = 3;
   
       //
       // associations
  @@ -96,7 +96,7 @@
       /**
        * Map of flows to their flow name (flow-name, Flow)
        */
  -    private HashMap flowMap;
  +    public HashMap flowMap;
   
       // according to communication from Paul Grosso (XSL-List,
       // 001228, Number 406), confusion in spec section 6.4.5 about
  @@ -113,19 +113,19 @@
   
       // page number and related formatting variables
       private String ipnValue;
  -    private int currentPageNumber = 0;
  +    public int currentPageNumber = 0;
       private int explicitFirstNumber = 0; // explicitly specified
  -    private int firstPageNumber = 0; // actual
  -    private PageNumberGenerator pageNumberGenerator;
  +    public int firstPageNumber = 0; // actual
  +    public PageNumberGenerator pageNumberGenerator;
   
  -    private int forcePageCount = 0;
  +    public int forcePageCount = 0;
       private int pageCount = 0;
       private boolean isForcing = false;
   
       /**
        * specifies page numbering type (auto|auto-even|auto-odd|explicit)
        */
  -    private int pageNumberType;
  +    public int pageNumberType;
   
       /**
        * used to determine whether to calculate auto, auto-even, auto-odd
  @@ -139,8 +139,8 @@
        * The pageSequenceMaster is null if master-reference refers to a
        * simple-page-master.
        */
  -    private SimplePageMaster simplePageMaster;
  -    private PageSequenceMaster pageSequenceMaster;
  +    public SimplePageMaster simplePageMaster;
  +    public PageSequenceMaster pageSequenceMaster;
   
       /**
        * The main content flow for this page-sequence.
  
  
  
  1.3       +28 -28    xml-fop/src/java/org/apache/fop/image/ImageFactory.java
  
  Index: ImageFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/image/ImageFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ImageFactory.java	22 Aug 2003 17:42:41 -0000	1.2
  +++ ImageFactory.java	10 Oct 2003 15:40:31 -0000	1.3
  @@ -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
    *    apache@apache.org.
  - * 
  + *
    * 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,12 +42,12 @@
    * (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 <jt...@jtauber.com>. For more information on the Apache
    * Software Foundation, please see <http://www.apache.org/>.
  - */ 
  + */
   package org.apache.fop.image;
   
   // Java
  @@ -74,9 +74,9 @@
    * @author Eric SCHAEFFER
    */
   public class ImageFactory {
  -    
  +
       private static ImageFactory factory = new ImageFactory();
  -    
  +
       private ImageCache cache = new ContextImageCache(true);
   
       private ImageFactory() {
  @@ -161,7 +161,7 @@
        * @param ua the user agent context
        * @return the fop image instance
        */
  -    protected static FopImage loadImage(String href, FOUserAgent ua) {
  +    public static FopImage loadImage(String href, FOUserAgent ua) {
           Logger log = ua.getLogger();
   
           InputStream in = openStream(href, ua);
  @@ -176,7 +176,7 @@
               imgInfo = ImageReaderFactory.make(
                             href, in, ua);
           } catch (Exception e) {
  -            log.error("Error while recovering image information (" 
  +            log.error("Error while recovering image information ("
                       + href + ") : " + e.getMessage(), e);
               return null;
           }
  @@ -187,7 +187,7 @@
               } catch (Exception e) {
                   log.debug("Error closing the InputStream for the image", e);
               }
  -            log.error("No ImageReader for this type of image (" 
  +            log.error("No ImageReader for this type of image ("
                       + href + ")");
               return null;
           }
  @@ -195,7 +195,7 @@
           String imgMimeType = imgInfo.mimeType;
           String imgClassName = getImageClassName(imgMimeType);
           if (imgClassName == null) {
  -            log.error("Unsupported image type (" 
  +            log.error("Unsupported image type ("
                       + href + "): " + imgMimeType);
               return null;
           }
  @@ -222,18 +222,18 @@
               } else {
                   msg = ex.getMessage();
               }
  -            log.error("Error creating FopImage object (" 
  +            log.error("Error creating FopImage object ("
                       + href + "): " + msg, (t == null) ? ex : t);
               return null;
           } catch (Exception ex) {
  -            log.error("Error creating FopImage object (" 
  +            log.error("Error creating FopImage object ("
                       + href + "): " + ex.getMessage(), ex);
               return null;
           }
           if (!(imageInstance instanceof org.apache.fop.image.FopImage)) {
  -            log.error("Error creating FopImage object (" 
  -                    + href + "): " + "class " 
  -                    + imageClass.getName() 
  +            log.error("Error creating FopImage object ("
  +                    + href + "): " + "class "
  +                    + imageClass.getName()
                       + " doesn't implement org.apache.fop.image.FopImage interface");
               return null;
           }
  @@ -254,7 +254,7 @@
           try {
               in = ua.getStream(href);
           } catch (IOException ioe) {
  -            log.error("Error while opening stream for (" 
  +            log.error("Error while opening stream for ("
                       + href + "): " + ioe.getMessage(), ioe);
               return null;
           }
  @@ -277,7 +277,7 @@
               } catch (Exception e) {
                   // maybe relative
                   if (ua.getBaseURL() == null) {
  -                    log.error("Error with image URL: " + e.getMessage() 
  +                    log.error("Error with image URL: " + e.getMessage()
                               + " and no base URL is specified", e);
                       return null;
                   }
  @@ -285,7 +285,7 @@
                       absoluteURL = new URL(ua.getBaseURL() + absoluteURL.getFile());
                   } catch (MalformedURLException e_context) {
                       // pb context url
  -                    log.error("Invalid Image URL - error on relative URL: " 
  +                    log.error("Invalid Image URL - error on relative URL: "
                               + e_context.getMessage(), e_context);
                       return null;
                   }
  @@ -300,11 +300,11 @@
                   log.error("Could not resolve URI for image: " + href);
                   return null;
               }
  -            
  +
               //Decorate the InputStream with a BufferedInputStream
               return new java.io.BufferedInputStream(in);
           } catch (Exception e) {
  -            log.error("Error while opening stream for (" 
  +            log.error("Error while opening stream for ("
                       + href + "): " + e.getMessage(), e);
               return null;
           }
  @@ -346,7 +346,7 @@
    * This keeps track of invalid images.
    */
   class BasicImageCache implements ImageCache {
  -    
  +
       private Set invalid = Collections.synchronizedSet(new java.util.HashSet());
       private Map contextStore = Collections.synchronizedMap(new java.util.HashMap());
   
  @@ -385,7 +385,7 @@
    * weak hashmap so they may be garbage collected.
    */
   class ContextImageCache implements ImageCache {
  -    
  +
       // if this cache is collective then images can be shared
       // among contexts, this implies that the base directory
       // is either the same or does not effect the images being
  
  
  

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