]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
More code cleanup. Removing the duplicate fobj variables.
authorJeremias Maerki <jeremias@apache.org>
Wed, 19 Oct 2005 14:07:35 +0000 (14:07 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 19 Oct 2005 14:07:35 +0000 (14:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_SpaceResolution@326567 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java

index 80a394f28939122a0de49721e153f016834b0e9e..4070885220a8a6d771a6a94b7f0ad68f3d61d87e 100644 (file)
@@ -48,7 +48,6 @@ import org.apache.fop.traits.MinOptMax;
 public class TableCellLayoutManager extends BlockStackingLayoutManager 
             implements BlockLevelLayoutManager {
     
-    private TableCell fobj;
     private PrimaryGridUnit gridUnit;
     
     private Block curBlockArea;
@@ -78,24 +77,26 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
 
     /** @return the table-cell FO */
     public TableCell getTableCell() {
-        return this.fobj;
+        return (TableCell)this.fobj;
     }
     
     private boolean isSeparateBorderModel() {
-        return fobj.isSeparateBorderModel();
+        return getTableCell().isSeparateBorderModel();
     }
     
     /** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */
     public void initialize() {
         borderAndPaddingBPD = 0;
-        borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
-        borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderAfterWidth(false);
+        borderAndPaddingBPD += getTableCell()
+            .getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
+        borderAndPaddingBPD += getTableCell()
+            .getCommonBorderPaddingBackground().getBorderAfterWidth(false);
         if (!isSeparateBorderModel()) {
             borderAndPaddingBPD /= 2;
         }
-        borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground()
+        borderAndPaddingBPD += getTableCell().getCommonBorderPaddingBackground()
                 .getPaddingBefore(false, this);
-        borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground()
+        borderAndPaddingBPD += getTableCell().getCommonBorderPaddingBackground()
                 .getPaddingAfter(false, this);
     }
     
@@ -121,8 +122,8 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
         if (!isSeparateBorderModel()) {
             iIndents /= 2;
         }
-        iIndents += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
-        iIndents += fobj.getCommonBorderPaddingBackground().getPaddingEnd(false, this);
+        iIndents += getTableCell().getCommonBorderPaddingBackground().getPaddingStart(false, this);
+        iIndents += getTableCell().getCommonBorderPaddingBackground().getPaddingEnd(false, this);
         return iIndents;
     }
     
@@ -136,7 +137,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
         cellIPD = referenceIPD;
         cellIPD -= getIPIndents();
         if (isSeparateBorderModel()) {
-            int borderSep = fobj.getBorderSeparation().getLengthPair()
+            int borderSep = getTableCell().getBorderSeparation().getLengthPair()
                     .getIPD().getLength().getValue(this);
             cellIPD -= borderSep;
         }
@@ -330,11 +331,12 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
                          LayoutContext layoutContext) {
         getParentArea(null);
 
-        getPSLM().addIDToPage(fobj.getId());
+        getPSLM().addIDToPage(getTableCell().getId());
 
         if (isSeparateBorderModel()) {
-            if (!emptyCell || fobj.showEmptyCells()) {
-                TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground(), this);
+            if (!emptyCell || getTableCell().showEmptyCells()) {
+                TraitSetter.addBorders(curBlockArea, 
+                        getTableCell().getCommonBorderPaddingBackground(), this);
             }
         } else {
             boolean[] outer = new boolean[] {
@@ -400,11 +402,11 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
         //Handle display-align
         int contentBPD = getContentHeight(rowHeight, gridUnit);
         if (usedBPD < contentBPD) {
-            if (fobj.getDisplayAlign() == EN_CENTER) {
+            if (getTableCell().getDisplayAlign() == EN_CENTER) {
                 Block space = new Block();
                 space.setBPD((contentBPD - usedBPD) / 2);
                 curBlockArea.addBlock(space);
-            } else if (fobj.getDisplayAlign() == EN_AFTER) {
+            } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
                 Block space = new Block();
                 space.setBPD((contentBPD - usedBPD));
                 curBlockArea.addBlock(space);
@@ -417,15 +419,15 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
 
         // Add background after we know the BPD
         if (isSeparateBorderModel()) {
-            if (!emptyCell || fobj.showEmptyCells()) {
+            if (!emptyCell || getTableCell().showEmptyCells()) {
                 TraitSetter.addBackground(curBlockArea,
-                                          fobj.getCommonBorderPaddingBackground(),
-                                          this);
+                        getTableCell().getCommonBorderPaddingBackground(),
+                        this);
             }
         } else {
             TraitSetter.addBackground(curBlockArea,
-                                      fobj.getCommonBorderPaddingBackground(),
-                                      this);
+                    getTableCell().getCommonBorderPaddingBackground(),
+                    this);
         }
         
         flush();
@@ -450,18 +452,19 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
         if (curBlockArea == null) {
             curBlockArea = new Block();
             curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
-            TraitSetter.setProducerID(curBlockArea, fobj.getId());
+            TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
             curBlockArea.setPositioning(Block.ABSOLUTE);
             int indent = 0;
             indent += startBorderWidth;
             if (!isSeparateBorderModel()) {
                 indent /= 2;
             }
-            indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
+            indent += getTableCell()
+                    .getCommonBorderPaddingBackground().getPaddingStart(false, this);
             // set position
             int halfBorderSep = 0;
             if (isSeparateBorderModel()) {
-                halfBorderSep = fobj.getBorderSeparation().getLengthPair()
+                halfBorderSep = getTableCell().getBorderSeparation().getLengthPair()
                         .getIPD().getLength().getValue(this) / 2;
             }
             int borderAdjust = 0;
index ff1c52987294f24792831de56cd72a5bab2842d4..4d551743c2b8371efb667ce220942eebcc38277f 100644 (file)
@@ -54,8 +54,6 @@ import org.apache.fop.fo.FObj;
 public class TableLayoutManager extends BlockStackingLayoutManager 
                 implements ConditionalElementListener {
     
-    private Table fobj;
-    
     private TableContentLayoutManager contentLM; 
     private ColumnSetup columns = null;
 
@@ -79,13 +77,12 @@ public class TableLayoutManager extends BlockStackingLayoutManager
      */
     public TableLayoutManager(Table node) {
         super(node);
-        fobj = node;
         this.columns = new ColumnSetup(node);
     }
 
     /** @return the table FO */
     public Table getTable() {
-        return this.fobj;
+        return (Table)this.fobj;
     }
     
     /**
@@ -97,11 +94,14 @@ public class TableLayoutManager extends BlockStackingLayoutManager
     
     /** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */
     public void initialize() {
-        foSpaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore, this).getSpace();
-        foSpaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter, this).getSpace();
+        foSpaceBefore = new SpaceVal(
+                getTable().getCommonMarginBlock().spaceBefore, this).getSpace();
+        foSpaceAfter = new SpaceVal(
+                getTable().getCommonMarginBlock().spaceAfter, this).getSpace();
         
-        if (!fobj.isAutoLayout() 
-                && fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
+        if (!getTable().isAutoLayout() 
+                && getTable().getInlineProgressionDimension().getOptimum(this).getEnum() 
+                    != EN_AUTO) {
             autoLayout = false;
         }
     }
@@ -117,8 +117,8 @@ public class TableLayoutManager extends BlockStackingLayoutManager
     
     private int getIPIndents() {
         int iIndents = 0;
-        iIndents += fobj.getCommonMarginBlock().startIndent.getValue(this);
-        iIndents += fobj.getCommonMarginBlock().endIndent.getValue(this);
+        iIndents += getTable().getCommonMarginBlock().startIndent.getValue(this);
+        iIndents += getTable().getCommonMarginBlock().endIndent.getValue(this);
         return iIndents;
     }
     
@@ -140,12 +140,12 @@ public class TableLayoutManager extends BlockStackingLayoutManager
         referenceBPD = context.getStackLimit().opt;
         referenceIPD = context.getRefIPD();
 
-        if (fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
-            referenceIPD = fobj.getInlineProgressionDimension().getOptimum(this)
+        if (getTable().getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
+            referenceIPD = getTable().getInlineProgressionDimension().getOptimum(this)
                     .getLength().getValue(this);
             contentIPD = referenceIPD;
         } else {
-            if (!fobj.isAutoLayout()) {
+            if (!getTable().isAutoLayout()) {
                 log.info("table-layout=\"fixed\" and width=\"auto\", "
                         + "but auto-layout not supported " 
                         + "=> assuming width=\"100%\"");
@@ -180,7 +180,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager
 
         addKnuthElementsForSpaceBefore(returnList, alignment);
         
-        if (fobj.isSeparateBorderModel()) {
+        if (getTable().isSeparateBorderModel()) {
             addKnuthElementsForBorderPaddingBefore(returnList);
         }
 
@@ -282,7 +282,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager
             }
         }
         wrapPositionElements(contentList, returnList);
-        if (fobj.isSeparateBorderModel()) {
+        if (getTable().isSeparateBorderModel()) {
             addKnuthElementsForBorderPaddingAfter(returnList);
         }
         addKnuthElementsForSpaceAfter(returnList, alignment);
@@ -302,9 +302,9 @@ public class TableLayoutManager extends BlockStackingLayoutManager
     public void addAreas(PositionIterator parentIter,
                          LayoutContext layoutContext) {
         getParentArea(null);
-        getPSLM().addIDToPage(fobj.getId());
+        getPSLM().addIDToPage(getTable().getId());
 
-        int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue(this);
+        int startXOffset = getTable().getCommonMarginBlock().startIndent.getValue(this);
         
         // add column, body then row areas
 
@@ -320,7 +320,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager
 
         curBlockArea.setBPD(tableHeight);
 
-        if (fobj.isSeparateBorderModel()) {
+        if (getTable().isSeparateBorderModel()) {
             TraitSetter.addBorders(curBlockArea, 
                     getTable().getCommonBorderPaddingBackground(), 
                     discardBorderBefore, discardBorderAfter, false, false, this);
@@ -329,14 +329,14 @@ public class TableLayoutManager extends BlockStackingLayoutManager
                     discardPaddingBefore, discardPaddingAfter, false, false, this);
         }
         TraitSetter.addBackground(curBlockArea, 
-                fobj.getCommonBorderPaddingBackground(),
+                getTable().getCommonBorderPaddingBackground(),
                 this);
         TraitSetter.addMargins(curBlockArea,
-                fobj.getCommonBorderPaddingBackground(), 
-                fobj.getCommonMarginBlock(),
+                getTable().getCommonBorderPaddingBackground(), 
+                getTable().getCommonMarginBlock(),
                 this);
         TraitSetter.addBreaks(curBlockArea, 
-                fobj.getBreakBefore(), fobj.getBreakAfter());
+                getTable().getBreakBefore(), getTable().getBreakAfter());
         TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(), 
                 effSpaceBefore, effSpaceAfter);
 
@@ -415,24 +415,24 @@ public class TableLayoutManager extends BlockStackingLayoutManager
     public boolean mustKeepTogether() {
         //TODO Keeps will have to be more sophisticated sooner or later
         return ((BlockLevelLayoutManager)getParent()).mustKeepTogether() 
-                || !fobj.getKeepTogether().getWithinPage().isAuto()
-                || !fobj.getKeepTogether().getWithinColumn().isAuto();
+                || !getTable().getKeepTogether().getWithinPage().isAuto()
+                || !getTable().getKeepTogether().getWithinColumn().isAuto();
     }
 
     /**
      * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithPrevious()
      */
     public boolean mustKeepWithPrevious() {
-        return !fobj.getKeepWithPrevious().getWithinPage().isAuto()
-                || !fobj.getKeepWithPrevious().getWithinColumn().isAuto();
+        return !getTable().getKeepWithPrevious().getWithinPage().isAuto()
+                || !getTable().getKeepWithPrevious().getWithinColumn().isAuto();
     }
 
     /**
      * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithNext()
      */
     public boolean mustKeepWithNext() {
-        return !fobj.getKeepWithNext().getWithinPage().isAuto()
-                || !fobj.getKeepWithNext().getWithinColumn().isAuto();
+        return !getTable().getKeepWithNext().getWithinPage().isAuto()
+                || !getTable().getKeepWithNext().getWithinColumn().isAuto();
     }
 
     // --------- Property Resolution related functions --------- //