gmazza      2005/02/11 22:41:24

  Modified:    src/java/org/apache/fop/area AreaTreeModel.java
                        RenderPagesModel.java
               src/java/org/apache/fop/layoutmgr
                        PageSequenceLayoutManager.java
  Removed:     src/java/org/apache/fop/area LineTrait.java
                        StorePagesModel.java
  Log:
  Removed flush() override from PSLM, consolidated StorePagesModel & 
AreaTreeModel, removed unused LineTrait.java.
  
  Revision  Changes    Path
  1.11      +42 -10    xml-fop/src/java/org/apache/fop/area/AreaTreeModel.java
  
  Index: AreaTreeModel.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTreeModel.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AreaTreeModel.java        28 Oct 2004 00:06:46 -0000      1.10
  +++ AreaTreeModel.java        12 Feb 2005 06:41:24 -0000      1.11
  @@ -18,53 +18,83 @@
    
   package org.apache.fop.area;
   
  +// Java
  +import java.util.List;
  +
   // XML
   import org.xml.sax.SAXException;
   
  +// Apache
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   /**
    * This is the model for the area tree object.
    * The model implementation can handle the page sequence,
  - * page and extensions.
  + * page and off-document items.
    * The methods to access the page viewports can only
    * assume the PageViewport is valid as it remains for
    * the life of the area tree model.
    */
  -public abstract class AreaTreeModel {
  +public class AreaTreeModel {
  +    private List pageSequenceList = null;
  +    private List currentPageSequencePageList;
  +    private List offDocumentItems = new java.util.ArrayList();
  +
  +    protected static Log log = LogFactory.getLog(AreaTreeModel.class);
  +
  +    /**
  +     * Create a new store pages model
  +     */
  +    public AreaTreeModel() {
  +        pageSequenceList = new java.util.ArrayList();
  +    }
  +
       /**
        * Start a page sequence on this model.
        * @param title the title of the new page sequence
        */
  -    public abstract void startPageSequence(LineArea title);
  +    public void startPageSequence(LineArea title) {
  +        currentPageSequencePageList = new java.util.ArrayList();
  +        pageSequenceList.add(currentPageSequencePageList);
  +    }
   
       /**
        * Add a page to this moel.
        * @param page the page to add to the model.
        */
  -    public abstract void addPage(PageViewport page);
  +    public void addPage(PageViewport page) {
  +        currentPageSequencePageList.add(page);
  +    }
   
       /**
        * Handle an OffDocumentItem 
        * @param ext the extension to handle
        */
  -    public abstract void handleOffDocumentItem(OffDocumentItem ext);
  +    public void handleOffDocumentItem(OffDocumentItem ext) {};
   
       /**
        * Signal the end of the document for any processing.
        */
  -    public abstract void endDocument() throws SAXException;
  +    public void endDocument() throws SAXException {};
   
       /**
        * Get the page sequence count.
        * @return the number of page sequences in the document.
        */
  -    public abstract int getPageSequenceCount();
  +    public int getPageSequenceCount() {
  +        return pageSequenceList.size();
  +    }
   
       /**
        * Get the page count.
        * @param seq the page sequence to count.
        * @return returns the number of pages in a page sequence
        */
  -    public abstract int getPageCount(int seq);
  +    public int getPageCount(int seq) {
  +        List sequence = (List) pageSequenceList.get(seq - 1);
  +        return sequence.size();
  +    }
   
       /**
        * Get the page for a position in the document.
  @@ -72,6 +102,8 @@
        * @param count the page count in the sequence
        * @return the PageViewport for the particular page
        */
  -    public abstract PageViewport getPage(int seq, int count);
  -
  +    public PageViewport getPage(int seq, int count) {
  +        List sequence = (List) pageSequenceList.get(seq - 1);
  +        return (PageViewport) sequence.get(count);
  +    }
   }
  
  
  
  1.14      +3 -3      
xml-fop/src/java/org/apache/fop/area/RenderPagesModel.java
  
  Index: RenderPagesModel.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/area/RenderPagesModel.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- RenderPagesModel.java     10 Feb 2005 17:08:24 -0000      1.13
  +++ RenderPagesModel.java     12 Feb 2005 06:41:24 -0000      1.14
  @@ -35,14 +35,14 @@
   import org.apache.fop.render.RendererFactory;
   
   /**
  - * This uses the store pages model to store the pages
  - * each page is either rendered if ready or prepared
  + * This uses the AreaTreeModel to store the pages
  + * Each page is either rendered if ready or prepared
    * for later rendering.
    * Once a page is rendered it is cleared to release the
    * contents but the PageViewport is retained. So even
    * though the pages are stored the contents are discarded.
    */
  -public class RenderPagesModel extends StorePagesModel {
  +public class RenderPagesModel extends AreaTreeModel {
       /**
        * The renderer that will render the pages.
        */
  
  
  
  1.31      +2 -7      
xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
  
  Index: PageSequenceLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- PageSequenceLayoutManager.java    10 Feb 2005 17:08:24 -0000      1.30
  +++ PageSequenceLayoutManager.java    12 Feb 2005 06:41:24 -0000      1.31
  @@ -222,7 +222,7 @@
           }
           pageCount--;
           log.debug("Ending layout");
  -        flush();
  +        finishPage();
           pageSeq.setCurrentPageNumber(getPageCount());
       }
   
  @@ -747,11 +747,6 @@
           createFlow();
       }
   
  -    // See finishPage...
  -    protected void flush() {
  -        finishPage();
  -    }
  -
       /**
        * Called when a new page is needed.
        *
  
  
  

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

Reply via email to