From 406a8a8740878508267a4a3f0f0fac589cc0a162 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Tue, 7 Jun 2005 20:43:43 +0000 Subject: [PATCH] Removed LM.initialize() -- switched to internal initialization of all LM's. Did initialization from constructor, as that appeared sufficient for all of them. Should for any LM, initialization not be available until the parentLM set, then we just need to do this process within a setParent() override. Also removed calls to superclass initialization, because as yet no initialization was occurring in those superclasses. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198719 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/AbstractLayoutManager.java | 20 ------------------- .../BlockContainerLayoutManager.java | 6 ++---- .../fop/layoutmgr/BlockLayoutManager.java | 8 ++------ .../fop/layoutmgr/ContentLayoutManager.java | 6 ------ .../fop/layoutmgr/InlineLayoutManager.java | 6 ++---- .../apache/fop/layoutmgr/LayoutManager.java | 5 ----- .../fop/layoutmgr/LineLayoutManager.java | 5 +---- .../layoutmgr/PageSequenceLayoutManager.java | 10 +++++++--- .../list/ListBlockLayoutManager.java | 5 ++--- .../layoutmgr/list/ListItemLayoutManager.java | 5 ++--- .../org/apache/fop/layoutmgr/table/Cell.java | 7 ++----- .../layoutmgr/table/TableLayoutManager.java | 5 ++--- 12 files changed, 22 insertions(+), 66 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java index d44d5fd4e..d8cb02f26 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -45,7 +45,6 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants /** True if this LayoutManager has handled all of its content. */ private boolean bFinished = false; - protected boolean bInited = false; /** child LM and child LM iterator during getNextBreakPoss phase */ protected LayoutManager curChildLM = null; @@ -76,24 +75,6 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants childLMiter = new LMiter(this); } - /** - * This method provides a hook for a LayoutManager to initialize traits - * for the areas it will create, based on Properties set on its FO. - */ - public void initialize() { - if (bInited == false) { - initProperties(); - bInited = true; - } - } - - /** - * This method is called by initialize() to set any method variables - * based on Properties set on its FO. - */ - protected void initProperties() { - } - public void setParent(LayoutManager lm) { this.parentLM = lm; } @@ -337,7 +318,6 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants return; } lm.setParent(this); - lm.initialize(); if (childLMs == null) { childLMs = new java.util.ArrayList(10); } diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 6c83e599e..ed855afe4 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -73,12 +73,10 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { */ public BlockContainerLayoutManager(BlockContainer node) { super(node); + initialize(); } - /** - * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties() - */ - protected void initProperties() { + private void initialize() { abProps = getBlockContainerFO().getCommonAbsolutePosition(); foBlockSpaceBefore = new SpaceVal(getBlockContainerFO().getCommonMarginBlock() .spaceBefore).getSpace(); diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 371bf53b5..d2ec1f82d 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -73,14 +73,10 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { follow = -fs.getDescender(); middleShift = -fs.getXHeight() / 2; lineHeight = getBlockFO().getLineHeight().getOptimum().getLength().getValue(); + initialize(); } - /** - * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties() - * @todo need to take into account somewhere the effects of fo:initial-property-set, - * if defined for the block. - */ - protected void initProperties() { + private void initialize() { foBlockSpaceBefore = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceBefore).getSpace(); /*LF*/ bpUnit = 0; //layoutProps.blockProgressionUnit; /*LF*/ if (bpUnit == 0) { diff --git a/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java index 05c8c6b0e..8e72f6330 100644 --- a/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java @@ -217,11 +217,6 @@ public class ContentLayoutManager implements InlineLevelLayoutManager { //to be done } - /** @see org.apache.fop.layoutmgr.LayoutManager */ - public void initialize() { - //to be done - } - /** @see org.apache.fop.layoutmgr.LayoutManager */ public void resetPosition(Position position) { //to be done @@ -255,7 +250,6 @@ public class ContentLayoutManager implements InlineLevelLayoutManager { return; } lm.setParent(this); - lm.initialize(); childLM = (InlineLevelLayoutManager)lm; log.trace(this.getClass().getName() + ": Adding child LM " + lm.getClass().getName()); diff --git a/src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java index b02e96c98..2953ad79b 100755 --- a/src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/InlineLayoutManager.java @@ -52,12 +52,10 @@ public class InlineLayoutManager extends InlineStackingLayoutManager public InlineLayoutManager(InlineLevel node) { super(node); fobj = node; + initialize(); } - /** - * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties() - */ - protected void initProperties() { + private void initialize() { inlineProps = fobj.getCommonMarginInline(); borderProps = fobj.getCommonBorderPaddingBackground(); diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManager.java b/src/java/org/apache/fop/layoutmgr/LayoutManager.java index 56d39dda1..c4431c2f9 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManager.java @@ -42,11 +42,6 @@ public interface LayoutManager { */ LayoutManager getParent(); - /** - * Initialize this layout manager. - */ - void initialize(); - /** * Get the active PageSequenceLayoutManager instance for this * layout process. diff --git a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java index 937690b2c..a5807ceac 100644 --- a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java @@ -50,10 +50,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager private Block fobj; - /** - * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties() - */ - protected void initProperties() { + private void initialize() { bTextAlignment = fobj.getTextAlign(); bTextAlignmentLast = fobj.getTextAlignLast(); textIndent = fobj.getTextIndent(); diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index 7ce12edab..6418d82e7 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -452,7 +452,9 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { throw new IllegalArgumentException("Cannot create page: " + fopex.getMessage()); } - log.debug("[" + curPV.getPageNumberString() + (bIsBlank ? "*" : "") + "]"); + if (log.isDebugEnabled()) { + log.debug("[" + curPV.getPageNumberString() + (bIsBlank ? "*" : "") + "]"); + } return curPV; } @@ -484,8 +486,10 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { areaTreeHandler.tryIDResolution(curPV); // Queue for ID resolution and rendering areaTreeHandler.getAreaTreeModel().addPage(curPV); - log.debug("page finished: " + curPV.getPageNumberString() - + ", current num: " + currentPageNum); + if (log.isDebugEnabled()) { + log.debug("page finished: " + curPV.getPageNumberString() + + ", current num: " + currentPageNum); + } curPV = null; } diff --git a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java index 6870ccec8..31f067261 100644 --- a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java @@ -77,6 +77,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { */ public ListBlockLayoutManager(ListBlock node) { super(node); + initialize(); } /** @@ -87,9 +88,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { return (ListBlock)fobj; } - /** @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties() */ - protected void initProperties() { - super.initProperties(); + private void initialize() { spaceBefore = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceBefore).getSpace(); spaceAfter = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceAfter).getSpace(); } diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index 32f56bbe5..250aa5289 100644 --- a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -124,6 +124,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { super(node); setLabel(node.getLabel()); setBody(node.getBody()); + initialize(); } /** @@ -152,9 +153,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { body.setParent(this); } - /** @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties() */ - protected void initProperties() { - super.initProperties(); + private void initialize() { spaceBefore = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceBefore).getSpace(); spaceAfter = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceAfter).getSpace(); } diff --git a/src/java/org/apache/fop/layoutmgr/table/Cell.java b/src/java/org/apache/fop/layoutmgr/table/Cell.java index cb2f00c2e..053132ed5 100644 --- a/src/java/org/apache/fop/layoutmgr/table/Cell.java +++ b/src/java/org/apache/fop/layoutmgr/table/Cell.java @@ -71,6 +71,7 @@ public class Cell extends BlockStackingLayoutManager implements BlockLevelLayout super(node); fobj = node; this.gridUnit = pgu; + initialize(); } /** @return the table-cell FO */ @@ -82,11 +83,7 @@ public class Cell extends BlockStackingLayoutManager implements BlockLevelLayout return fobj.isSeparateBorderModel(); } - /** - * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties() - */ - protected void initProperties() { - super.initProperties(); + private void initialize() { borderAndPaddingBPD = 0; borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false); borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderAfterWidth(false); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 76e3fbdfe..babdaa34b 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -84,6 +84,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager super(node); fobj = node; this.columns = new ColumnSetup(node); + initialize(); } /** @return the table FO */ @@ -98,9 +99,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager return this.columns; } - /** @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties() */ - protected void initProperties() { - super.initProperties(); + private void initialize() { spaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore).getSpace(); spaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter).getSpace(); -- 2.39.5