From bcaac1ac742590c379ba4ac3fdbf9d92779ff679 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Thu, 16 Dec 2004 01:03:04 +0000 Subject: [PATCH] PR: Obtained from: Submitted by: Reviewed by: Removed Runnable interface from PSLM; new method "activateLayout()" combines former run() and doLayout() methods in PSLM. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198201 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/area/AreaTreeHandler.java | 2 +- .../layoutmgr/PageSequenceLayoutManager.java | 41 +++++++------------ 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index 186ae558f..86611034c 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -236,7 +236,7 @@ public class AreaTreeHandler extends FOEventHandler { if (pageSequence.getMainFlow() != null) { PageSequenceLayoutManager pageSLM = new PageSequenceLayoutManager(this, pageSequence); - pageSLM.run(); + pageSLM.activateLayout(); pageSequence.setCurrentPageNumber(pageSLM.getPageCount()); } } diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index bdd43c94e..4ac067b08 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -66,7 +66,7 @@ import org.apache.fop.traits.MinOptMax; * LayoutManager for a PageSequence and its flow. * It manages all page-related layout. */ -public class PageSequenceLayoutManager extends AbstractLayoutManager implements Runnable { +public class PageSequenceLayoutManager extends AbstractLayoutManager { private PageSequence fobj; private static class BlockBreakPosition extends LeafPosition { @@ -154,30 +154,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements pageNumberString = pageNumberGenerator.makeFormattedPageNumber(pageCount); } - /** - * The layout process is designed to be able to be run in a thread. - * In theory it can run at the same - * time as FO tree generation, once the layout-master-set has been read. - * We can arrange it so that the iterator over the fobj children waits - * until the next child is available. - * As it produces pages, it adds them to the AreaTree, where the - * rendering process can also run in a parallel thread. - */ - public void run() { - fobj.initPageNumber(); - setPageCounting(fobj.getCurrentPageNumber(), - fobj.getPageNumberGenerator()); - - LineArea title = null; - if (fobj.getTitleFO() != null) { - title = getTitleArea(fobj.getTitleFO()); - } - - areaTreeModel.startPageSequence(title); - doLayout(); - flush(); - } - /** * Get the page count. * Used to get the last page number for reference for @@ -211,13 +187,23 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements } /** - * Do the layout of this page sequence. + * Start the layout of this page sequence. * This completes the layout of the page sequence * which creates and adds all the pages to the area tree. */ - protected void doLayout() { + public void activateLayout() { + fobj.initPageNumber(); + setPageCounting(fobj.getCurrentPageNumber(), + fobj.getPageNumberGenerator()); + LineArea title = null; + if (fobj.getTitleFO() != null) { + title = getTitleArea(fobj.getTitleFO()); + } + + areaTreeModel.startPageSequence(title); log.debug("Starting layout"); + // this should be done another way makeNewPage(false, false); createBodyMainReferenceArea(); @@ -239,6 +225,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements } pageCount--; log.debug("Ending layout"); + flush(); } /** -- 2.39.5