gmazza      2004/07/12 17:16:22

  Modified:    src/java/org/apache/fop/apps Driver.java
               src/java/org/apache/fop/area/extensions BookmarkData.java
               src/java/org/apache/fop/fo FOInputHandler.java
               src/java/org/apache/fop/layoutmgr AbstractLayoutManager.java
                        ContentLayoutManager.java LMiter.java
                        LayoutManager.java PageLayoutManager.java
  Added:       src/java/org/apache/fop/area AreaTreeHandler.java
  Removed:     src/java/org/apache/fop/area AreaTree.java
               src/java/org/apache/fop/fo FOTreeHandler.java
  Log:
  1.) Combined the AreaTree and FOTreeHandler into a new AreaTreeHandler
  object.  FOTreeHandler was primarily acting as an AreaTreeHandler,
  and AreaTree had a 1-to-1 relationship with it.  Comments most welcome.
  
  2.) Created convenience methods in FOInputHandler for those subclasses
  which do not handle certain signals/events called from the formatting
  objects (i.e., AreaTreeHandler).
  
  Revision  Changes    Path
  1.82      +3 -3      xml-fop/src/java/org/apache/fop/apps/Driver.java
  
  Index: Driver.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- Driver.java       9 Jul 2004 01:48:58 -0000       1.81
  +++ Driver.java       13 Jul 2004 00:16:22 -0000      1.82
  @@ -34,7 +34,7 @@
   import org.apache.fop.fo.ElementMapping;
   import org.apache.fop.fo.FOTreeBuilder;
   import org.apache.fop.fo.FOInputHandler;
  -import org.apache.fop.fo.FOTreeHandler;
  +import org.apache.fop.area.AreaTreeHandler;
   import org.apache.fop.render.awt.AWTRenderer;
   import org.apache.fop.render.mif.MIFHandler;
   import org.apache.fop.render.rtf.RTFHandler;
  @@ -314,7 +314,7 @@
                           "Renderer must be set using setRenderer(int renderType)");
               }
   
  -            foInputHandler = new FOTreeHandler(foUserAgent, rendererType, 
  +            foInputHandler = new AreaTreeHandler(foUserAgent, rendererType, 
                   stream);
           }
   
  
  
  
  1.1                  xml-fop/src/java/org/apache/fop/area/AreaTreeHandler.java
  
  Index: AreaTreeHandler.java
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /* $Id: AreaTreeHandler.java,v 1.1 2004/07/13 00:16:22 gmazza Exp $ */
  package org.apache.fop.area;
  
  // Java
  import java.io.OutputStream;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Map;
  import java.util.HashMap;
  import java.util.Set;
  import java.util.HashSet;
  import java.util.Iterator;
  
  // XML
  import org.xml.sax.SAXException;
  
  // Apache
  import org.apache.fop.apps.FOPException;
  import org.apache.fop.apps.FOUserAgent;
  import org.apache.fop.area.extensions.BookmarkData;
  import org.apache.fop.fo.FOInputHandler;
  import org.apache.fop.fo.extensions.Outline;
  import org.apache.fop.fo.extensions.Bookmarks;
  import org.apache.fop.fo.pagination.PageSequence;
  import org.apache.fop.fonts.FontInfo;
  import org.apache.fop.layoutmgr.AddLMVisitor;
  import org.apache.fop.layoutmgr.ContentLayoutManager;
  import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
  import org.apache.fop.layoutmgr.LMiter;
  import org.apache.fop.layoutmgr.PageLayoutManager;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  // Java
  import java.io.OutputStream;
  import java.util.HashSet;
  import java.util.Iterator;
  
  /**
   * Area tree handler for formatting objects.
   *
   * Concepts:
   * The area tree is to be as small as possible. With minimal classes
   * and data to fully represent an area tree for formatting objects.
   * The area tree needs to be simple to render and follow the spec
   * closely.
   * This area tree has the concept of page sequences.
   * Where ever possible information is discarded or optimized to
   * keep memory use low. The data is also organized to make it
   * possible for renderers to minimize their output.
   * A page can be saved if not fully resolved and once rendered
   * a page contains only size and id reference information.
   * The area tree pages are organized in a model that depends on the
   * type of renderer.
   */
  public class AreaTreeHandler extends FOInputHandler {
  
      // TODO: Collecting of statistics should be configurable
      private final boolean collectStatistics = true;
      private static final boolean MEM_PROFILE_WITH_GC = false;
      private boolean pageSequenceFound = false;
      
      // for statistics gathering
      private Runtime runtime;
  
      // heap memory allocated (for statistics)
      private long initialMemory;
  
      // time used in rendering (for statistics)
      private long startTime;
  
      // count of number of pages rendered
      private int pageCount;
  
      /** Useful only for allowing subclasses of AddLMVisitor to be set by those
       extending FOP **/
      private AddLMVisitor addLMVisitor = null;
  
      // AreaTreeModel in use
      private AreaTreeModel model;
  
      // hashmap of arraylists containing pages with id area
      private Map idLocations = new HashMap();
  
      // list of id's yet to be resolved and arraylists of pages
      private Map resolve = new HashMap();
  
      private List treeExtensions = new ArrayList();
  
      private static Log log = LogFactory.getLog(AreaTreeHandler.class);
  
      /**
       * Constructor.
       * @param userAgent FOUserAgent object for process
       * @param renderType Desired fo.Constants output type (RENDER_PDF, 
       *   RENDER_PS, etc.)
       * @param stream OutputStream
       */
      public AreaTreeHandler (FOUserAgent userAgent, int renderType, 
          OutputStream stream) throws FOPException {
          super(userAgent);
  
          // model = new CachedRenderPagesModel(userAgent, renderType,
          //  fontInfo, stream);
          model = new RenderPagesModel(userAgent, renderType, fontInfo,
              stream);
              
          if (collectStatistics) {
              runtime = Runtime.getRuntime();
          }
      }
  
      /**
       * Get the area tree model for this area tree.
       *
       * @return AreaTreeModel the model being used for this area tree
       */
      public AreaTreeModel getAreaTreeModel() {
          return model;
      }
  
      /**
       * Add a new page to the area tree.
       * @param page the page to add
       */
      public void addPage(PageViewport page) {
          model.addPage(page);
      }
  
      /**
       * Add an id reference pointing to a page viewport.
       * @param id the id of the reference
       * @param pv the page viewport that contains the id reference
       */
      public void addIDRef(String id, PageViewport pv) {
          List list = (List)idLocations.get(id);
          if (list == null) {
              list = new ArrayList();
              idLocations.put(id, list);
          }
          list.add(pv);
  
          Set todo = (Set)resolve.get(id);
          if (todo != null) {
              for (Iterator iter = todo.iterator(); iter.hasNext();) {
                  Resolveable res = (Resolveable)iter.next();
                  res.resolve(id, list);
              }
              resolve.remove(id);
          }
      }
  
      /**
       * Get the list of id references for an id.
       * @param id the id to lookup
       * @return the list of id references.
       */
      public List getIDReferences(String id) {
          return (List)idLocations.get(id);
      }
  
      /**
       * Add an unresolved object with a given id.
       * @param id the id reference that needs resolving
       * @param res the Resolveable object to resolve
       */
      public void addUnresolvedID(String id, Resolveable res) {
          Set todo = (Set)resolve.get(id);
          if (todo == null) {
              todo = new HashSet();
              resolve.put(id, todo);
          }
          todo.add(res);
      }
  
      /**
       * Add a tree extension.
       * This checks if the extension is resolveable and attempts
       * to resolve or add the resolveable ids for later resolution.
       * @param ext the tree extension to add.
       */
      public void addTreeExtension(TreeExt ext) {
          treeExtensions.add(ext);
          if (ext.isResolveable()) {
              Resolveable res = (Resolveable)ext;
              String[] ids = res.getIDs();
              for (int count = 0; count < ids.length; count++) {
                  if (idLocations.containsKey(ids[count])) {
                      res.resolve(ids[count], (List)idLocations.get(ids[count]));
                  } else {
                      Set todo = (Set)resolve.get(ids[count]);
                      if (todo == null) {
                          todo = new HashSet();
                          resolve.put(ids[count], todo);
                      }
                      todo.add(ext);
                  }
              }
          } else {
              handleTreeExtension(ext, TreeExt.IMMEDIATELY);
          }
      }
  
      /**
       * Handle a tree extension.
       * This sends the extension to the model for handling.
       * @param ext the tree extension to handle
       * @param when when the extension should be handled by the model
       */
      public void handleTreeExtension(TreeExt ext, int when) {
          // queue tree extension according to the when
          model.addExtension(ext, when);
      }
  
      /**
       * Prepare AreaTreeHandler for document processing
       * This is called from FOTreeBuilder.startDocument()
       *
       * @throws SAXException if there is an error
       */
      public void startDocument() throws SAXException {
          //Initialize statistics
          if (collectStatistics) {
              pageCount = 0;
              if (MEM_PROFILE_WITH_GC) {
                  System.gc(); // This takes time but gives better results
              }
  
              initialMemory = runtime.totalMemory() - runtime.freeMemory();
              startTime = System.currentTimeMillis();
          }
      }
  
      /**
       * End the document.
       *
       * @throws SAXException if there is some error
       */
      public void endDocument() throws SAXException {
          if (pageSequenceFound == false) {
              throw new SAXException("Error: No fo:page-sequence child " +
                  "found within fo:root element.");
          }
  
          // deal with unresolved references
          for (Iterator iter = resolve.keySet().iterator(); iter.hasNext();) {
              String id = (String)iter.next();
              Set list = (Set)resolve.get(id);
              for (Iterator resIter = list.iterator(); resIter.hasNext();) {
                  Resolveable res = (Resolveable)resIter.next();
                  if (!res.isResolved()) {
                      res.resolve(id, null);
                  }
              }
          }
          model.endDocument();
  
          if (collectStatistics) {
              if (MEM_PROFILE_WITH_GC) {
                  // This takes time but gives better results
                  System.gc();
              }
              long memoryNow = runtime.totalMemory() - runtime.freeMemory();
              long memoryUsed = (memoryNow - initialMemory) / 1024L;
              long timeUsed = System.currentTimeMillis() - startTime;
              if (logger != null && logger.isDebugEnabled()) {
                  logger.debug("Initial heap size: " + (initialMemory / 1024L) + "Kb");
                  logger.debug("Current heap size: " + (memoryNow / 1024L) + "Kb");
                  logger.debug("Total memory used: " + memoryUsed + "Kb");
                  if (!MEM_PROFILE_WITH_GC) {
                      logger.debug("  Memory use is indicative; no GC was performed");
                      logger.debug("  These figures should not be used comparatively");
                  }
                  logger.debug("Total time used: " + timeUsed + "ms");
                  logger.debug("Pages rendered: " + pageCount);
                  if (pageCount > 0) {
                      logger.debug("Avg render time: " + (timeUsed / pageCount) + 
"ms/page");
                  }
              }
          }
      }
  
      /**
       * Create the bookmark data in the area tree.
       */
      public void addBookmarks(Bookmarks bookmarks) {
          if (bookmarks == null) {
              return;
          }
  
          log.debug("adding bookmarks to area tree");
          BookmarkData data = new BookmarkData();
          for (int count = 0; count < bookmarks.getOutlines().size(); count++) {
              Outline out = (Outline)(bookmarks.getOutlines()).get(count);
              data.addSubData(createBookmarkData(out));
          }
          addTreeExtension(data);
          data.setAreaTreeHandler(this);
      }
  
      /**
       * Create and return the bookmark data for this outline.
       * This creates a bookmark data with the destination
       * and adds all the data from child outlines.
       *
       * @param outline the Outline object for which a bookmark entry should be
       * created
       * @return the new bookmark data
       */
      public BookmarkData createBookmarkData(Outline outline) {
          BookmarkData data = new BookmarkData(outline.getInternalDestination());
          data.setLabel(outline.getLabel());
          for (int count = 0; count < outline.getOutlines().size(); count++) {
              Outline out = (Outline)(outline.getOutlines()).get(count);
              data.addSubData(createBookmarkData(out));
          }
          return data;
      }
  
      /**
       * Start a page sequence.
       * At the start of a page sequence it can start the page sequence
       * on the area tree with the page sequence title.
       *
       * @param pageSeq the page sequence starting
       */
      public void startPageSequence(PageSequence pageSeq) {
          pageSequenceFound = true;
      }
  
      /**
       * End the PageSequence.
       * The PageSequence formats Pages and adds them to the AreaTree.
       * The area tree then handles what happens with the pages.
       *
       * @param pageSequence the page sequence ending
       * @throws FOPException if there is an error formatting the pages
       */
      public void endPageSequence(PageSequence pageSequence)
                  throws FOPException {
          //areaTree.setFontInfo(fontInfo);
  
          if (collectStatistics) {
              if (MEM_PROFILE_WITH_GC) {
                  // This takes time but gives better results
                  System.gc();
              }
              long memoryNow = runtime.totalMemory() - runtime.freeMemory();
              if (logger != null) {
                  logger.debug("Current heap size: " + (memoryNow / 1024L) + "Kb");
              }
          }
  
          addBookmarks(pageSequence.getRoot().getBookmarks());
          formatPageSequence(pageSequence);
      }
  
      /**
       * Runs the formatting of this page sequence into the given area tree
       *
       * @param pageSeq the PageSequence to be formatted
       * @param areaTree the area tree to format this page sequence into
       * @throws FOPException if there is an error formatting the contents
       */
      private void formatPageSequence(PageSequence pageSeq) 
              throws FOPException {
          Title title = null;
          if (pageSeq.getTitleFO() != null) {
              title = getTitleArea(pageSeq.getTitleFO());
          }
          
          model.startPageSequence(title);
  
          // Make a new PageLayoutManager and a FlowLayoutManager
          // Run the PLM in a thread
          // Wait for them to finish.
  
          // If no main flow, nothing to layout!
          if (pageSeq.getMainFlow() == null) {
              return;
          }
  
          // Initialize if already used?
          //    this.layoutMasterSet.resetPageMasters();
          if (pageSeq.getPageSequenceMaster() != null) {
              pageSeq.getPageSequenceMaster().reset();
          }
  
          pageSeq.initPageNumber();
  
          // This will layout pages and add them to the area tree
          PageLayoutManager pageLM = new PageLayoutManager(this, pageSeq);
          pageLM.setPageCounting(pageSeq.getCurrentPageNumber(),
                                 pageSeq.getPageNumberGenerator());
  
          // For now, skip the threading and just call run directly.
          pageLM.run();
  
          // Thread layoutThread = new Thread(pageLM);
          //  layoutThread.start();
          // log.debug("Layout thread started");
          
          // // wait on both managers
          // try {
          //     layoutThread.join();
          //     log.debug("Layout thread done");
          // } catch (InterruptedException ie) {
          //     log.error("PageSequence.format() interrupted waiting on layout");
          // }
          
          pageSeq.setCurrentPageNumber(pageLM.getPageCount());
          // Tell the root the last page number we created.
          
pageSeq.getRoot().setRunningPageNumberCounter(pageSeq.getCurrentPageNumber());
      }
  
      /**
       * @return the Title area
       */
      private org.apache.fop.area.Title 
getTitleArea(org.apache.fop.fo.pagination.Title foTitle) {
          // use special layout manager to add the inline areas
          // to the Title.
          InlineStackingLayoutManager lm;
          lm = new InlineStackingLayoutManager(foTitle);
          lm.setLMiter(new LMiter(lm, foTitle.children.listIterator()));
          lm.initialize();
  
          // get breaks then add areas to title
          org.apache.fop.area.Title title =
                   new org.apache.fop.area.Title();
  
          ContentLayoutManager clm = new ContentLayoutManager(title);
          clm.setUserAgent(foTitle.getUserAgent());
          lm.setParent(clm);
  
          clm.fillArea(lm);
  
          return title;
      }
  
      /**
       * Public accessor to get the AddLMVisitor object that should be used.
       * @return the AddLMVisitor object that should be used.
       */
      public AddLMVisitor getAddLMVisitor() {
          if (this.addLMVisitor == null) {
              this.addLMVisitor = new AddLMVisitor();
          }
          return this.addLMVisitor;
      }
      
  }
  
  
  
  1.4       +9 -9      
