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 ar...@locus.apache.org on 2000/07/11 04:30:24 UTC

cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java

arved       00/07/10 19:30:24

  Modified:    src/org/apache/fop/fo/pagination PageSequence.java
  Log:
  Supports March 27 2000 spec
  
  Revision  Changes    Path
  1.15      +18 -32    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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PageSequence.java	2000/06/27 22:13:59	1.14
  +++ PageSequence.java	2000/07/11 02:30:23	1.15
  @@ -1,4 +1,4 @@
  -/*-- $Id: PageSequence.java,v 1.14 2000/06/27 22:13:59 fotis Exp $ -- 
  +/*-- $Id: PageSequence.java,v 1.15 2000/07/11 02:30:23 arved Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -62,7 +62,6 @@
   import org.apache.fop.layout.AreaTree;
   import org.apache.fop.layout.Page;
   import org.apache.fop.layout.PageMaster;
  -import org.apache.fop.layout.PageMasterFactory;
   import org.apache.fop.apps.FOPException;                   
   
   // Java
  @@ -90,12 +89,13 @@
       static final int AUTO_ODD = 3;
   
       protected Root root;
  -    protected SequenceSpecification sequenceSpecification;
       protected Flow flow;
  +    // protected Title title;
       protected StaticContent staticBefore;
       protected StaticContent staticAfter;
       protected LayoutMasterSet layoutMasterSet;
  -
  +	protected String masterName;
  +	
       protected Page currentPage;
       protected int currentPageNumber = 0;
       protected static int runningPageNumberCounter = 0;  //keeps count of page number from previous PageSequence
  @@ -119,6 +119,7 @@
               new FOPException("page-sequence must be child of root, not "
               + parent.getName());
           }
  +	
           layoutMasterSet = root.getLayoutMasterSet();
           thisIsFirstPage=true; // we are now on the first page of the page sequence
           InitialPageNumber ipn = (InitialPageNumber) this.properties.get("initial-page-number");
  @@ -149,36 +150,26 @@
                   throw new FOPException("\""+ipnValue+"\" is not a valid value for initial-page-number");
               }
           }
  +
  +        masterName = ((MasterName) this.properties.get("master-name")).getString();
       }
   
       protected Page makePage(AreaTree areaTree) throws FOPException {
  -        PageMaster pageMaster;
           // layout this page sequence
  -
  +		
           // while there is still stuff in the flow, ask the
  -        // sequence-specification for a new page 
  -
  -        if ( this.sequenceSpecification == null )
  -        {
  -            throw new FOPException("page-sequence is missing an"
  -            + " sequence-specification");
  -        }
  +        // layoutMasterSet for a new page 
   
  -        PageMasterFactory pmf =
  -        this.sequenceSpecification.getFirstPageMasterFactory();
  -
  -        pageMaster = pmf.getNextPageMaster();
  -
  -        while ( pageMaster == null )
  +		// page number is 0-indexed
  +        PageMaster pageMaster =
  +			this.layoutMasterSet.getNextPageMaster(
  +			masterName, currentPageNumber, thisIsFirstPage );
  +
  +		// a legal alternative is to use the last sub-sequence
  +		// specification. That's not done here.
  +        if ( pageMaster == null )
           {
  -            /* move on to next sequence specifier */
  -            pmf = pmf.getNext();
  -            if ( pmf == null )
  -            {
  -                throw new FOPException("out of sequence specifiers"
  -                + " (FOP will eventually allow this)");
  -            }
  -            pageMaster = pmf.getNextPageMaster();
  +		throw new FOPException("page masters exhausted");
           }
           return pageMaster.makePage(areaTree);
       }
  @@ -255,11 +246,6 @@
   
       public void setFlow(Flow flow) {
           this.flow = flow;
  -    }
  -
  -    protected void setSequenceSpecification(SequenceSpecification sequenceSpecification) {
  -        this.sequenceSpecification = sequenceSpecification;
  -        sequenceSpecification.setLayoutMasterSet(this.layoutMasterSet);
       }
   
       public void setStaticContent(String name, StaticContent staticContent) {