keiron      01/11/15 04:40:31

  Modified:    src/org/apache/fop/fo/pagination
                        ConditionalPageMasterReference.java
                        LayoutMasterSet.java PageMasterReference.java
                        PageSequence.java PageSequenceMaster.java
                        Region.java RepeatablePageMasterAlternatives.java
                        RepeatablePageMasterReference.java Root.java
                        SimplePageMaster.java
                        SinglePageMasterReference.java
  Log:
  some comments and cleaned up a bit
  
  Revision  Changes    Path
  1.8       +18 -10    
xml-fop/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
  
  Index: ConditionalPageMasterReference.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ConditionalPageMasterReference.java       2001/11/09 11:32:40     1.7
  +++ ConditionalPageMasterReference.java       2001/11/15 12:40:31     1.8
  @@ -1,5 +1,5 @@
   /*
  - * $Id: ConditionalPageMasterReference.java,v 1.7 2001/11/09 11:32:40 keiron Exp $
  + * $Id: ConditionalPageMasterReference.java,v 1.8 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -13,6 +13,14 @@
   
   import org.xml.sax.Attributes;
   
  +/**
  + * A conditional-page-master-reference formatting object.
  + * This is a reference to a page master with a set of conditions.
  + * The conditions must be satisfied for the referenced master to
  + * be used.
  + * This element is must be the child of a repeatable-page-master-alternatives
  + * element.
  + */
   public class ConditionalPageMasterReference extends FObj {
   
       private RepeatablePageMasterAlternatives repeatablePageMasterAlternatives;
  @@ -25,8 +33,6 @@
   
       public ConditionalPageMasterReference(FONode parent) {
           super(parent);
  -
  -        this.name = getElementName();
       }
   
       public void handleAttrs(Attributes attlist) throws FOPException {
  @@ -52,8 +58,12 @@
       public String getMasterName() {
           return masterName;
       }
  -
   
  +    /**
  +     * Check if the conditions for this reference are met.
  +     * checks the page number and emptyness to determine if this
  +     * matches.
  +     */
       protected boolean isValid(int currentPageNumber, boolean thisIsFirstPage,
                                 boolean isEmptyPage) {
           // page-position
  @@ -127,11 +137,10 @@
           return this.blankOrNotBlank;
       }
   
  -    protected String getElementName() {
  -        return "fo:conditional-page-master-reference";
  -    }
  -
  -
  +    /**
  +     * Check that the parent is the right type of formatting object
  +     * repeatable-page-master-alternatives.
  +     */
       protected void validateParent(FONode parent) throws FOPException {
           if (parent.getName().equals("fo:repeatable-page-master-alternatives")) {
               this.repeatablePageMasterAlternatives =
  @@ -149,6 +158,5 @@
                                      + parent.getName());
           }
       }
  -
   
   }
  
  
  
  1.14      +36 -8     xml-fop/src/org/apache/fop/fo/pagination/LayoutMasterSet.java
  
  Index: LayoutMasterSet.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/LayoutMasterSet.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- LayoutMasterSet.java      2001/11/14 13:45:45     1.13
  +++ LayoutMasterSet.java      2001/11/15 12:40:31     1.14
  @@ -1,5 +1,5 @@
   /*
  - * $Id: LayoutMasterSet.java,v 1.13 2001/11/14 13:45:45 keiron Exp $
  + * $Id: LayoutMasterSet.java,v 1.14 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -19,34 +19,44 @@
   
   import org.xml.sax.Attributes;
   
  +/**
  + * The layout-master-set formatting object.
  + * This class maintains the set of simple page master and
  + * page sequence masters.
  + * The masters are stored so that the page sequence can obtain
  + * the required page master to create a page.
  + * The page sequence masters can be reset as they hold state
  + * information for a page sequence.
  + */
   public class LayoutMasterSet extends FObj {
  -
       private HashMap simplePageMasters;
       private HashMap pageSequenceMasters;
       private HashMap allRegions;
   
  -    private Root root;
  -
       public LayoutMasterSet(FONode parent) {
           super(parent);
       }
   
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
  -        this.simplePageMasters = new HashMap();
  -        this.pageSequenceMasters = new HashMap();
   
           if (parent.getName().equals("fo:root")) {
  -            this.root = (Root)parent;
  +            Root root = (Root)parent;
               root.setLayoutMasterSet(this);
           } else {
               throw new FOPException("fo:layout-master-set must be child of fo:root, 
not "
                                      + parent.getName());
           }
  -        allRegions = new HashMap();
   
  +        this.simplePageMasters = new HashMap();
  +        this.pageSequenceMasters = new HashMap();
  +        allRegions = new HashMap();
       }
   
  +    /**
  +     * Add a simple page master.
  +     * The name is checked to throw an error if already added.
  +     */
       protected void addSimplePageMaster(SimplePageMaster simplePageMaster)
               throws FOPException {
           // check against duplication of master-name
  @@ -59,10 +69,19 @@
                                      simplePageMaster);
       }
   
  +    /**
  +     * Get a simple page master by name.
  +     * This is used by the page sequence to get a page master for
  +     * creating pages.
  +     */
       protected SimplePageMaster getSimplePageMaster(String masterName) {
           return (SimplePageMaster)this.simplePageMasters.get(masterName);
       }
   
  +    /**
  +     * Add a page sequence master.
  +     * The name is checked to throw an error if already added.
  +     */
       protected void addPageSequenceMaster(String masterName, PageSequenceMaster 
pageSequenceMaster)
               throws FOPException {
           // check against duplication of master-name
  @@ -73,6 +92,11 @@
           this.pageSequenceMasters.put(masterName, pageSequenceMaster);
       }
   
  +    /**
  +     * Get a page sequence master by name.
  +     * This is used by the page sequence to get a page master for 
  +     * creating pages.
  +     */
       protected PageSequenceMaster getPageSequenceMaster(String masterName) {
           return (PageSequenceMaster)this.pageSequenceMasters.get(masterName);
       }
  @@ -85,6 +109,10 @@
               return false;
       }
   
  +    /**
  +     * Reset the state of the page sequence masters.
  +     * Use when starting a new page sequence.
  +     */
       protected void resetPageMasters() {
           for (Iterator e = pageSequenceMasters.values().iterator();
                   e.hasNext(); ) {
  
  
  
  1.8       +3 -13     
xml-fop/src/org/apache/fop/fo/pagination/PageMasterReference.java
  
  Index: PageMasterReference.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageMasterReference.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PageMasterReference.java  2001/11/09 11:32:40     1.7
  +++ PageMasterReference.java  2001/11/15 12:40:31     1.8
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PageMasterReference.java,v 1.7 2001/11/09 11:32:40 keiron Exp $
  + * $Id: PageMasterReference.java,v 1.8 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -25,7 +25,6 @@
   
       public PageMasterReference(FONode parent) {
           super(parent);
  -        this.name = getElementName();
       }
   
       public void handleAttrs(Attributes attlist) throws FOPException {
  @@ -61,15 +60,6 @@
                                                boolean isEmptyPage);
   
       /**
  -     * Gets the formating object name for this object.
  -     * Subclasses must provide this.
  -     *
  -     * @return the element name of this reference.
  -     * e.g. fo:repeatable-page-master-reference
  -     */
  -    protected abstract String getElementName();
  -
  -    /**
        * Checks that the parent is the right element. The default implementation
        * checks for fo:page-sequence-master
        */
  @@ -78,13 +68,13 @@
               _pageSequenceMaster = (PageSequenceMaster)parent;
   
               if (getMasterName() == null) {
  -                log.warn("" + getElementName()
  +                log.warn("" + getName()
                                          + " does not have a master-reference and so 
is being ignored");
               } else {
                   _pageSequenceMaster.addSubsequenceSpecifier(this);
               }
           } else {
  -            throw new FOPException(getElementName() + " must be"
  +            throw new FOPException(getName() + " must be"
                                      + "child of fo:page-sequence-master, not "
                                      + parent.getName());
           }
  
  
  
  1.47      +10 -8     xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java
  
  Index: PageSequence.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- PageSequence.java 2001/11/14 13:45:45     1.46
  +++ PageSequence.java 2001/11/15 12:40:31     1.47
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PageSequence.java,v 1.46 2001/11/14 13:45:45 keiron Exp $
  + * $Id: PageSequence.java,v 1.47 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -26,7 +26,7 @@
   import org.apache.fop.layoutmgr.PageLayoutManager;
   
   // Java
  -import java.util.*;
  +import java.util.HashMap;
   
   import org.xml.sax.Attributes;
   
  @@ -286,8 +286,6 @@
       }
   
   
  -
  -
   //     /**
   //      * Return children for layout. Only the main flow is laid out directly.
   //      */
  @@ -527,10 +525,9 @@
   //     }
   
       /**
  -     * Returns the next SubSequenceSpecifier for the given page sequence master. 
The result
  -     * is bassed on the current state of this page sequence.
  +     * Returns the next SubSequenceSpecifier for the given page sequence master.
  +     * The result is bassed on the current state of this page sequence.
        */
  -    // refactored from PageSequenceMaster
       private SubSequenceSpecifier getNextSubsequence(PageSequenceMaster master) {
           if (master.getSubSequenceSpecifierCount()
                   > currentSubsequenceNumber + 1) {
  @@ -542,7 +539,6 @@
           } else {
               return null;
           }
  -
       }
   
       /**
  @@ -564,6 +560,12 @@
   
       }
   
  +    /**
  +     * Get the next page master name.
  +     * This gets the name of the next page master. If the sequence
  +     * is exhausted then an error is indicated and the last page
  +     * master name is used.
  +     */
       private String getNextPageMasterName(PageSequenceMaster sequenceMaster,
                                            int currentPageNumber,
                                            boolean thisIsFirstPage,
  
  
  
  1.9       +17 -17    xml-fop/src/org/apache/fop/fo/pagination/PageSequenceMaster.java
  
  Index: PageSequenceMaster.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequenceMaster.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PageSequenceMaster.java   2001/11/09 11:32:40     1.8
  +++ PageSequenceMaster.java   2001/11/15 12:40:31     1.9
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PageSequenceMaster.java,v 1.8 2001/11/09 11:32:40 keiron Exp $
  + * $Id: PageSequenceMaster.java,v 1.9 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -14,15 +14,19 @@
   import org.apache.fop.apps.FOPException;
   
   // Java
  -import java.util.*;
  +import java.util.ArrayList;
  +import java.util.Iterator;
   
   import org.xml.sax.Attributes;
   
  +/**
  + * The page-sequence-master formatting object.
  + * This class handles a list of subsequence specifiers
  + * which are simple or complex references to page-masters.
  + */
   public class PageSequenceMaster extends FObj {
  -
       LayoutMasterSet layoutMasterSet;
  -    Vector subSequenceSpecifiers;
  -
  +    ArrayList subSequenceSpecifiers;
   
       // The terminology may be confusing. A 'page-sequence-master' consists
       // of a sequence of what the XSL spec refers to as
  @@ -37,14 +41,14 @@
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
   
  -        subSequenceSpecifiers = new Vector();
  +        subSequenceSpecifiers = new ArrayList();
   
           if (parent.getName().equals("fo:layout-master-set")) {
               this.layoutMasterSet = (LayoutMasterSet)parent;
               String pm = this.properties.get("master-name").getString();
               if (pm == null) {
                   log.warn("page-sequence-master does not have "
  -                                       + "a page-master-name and so is being 
ignored");
  +                                       + "a master-name and so is being ignored");
               } else {
                   this.layoutMasterSet.addPageSequenceMaster(pm, this);
               }
  @@ -56,17 +60,15 @@
       }
   
       protected void addSubsequenceSpecifier(SubSequenceSpecifier 
pageMasterReference) {
  -        subSequenceSpecifiers.addElement(pageMasterReference);
  +        subSequenceSpecifiers.add(pageMasterReference);
       }
   
       protected SubSequenceSpecifier getSubSequenceSpecifier(int sequenceNumber) {
           if (sequenceNumber >= 0
                   && sequenceNumber < getSubSequenceSpecifierCount()) {
  -            return 
(SubSequenceSpecifier)subSequenceSpecifiers.elementAt(sequenceNumber);
  +            return (SubSequenceSpecifier)subSequenceSpecifiers.get(sequenceNumber);
           }
           return null;
  -
  -
       }
   
       protected int getSubSequenceSpecifierCount() {
  @@ -74,12 +76,10 @@
       }
   
       public void reset() {
  -        for (Enumeration e = subSequenceSpecifiers.elements();
  -                e.hasMoreElements(); ) {
  -            ((SubSequenceSpecifier)e.nextElement()).reset();
  +        for (Iterator e = subSequenceSpecifiers.iterator();
  +                e.hasNext(); ) {
  +            ((SubSequenceSpecifier)e.next()).reset();
           }
  -
       }
  -
  -
   }
  +
  
  
  
  1.9       +1 -6      xml-fop/src/org/apache/fop/fo/pagination/Region.java
  
  Index: Region.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Region.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Region.java       2001/11/09 22:31:50     1.8
  +++ Region.java       2001/11/15 12:40:31     1.9
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Region.java,v 1.8 2001/11/09 22:31:50 klease Exp $
  + * $Id: Region.java,v 1.9 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -19,7 +19,6 @@
   import org.apache.fop.area.RegionViewport;
   import org.apache.fop.area.RegionReference;
   
  -
   import org.xml.sax.Attributes;
   
   /**
  @@ -71,10 +70,8 @@
                                      + "of simple-page-master, not "
                                      + parent.getName());
           }
  -
       }
   
  -
       /**
        * Creates a RegionViewport Area object for this pagination Region.
        */
  @@ -101,9 +98,7 @@
   
           // this.properties.get("clip");
           // this.properties.get("display-align");
  -        // this.properties.get("overflow");
           this.overflow = this.properties.get("overflow").getEnum();
  -        // this.properties.get("region-name");
           // this.properties.get("reference-orientation");
           // this.properties.get("writing-mode");
                       
  
  
  
  1.10      +16 -9     
xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
  
  Index: RepeatablePageMasterAlternatives.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RepeatablePageMasterAlternatives.java     2001/11/09 11:32:40     1.9
  +++ RepeatablePageMasterAlternatives.java     2001/11/15 12:40:31     1.10
  @@ -1,5 +1,5 @@
   /*
  - * $Id: RepeatablePageMasterAlternatives.java,v 1.9 2001/11/09 11:32:40 keiron Exp $
  + * $Id: RepeatablePageMasterAlternatives.java,v 1.10 2001/11/15 12:40:31 keiron Exp 
$
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -11,10 +11,16 @@
   import org.apache.fop.apps.FOPException;
   
   // Java
  -import java.util.Vector;
  +import java.util.ArrayList;
   
   import org.xml.sax.Attributes;
   
  +/**
  + * A repeatable-page-master-alternatives formatting object.
  + * This contains a list of conditional-page-master-reference
  + * and the page master is found from the reference that
  + * matches the page number and emptyness.
  + */
   public class RepeatablePageMasterAlternatives extends FObj
       implements SubSequenceSpecifier {
   
  @@ -29,7 +35,7 @@
       private int maximumRepeats;
       private int numberConsumed = 0;
   
  -    private Vector conditionalPageMasterRefs;
  +    private ArrayList conditionalPageMasterRefs;
   
       public RepeatablePageMasterAlternatives(FONode parent) {
           super(parent);
  @@ -38,7 +44,7 @@
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
   
  -        conditionalPageMasterRefs = new Vector();
  +        conditionalPageMasterRefs = new ArrayList();
   
           if (parent.getName().equals("fo:page-sequence-master")) {
               this.pageSequenceMaster = (PageSequenceMaster)parent;
  @@ -60,9 +66,12 @@
                                          + "'maximum-repeats' property");
               }
           }
  -
       }
   
  +    /**
  +     * Get the next matching page master from the conditional
  +     * page master references.
  +     */
       public String getNextPageMaster(int currentPageNumber,
                                       boolean thisIsFirstPage,
                                       boolean isEmptyPage) {
  @@ -78,7 +87,7 @@
   
           for (int i = 0; i < conditionalPageMasterRefs.size(); i++) {
               ConditionalPageMasterReference cpmr =
  -                
(ConditionalPageMasterReference)conditionalPageMasterRefs.elementAt(i);
  +                (ConditionalPageMasterReference)conditionalPageMasterRefs.get(i);
   
               // 0-indexed page number
               if (cpmr.isValid(currentPageNumber + 1, thisIsFirstPage,
  @@ -96,7 +105,6 @@
           } else {
               this.maximumRepeats = (maximumRepeats < 0) ? 0 : maximumRepeats;
           }
  -
       }
   
       private int getMaximumRepeats() {
  @@ -104,13 +112,12 @@
       }
   
       public void addConditionalPageMasterReference(ConditionalPageMasterReference 
cpmr) {
  -        this.conditionalPageMasterRefs.addElement(cpmr);
  +        this.conditionalPageMasterRefs.add(cpmr);
       }
   
       public void reset() {
           this.numberConsumed = 0;
       }
  -
   
       protected PageSequenceMaster getPageSequenceMaster() {
           return pageSequenceMaster;
  
  
  
  1.6       +6 -6      
xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
  
  Index: RepeatablePageMasterReference.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RepeatablePageMasterReference.java        2001/11/09 11:32:40     1.5
  +++ RepeatablePageMasterReference.java        2001/11/15 12:40:31     1.6
  @@ -1,5 +1,5 @@
   /*
  - * $Id: RepeatablePageMasterReference.java,v 1.5 2001/11/09 11:32:40 keiron Exp $
  + * $Id: RepeatablePageMasterReference.java,v 1.6 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -12,6 +12,11 @@
   
   import org.xml.sax.Attributes;
   
  +/**
  + * A repeatable-page-master-reference formatting object.
  + * This handles a reference with a specified number of repeating
  + * instances of the referenced page master (may have no limit).
  + */
   public class RepeatablePageMasterReference extends PageMasterReference
       implements SubSequenceSpecifier {
   
  @@ -40,7 +45,6 @@
                                          + "'maximum-repeats' property");
               }
           }
  -
       }
   
       public String getNextPageMaster(int currentPageNumber,
  @@ -68,10 +72,6 @@
   
       private int getMaximumRepeats() {
           return this.maximumRepeats;
  -    }
  -
  -    protected String getElementName() {
  -        return "fo:repeatable-page-master-reference";
       }
   
       public void reset() {
  
  
  
  1.20      +2 -4      xml-fop/src/org/apache/fop/fo/pagination/Root.java
  
  Index: Root.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Root.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Root.java 2001/11/14 13:45:45     1.19
  +++ Root.java 2001/11/15 12:40:31     1.20
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Root.java,v 1.19 2001/11/14 13:45:45 keiron Exp $
  + * $Id: Root.java,v 1.20 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -13,14 +13,12 @@
   import org.apache.fop.fo.properties.*;
   import org.apache.fop.layout.AreaTree;
   import org.apache.fop.apps.FOPException;
  -import org.apache.fop.extensions.ExtensionObj;
   
   // Java
   import java.util.ArrayList;
   
   /**
  - * The fo:root formatting object. Contains page masters, root extensions,
  - * page-sequences.
  + * The fo:root formatting object. Contains page masters, page-sequences.
    */
   public class Root extends FObj {
   
  
  
  
  1.20      +18 -11    xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java
  
  Index: SimplePageMaster.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SimplePageMaster.java     2001/11/14 13:45:45     1.19
  +++ SimplePageMaster.java     2001/11/15 12:40:31     1.20
  @@ -1,5 +1,5 @@
   /*
  - * $Id: SimplePageMaster.java,v 1.19 2001/11/14 13:45:45 keiron Exp $
  + * $Id: SimplePageMaster.java,v 1.20 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -23,15 +23,17 @@
   import java.util.Iterator;
   import org.xml.sax.Attributes;
   
  -
  +/**
  + * A simple-page-master formatting object.
  + * This creates a simple page from the specified regions
  + * and attributes.
  + */
   public class SimplePageMaster extends FObj {
  -
       /**
        * Page regions (regionClass, Region)
        */
       private HashMap _regions;
   
  -    LayoutMasterSet layoutMasterSet;
       PageMaster pageMaster;
       String masterName;
   
  @@ -43,13 +45,13 @@
           super.handleAttrs(attlist);
   
           if (parent.getName().equals("fo:layout-master-set")) {
  -            this.layoutMasterSet = (LayoutMasterSet)parent;
  +            LayoutMasterSet layoutMasterSet = (LayoutMasterSet)parent;
               masterName = this.properties.get("master-name").getString();
               if (masterName == null) {
                   log.warn("simple-page-master does not have "
                                          + "a master-name and so is being ignored");
               } else {
  -                this.layoutMasterSet.addSimplePageMaster(this);
  +                layoutMasterSet.addSimplePageMaster(this);
               }
           } else {
               throw new FOPException("fo:simple-page-master must be child "
  @@ -57,9 +59,12 @@
                                      + parent.getName());
           }
           _regions = new HashMap();
  -
       }
   
  +    /**
  +     * At the end of this element read all the information and create
  +     * the page master.
  +     */
       protected void end() {
           int pageWidth =
               this.properties.get("page-width").getLength().mvalue();
  @@ -72,7 +77,7 @@
           MarginProps mProps = propMgr.getMarginProps();
   
        /* Create the page reference area rectangle in first quadrant coordinates
  -      * (ie, 0,0 is at bottom,left of the "page meida" and y increases
  +      * (ie, 0,0 is at bottom,left of the "page media" and y increases
         * when moving towards the top of the page.
         * The media rectangle itself is (0,0,pageWidth,pageHeight).
         */
  @@ -106,6 +111,10 @@
        this.pageMaster = new PageMaster(new PageViewport(page,
                                           new Rectangle(0,0,
                                                         pageWidth,pageHeight)));
  +
  +        _regions = null;
  +        children = null;
  +        properties = null;
       }
   
       public PageMaster getPageMaster() {
  @@ -120,7 +129,6 @@
           return masterName;
       }
   
  -
       protected void addChild(FONode child) {
        if (child instanceof Region) {
            addRegion((Region)child);
  @@ -162,7 +170,6 @@
               }
           }
           return false;
  -
       }
  -
   }
  +
  
  
  
  1.7       +8 -9      
xml-fop/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java
  
  Index: SinglePageMasterReference.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SinglePageMasterReference.java    2001/11/09 11:32:40     1.6
  +++ SinglePageMasterReference.java    2001/11/15 12:40:31     1.7
  @@ -1,14 +1,18 @@
   /*
  - * $Id: SinglePageMasterReference.java,v 1.6 2001/11/09 11:32:40 keiron Exp $
  + * $Id: SinglePageMasterReference.java,v 1.7 2001/11/15 12:40:31 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   package org.apache.fop.fo.pagination;
   
  -import org.apache.fop.fo.*;
  -import org.apache.fop.apps.FOPException;
  +import org.apache.fop.fo.FONode;
   
  +/**
  + * A single-page-master-reference formatting object.
  + * This is a reference for a single page. It returns the
  + * master name only once until reset.
  + */
   public class SinglePageMasterReference extends PageMasterReference
       implements SubSequenceSpecifier {
   
  @@ -31,15 +35,10 @@
           } else {
               return null;
           }
  -
       }
   
       public void reset() {
           this.state = FIRST;
       }
  -
  -    protected String getElementName() {
  -        return "fo:single-page-master-reference";
  -    }
  -
   }
  +
  
  
  

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

Reply via email to