xml-fop/src/java/org/apache/fop/area/extensions/BookmarkData.java
  
  Index: BookmarkData.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/area/extensions/BookmarkData.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BookmarkData.java 27 Feb 2004 17:40:31 -0000      1.3
  +++ BookmarkData.java 13 Jul 2004 00:16:22 -0000      1.4
  @@ -21,7 +21,7 @@
   import org.apache.fop.area.PageViewport;
   import org.apache.fop.area.Resolveable;
   import org.apache.fop.area.TreeExt;
  -import org.apache.fop.area.AreaTree;
  +import org.apache.fop.area.AreaTreeHandler;
   
   import java.util.ArrayList;
   import java.util.List;
  @@ -36,8 +36,8 @@
       private ArrayList subData = new ArrayList();
       private HashMap idRefs = new HashMap();
   
  -    // area tree for the top level object to notify when resolved
  -    private AreaTree areaTree = null;
  +    // area tree handler for the top level object to notify when resolved
  +    private AreaTreeHandler areaTreeHandler = null;
   
       private String idRef;
       private PageViewport pageRef = null;
  @@ -69,10 +69,10 @@
        * This should only be called for the top level element.
        * The area tree is used once resolving is complete.
        *
  -     * @param at the area tree for the current document
  +     * @param at the area tree handler for the current document
        */
  -    public void setAreaTree(AreaTree at) {
  -        areaTree = at;
  +    public void setAreaTreeHandler(AreaTreeHandler ath) {
  +        areaTreeHandler = ath;
       }
   
       /**
  @@ -229,8 +229,8 @@
       private void checkFinish() {
           if (idRefs.size() == 0) {
               idRefs = null;
  -            if (areaTree != null) {
  -                areaTree.handleTreeExtension(this, TreeExt.AFTER_PAGE);
  +            if (areaTreeHandler != null) {
  +                areaTreeHandler.handleTreeExtension(this, TreeExt.AFTER_PAGE);
               }
           }
       }
  
  
  
  1.23      +100 -51   xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java
  
  Index: FOInputHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- FOInputHandler.java       27 Jun 2004 13:29:32 -0000      1.22
  +++ FOInputHandler.java       13 Jul 2004 00:16:22 -0000      1.23
  @@ -26,7 +26,6 @@
   // Apache
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.fop.apps.FOPException;
  -import org.apache.fop.area.AreaTree;
   import org.apache.fop.fo.flow.BasicLink;
   import org.apache.fop.fo.flow.Block;
   import org.apache.fop.fo.flow.ExternalGraphic;
  @@ -127,38 +126,44 @@
        * This method is called to indicate the start of a new document run.
        * @throws SAXException In case of a problem
        */
  -    public abstract void startDocument() throws SAXException;
  +    public void startDocument() throws SAXException {
  +    }
   
       /**
        * This method is called to indicate the end of a document run.
        * @throws SAXException In case of a problem
        */
  -    public abstract void endDocument() throws SAXException;
  +    public void endDocument() throws SAXException {
  +    }
   
       /**
        *
        * @param pageSeq PageSequence that is starting.
        */
  -    public abstract void startPageSequence(PageSequence pageSeq);
  +    public void startPageSequence(PageSequence pageSeq) {
  +    }
   
       /**
        *
        * @param pageSeq PageSequence that is ending.
        * @throws FOPException For errors encountered.
        */
  -    public abstract void endPageSequence(PageSequence pageSeq) throws FOPException;
  +    public void endPageSequence(PageSequence pageSeq) throws FOPException {
  +    }
   
       /**
        *
        * @param pagenum PageNumber that is starting.
        */
  -    public abstract void startPageNumber(PageNumber pagenum);
  +    public void startPageNumber(PageNumber pagenum) {
  +    }
   
       /**
        *
        * @param pagenum PageNumber that is ending.
        */
  -    public abstract void endPageNumber(PageNumber pagenum);
  +    public void endPageNumber(PageNumber pagenum) {
  +    }
   
       /**
        * This method is called to indicate the start of a new fo:flow or 
fo:static-content.
  @@ -167,122 +172,142 @@
        *
        * @param fl Flow that is starting.
        */
  -    public abstract void startFlow(Flow fl);
  +    public void startFlow(Flow fl) {
  +    }
   
       /**
        *
        * @param fl Flow that is ending.
        */
  -    public abstract void endFlow(Flow fl);
  +    public void endFlow(Flow fl) {
  +    }
   
       /**
        *
        * @param bl Block that is starting.
        */
  -    public abstract void startBlock(Block bl);
  +    public void startBlock(Block bl) {
  +    }
   
       /**
        *
        * @param bl Block that is ending.
        */
  -    public abstract void endBlock(Block bl);
  +    public void endBlock(Block bl) {
  +    }
   
       /**
        *
        * @param inl Inline that is starting.
        */
  -    public abstract void startInline(Inline inl);
  +    public void startInline(Inline inl) {
  +    }
   
       /**
        *
        * @param inl Inline that is ending.
        */
  -    public abstract void endInline(Inline inl);
  +    public void endInline(Inline inl) {
  +    }
   
       // Tables
       /**
        *
        * @param tbl Table that is starting.
        */
  -    public abstract void startTable(Table tbl);
  +    public void startTable(Table tbl) {
  +    }
   
       /**
        *
        * @param tbl Table that is ending.
        */
  -    public abstract void endTable(Table tbl);
  +    public void endTable(Table tbl) {
  +    }
   
       /**
        *
        * @param tc TableColumn that is starting;
        */
  -    public abstract void startColumn(TableColumn tc);
  +    public void startColumn(TableColumn tc) {
  +    }
   
       /**
        *
        * @param tc TableColumn that is ending;
        */
  -    public abstract void endColumn(TableColumn tc);
  +    public void endColumn(TableColumn tc) {
  +    }
   
       /**
        *
        * @param th TableBody that is starting;
        */
  -    public abstract void startHeader(TableBody th);
  +    public void startHeader(TableBody th) {
  +    }
   
       /**
        *
        * @param th TableBody that is ending.
        */
  -    public abstract void endHeader(TableBody th);
  +    public void endHeader(TableBody th) {
  +    }
   
       /**
        *
        * @param tf TableFooter that is starting.
        */
  -    public abstract void startFooter(TableBody tf);
  +    public void startFooter(TableBody tf) {
  +    }
   
       /**
        *
        * @param tf TableFooter that is ending.
        */
  -    public abstract void endFooter(TableBody tf);
  +    public void endFooter(TableBody tf) {
  +    }
   
       /**
        *
        * @param tb TableBody that is starting.
        */
  -    public abstract void startBody(TableBody tb);
  +    public void startBody(TableBody tb) {
  +    }
   
       /**
        *
        * @param tb TableBody that is ending.
        */
  -    public abstract void endBody(TableBody tb);
  +    public void endBody(TableBody tb) {
  +    }
   
       /**
        *
        * @param tr TableRow that is starting.
        */
  -    public abstract void startRow(TableRow tr);
  +    public void startRow(TableRow tr) {
  +    }
   
       /**
        *
        * @param tr TableRow that is ending.
        */
  -    public abstract void endRow(TableRow tr);
  +    public void endRow(TableRow tr) {
  +    }
   
       /**
        *
        * @param tc TableCell that is starting.
        */
  -    public abstract void startCell(TableCell tc);
  +    public void startCell(TableCell tc) {
  +    }
   
       /**
        *
        * @param tc TableCell that is ending.
        */
  -    public abstract void endCell(TableCell tc);
  +    public void endCell(TableCell tc) {
  +    }
   
   
       // Lists
  @@ -290,124 +315,147 @@
        *
        * @param lb ListBlock that is starting.
        */
  -    public abstract void startList(ListBlock lb);
  +    public void startList(ListBlock lb) {
  +    }
   
       /**
        *
        * @param lb ListBlock that is ending.
        */
  -    public abstract void endList(ListBlock lb);
  +    public void endList(ListBlock lb) {
  +    }
   
       /**
        *
        * @param li ListItem that is starting.
        */
  -    public abstract void startListItem(ListItem li);
  +    public void startListItem(ListItem li) {
  +    }
   
       /**
        *
        * @param li ListItem that is ending.
        */
  -    public abstract void endListItem(ListItem li);
  +    public void endListItem(ListItem li) {
  +    }
   
       /**
        * Process start of a ListLabel.
        */
  -    public abstract void startListLabel();
  +    public void startListLabel() {
  +    }
   
       /**
        * Process end of a ListLabel.
        */
  -    public abstract void endListLabel();
  +    public void endListLabel() {
  +    }
   
       /**
        * Process start of a ListBody.
        */
  -    public abstract void startListBody();
  +    public void startListBody() {
  +    }
   
       /**
        * Process end of a ListBody.
        */
  -    public abstract void endListBody();
  +    public void endListBody() {
  +    }
   
       // Static Regions
       /**
        * Process start of a Static.
        */
  -    public abstract void startStatic();
  +    public void startStatic() {
  +    }
   
       /**
        * Process end of a Static.
        */
  -    public abstract void endStatic();
  +    public void endStatic() {
  +    }
  +
   
       /**
        * Process start of a Markup.
        */
  -    public abstract void startMarkup();
  +    public void startMarkup() {
  +    }
   
       /**
        * Process end of a Markup.
        */
  -    public abstract void endMarkup();
  +    public void endMarkup() {
  +    }
   
       /**
        * Process start of a Link.
        * @param basicLink BasicLink that is ending
        */
  -    public abstract void startLink(BasicLink basicLink);
  +    public void startLink(BasicLink basicLink) {
  +    }
   
       /**
        * Process end of a Link.
        */
  -    public abstract void endLink();
  +    public void endLink() {
  +    }
   
       /**
        * Process an ExternalGraphic.
        * @param eg ExternalGraphic to process.
        */
  -    public abstract void image(ExternalGraphic eg);
  +    public void image(ExternalGraphic eg) {
  +    }
   
       /**
        * Process a pageRef.
        */
  -    public abstract void pageRef();
  +    public void pageRef() {
  +    }
   
       /**
        * Process an InstreamForeignObject.
        * @param ifo InstreamForeignObject to process.
        */
  -    public abstract void foreignObject(InstreamForeignObject ifo);
  +    public void foreignObject(InstreamForeignObject ifo) {
  +    }
   
       /**
        * Process the start of a footnote.
        * @param footnote Footnote that is starting
        */
  -    public abstract void startFootnote(Footnote footnote);
  +    public void startFootnote(Footnote footnote) {
  +    }
       
       /**
        * Process the ending of a footnote.
        * @param footnote Footnote that is ending
        */
  -    public abstract void endFootnote(Footnote footnote);
  +    public void endFootnote(Footnote footnote) {
  +    }
   
       /**
        * Process the start of a footnote body.
        * @param body FootnoteBody that is starting
        */
  -    public abstract void startFootnoteBody(FootnoteBody body);
  +    public void startFootnoteBody(FootnoteBody body) {
  +    }
       
       /**
        * Process the ending of a footnote body.
        * @param body FootnoteBody that is ending
        */
  -    public abstract void endFootnoteBody(FootnoteBody body);
  +    public void endFootnoteBody(FootnoteBody body) {
  +    }
   
       /**
        * Process a Leader.
        * @param l Leader to process.
        */
  -    public abstract void leader(Leader l);
  +    public void leader(Leader l) {
  +    }
   
       /**
        * Process character data.
  @@ -415,7 +463,8 @@
        * @param start Offset for characters to process.
        * @param length Portion of array to process.
        */
  -    public abstract void characters(char data[], int start, int length);
  +    public void characters(char data[], int start, int length) {
  +    }
   
   }
   
  
  
  
  1.17      +3 -3      
