]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Moved the getBody method into PrimaryGridUnit, since it's only needed there and that...
authorVincent Hennebert <vhennebert@apache.org>
Tue, 26 Feb 2008 16:23:15 +0000 (16:23 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Tue, 26 Feb 2008 16:23:15 +0000 (16:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@631276 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
src/java/org/apache/fop/fo/flow/table/GridUnit.java
src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java

index 201029ff1082764affba5d996c7cf836b8b0a89d..2c910d3f8184e4165c9b123d20525a6381a8d09c 100644 (file)
@@ -25,8 +25,6 @@ package org.apache.fop.fo.flow.table;
  */
 public class EmptyGridUnit extends GridUnit {
 
-    private TableBody body;
-
     /**
      * @param table the containing table
      * @param row the table-row element this grid unit belongs to (if any)
@@ -56,11 +54,6 @@ public class EmptyGridUnit extends GridUnit {
         return false;
     }
 
-    /** {@inheritDoc} */
-    public TableBody getBody() {
-        return this.body;
-    }
-
     /** {@inheritDoc} */
     public boolean isLastGridUnitColSpan() {
         return true;
index 23d1cc001273be9026b6a2a36aaa2c6667890732..b9394ff3102d01a115a926b282c26a5b2b33fde1 100644 (file)
@@ -19,7 +19,6 @@
 
 package org.apache.fop.fo.flow.table;
 
-import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo;
 import org.apache.fop.layoutmgr.table.CollapsingBorderModel;
@@ -165,14 +164,6 @@ public class GridUnit {
         this.row = row;
     }
 
-    public TableBody getBody() {
-        FONode node = getCell();
-        while (node != null && !(node instanceof TableBody)) {
-            node = node.getParent();
-        }
-        return (TableBody) node;
-    }
-
     /**
      * Returns the before-start grid unit of the cell containing this grid unit.
      * 
index 1a47a7dcfe9a60f14a0c80ee5686f4c1baf41431..297a3176c214504999e777acce09a5e8a8d89736 100644 (file)
@@ -23,6 +23,7 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.layoutmgr.ElementListUtils;
 import org.apache.fop.layoutmgr.table.TableCellLayoutManager;
@@ -71,6 +72,19 @@ public class PrimaryGridUnit extends GridUnit {
                 .getValue() / 2;  // TODO
     }
 
+    /**
+     * Returns the fo:table-header/footer/body element containing this cell.
+     * 
+     * @return the enclosing table part
+     */
+    public TableBody getTableBody() {
+        FONode node = cell.getParent();
+        if (node instanceof TableRow) {
+            node = node.getParent();
+        }
+        return (TableBody) node;
+    }
+
     public TableCellLayoutManager getCellLM() {
         assert cellLM != null;
         return cellLM;
index b9a118e28a011992c96fddfcd0643ac1da9824a2..5fad1e4c5bd478ff818c21f6ebd1112032bd43df 100644 (file)
@@ -406,7 +406,7 @@ public class TableContentLayoutManager implements PercentBaseContext {
                 lst.add(tcpos);
                 CellPart part = (CellPart)tcpos.cellParts.get(0);
                 if (body == null) {
-                    body = part.pgu.getBody();
+                    body = part.pgu.getTableBody();
                 }
                 if (tcpos.getFlag(TableContentPosition.FIRST_IN_ROWGROUP)
                         && tcpos.getRow().getFlag(EffRow.FIRST_IN_PART)) {