xml-fop/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
  
  Index: AbstractLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AbstractLayoutManager.java        13 Jun 2004 01:11:49 -0000      1.16
  +++ AbstractLayoutManager.java        13 Jul 2004 00:16:22 -0000      1.17
  @@ -21,11 +21,11 @@
   import org.apache.fop.fo.FObj;
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.fop.area.Area;
  +import org.apache.fop.area.AreaTreeHandler;
   import org.apache.fop.area.Resolveable;
   import org.apache.fop.area.PageViewport;
   import org.apache.fop.fo.Constants;
   import org.apache.fop.fo.flow.Marker;
  -import org.apache.fop.fo.FOTreeHandler;
   import org.apache.fop.fo.PropertyManager;
   
   import org.apache.commons.logging.Log;
  @@ -108,8 +108,8 @@
           return this.parentLM;
       }
   
  -    public FOTreeHandler getFOTreeHandler() {
  -        return getParent().getFOTreeHandler();
  +    public AreaTreeHandler getAreaTreeHandler() {
  +        return getParent().getAreaTreeHandler();
       }
   
       //     /**
  
  
  
  1.11      +3 -3      
xml-fop/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java
  
  Index: ContentLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ContentLayoutManager.java 13 Jun 2004 01:11:49 -0000      1.10
  +++ ContentLayoutManager.java 13 Jul 2004 00:16:22 -0000      1.11
  @@ -19,10 +19,10 @@
   package org.apache.fop.layoutmgr;
   
   import org.apache.fop.fo.FObj;
  -import org.apache.fop.fo.FOTreeHandler;
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.fop.fo.flow.Marker;
   import org.apache.fop.area.Area;
  +import org.apache.fop.area.AreaTreeHandler;
   import org.apache.fop.area.Resolveable;
   import org.apache.fop.area.PageViewport;
   
  @@ -171,8 +171,8 @@
           return this.parentLM;
       }
   
  -    public FOTreeHandler getFOTreeHandler() {
  -        return getParent().getFOTreeHandler();
  +    public AreaTreeHandler getAreaTreeHandler() {
  +        return getParent().getAreaTreeHandler();
       }
   
       /** @see org.apache.fop.layoutmgr.LayoutManager */
  
  
  
  1.8       +1 -1      xml-fop/src/java/org/apache/fop/layoutmgr/LMiter.java
  
  Index: LMiter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LMiter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LMiter.java       13 Jun 2004 01:11:49 -0000      1.7
  +++ LMiter.java       13 Jul 2004 00:16:22 -0000      1.8
  @@ -46,7 +46,7 @@
       }
   
       protected boolean preLoadNext() {
  -        AddLMVisitor addLMVisitor = lp.getFOTreeHandler().getAddLMVisitor();
  +        AddLMVisitor addLMVisitor = lp.getAreaTreeHandler().getAddLMVisitor();
           // skip over child FObj's that don't add lms
           while (baseIter != null && baseIter.hasNext()) {
               Object theobj = baseIter.next();
  
  
  
  1.9       +4 -4      xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManager.java
  
  Index: LayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LayoutManager.java        13 Jun 2004 01:11:49 -0000      1.8
  +++ LayoutManager.java        13 Jul 2004 00:16:22 -0000      1.9
  @@ -27,7 +27,7 @@
   import org.apache.fop.area.PageViewport;
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.fop.fo.FObj;
  -import org.apache.fop.fo.FOTreeHandler;
  +import org.apache.fop.area.AreaTreeHandler;
   
   /**
    * The interface for all LayoutManagers.
  @@ -58,10 +58,10 @@
       LayoutManager getParent();
   
       /**
  -     * Get the FOTreeHandler object that is activating the LM Tree
  -     * @return the FOTreeHandler object
  +     * Get the AreaTreeHandler object that is activating the LM Tree
  +     * @return the AreaTreeHandler object
        */
  -    FOTreeHandler getFOTreeHandler();
  +    AreaTreeHandler getAreaTreeHandler();
   
       /**
        * Initialize this layout manager.
  
  
  
  1.43      +11 -15    xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
  
  Index: PageLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- PageLayoutManager.java    18 Jun 2004 17:58:35 -0000      1.42
  +++ PageLayoutManager.java    13 Jul 2004 00:16:22 -0000      1.43
  @@ -21,7 +21,7 @@
   import org.apache.fop.apps.FOPException;
   
   import org.apache.fop.area.CTM;
  -import org.apache.fop.area.AreaTree;
  +import org.apache.fop.area.AreaTreeHandler;
   import org.apache.fop.area.AreaTreeModel;
   import org.apache.fop.area.Area;
   import org.apache.fop.area.PageViewport;
  @@ -41,7 +41,6 @@
   import org.apache.fop.datatypes.FODimension;
   
   import org.apache.fop.fo.FObj;
  -import org.apache.fop.fo.FOTreeHandler;
   import org.apache.fop.fo.Constants;
   import org.apache.fop.fo.flow.Marker;
   import org.apache.fop.fo.pagination.PageNumberGenerator;
  @@ -108,9 +107,8 @@
        * laid out and ready for rendering, except for resolution of ID
        * references?
        */
  -    private AreaTree areaTree;
  +    private AreaTreeHandler areaTreeHandler;
       private PageSequence pageSequence;
  -    private FOTreeHandler foTreeHandler;
   
       /**
        * This is the SimplePageMaster that should be used to create the page. It
  @@ -133,12 +131,10 @@
        * @param areaTree the area tree to add pages to
        * @param pageseq the page sequence fo
        */
  -    public PageLayoutManager(AreaTree areaTree, PageSequence pageseq,
  -        FOTreeHandler foTreeHandler) {
  +    public PageLayoutManager(AreaTreeHandler areaTreeHandler, PageSequence pageseq) 
{
           super(pageseq);
  -        this.areaTree = areaTree;
  +        this.areaTreeHandler = areaTreeHandler;
           pageSequence = pageseq;
  -        this.foTreeHandler = foTreeHandler;
       }
   
       /**
  @@ -262,7 +258,7 @@
        * @return the first page viewport that contains the reference
        */
       public PageViewport resolveRefID(String ref) {
  -        List list = areaTree.getIDReferences(ref);
  +        List list = areaTreeHandler.getIDReferences(ref);
           if (list != null && list.size() > 0) {
               return (PageViewport)list.get(0);
           }
  @@ -292,7 +288,7 @@
        * @param id the ID reference to add
        */
       public void addIDToPage(String id) {
  -        areaTree.addIDRef(id, curPage);
  +        areaTreeHandler.addIDRef(id, curPage);
       }
   
       /**
  @@ -310,7 +306,7 @@
           // add unresolved to tree
           // adds to the page viewport so it can serialize
           curPage.addUnresolvedID(id, res);
  -        areaTree.addUnresolvedID(id, curPage);
  +        areaTreeHandler.addUnresolvedID(id, curPage);
       }
   
       /**
  @@ -345,7 +341,7 @@
               // go back over pages until mark found
               // if document boundary then keep going
               boolean doc = boundary == RetrieveBoundary.DOCUMENT;
  -            AreaTreeModel atm = areaTree.getAreaTreeModel();
  +            AreaTreeModel atm = areaTreeHandler.getAreaTreeModel();
               int seq = atm.getPageSequenceCount();
               int page = atm.getPageCount(seq) - 1;
               while (page >= 0) {
  @@ -503,7 +499,7 @@
           layoutStaticContent(currentSimplePageMaster.getRegion(Region.END_CODE),
                               Region.END_CODE);
           // Queue for ID resolution and rendering
  -        areaTree.addPage(curPage);
  +        areaTreeHandler.addPage(curPage);
           curPage = null;
           curBody = null;
           curSpan = null;
  @@ -903,7 +899,7 @@
       /**
        * @return the apps.FOTreeHandler object controlling this generation
        */
  -    public FOTreeHandler getFOTreeHandler() {
  -        return foTreeHandler;
  +    public AreaTreeHandler getAreaTreeHandler() {
  +        return areaTreeHandler;
       }
   }
  
  
  

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

Reply via email to