You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ad...@apache.org on 2016/01/03 15:30:10 UTC

svn commit: r1722725 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo: FObj.java flow/RetrieveTableMarker.java

Author: adelmelle
Date: Sun Jan  3 14:30:10 2016
New Revision: 1722725

URL: http://svn.apache.org/viewvc?rev=1722725&view=rev
Log:
Move code to where it belongs: if it only applies to RetrieveTableMarker, it does not belong in FObj

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java?rev=1722725&r1=1722724&r2=1722725&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FObj.java Sun Jan  3 14:30:10 2016
@@ -21,7 +21,6 @@ package org.apache.fop.fo;
 
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -36,7 +35,6 @@ import org.apache.xmlgraphics.util.QName
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
 import org.apache.fop.fo.flow.Marker;
-import org.apache.fop.fo.flow.table.TableCell;
 import org.apache.fop.fo.properties.Property;
 import org.apache.fop.fo.properties.PropertyMaker;
 
@@ -327,7 +325,7 @@ public abstract class FObj extends FONod
      * at the passed-in node (= first call to iterator.next() will
      * return childNode)
      * @param childNode First node in the iterator
-     * @return A ListIterator or null if childNode isn't a child of
+     * @return A FONodeIterator or null if childNode isn't a child of
      * this FObj.
      */
     public FONodeIterator getChildNodes(FONode childNode) {
@@ -372,7 +370,7 @@ public abstract class FObj extends FONod
         String mcname = marker.getMarkerClassName();
         if (firstChild != null) {
             // check for empty childNodes
-            for (Iterator<FONode> iter = getChildNodes(); iter.hasNext();) {
+            for (FONodeIterator iter = getChildNodes(); iter.hasNext();) {
                 FONode node = iter.next();
                 if (node instanceof FObj
                         || (node instanceof FOText
@@ -553,11 +551,6 @@ public abstract class FObj extends FONod
         int found = 1;
         FONode temp = getParent();
         while (temp != null) {
-            if (temp instanceof TableCell && (ancestorID == FO_TABLE_HEADER || ancestorID == FO_TABLE_FOOTER)) {
-                // note that if the retrieve-table-marker is not in a table-header/footer an exception is
-                // thrown, so no need to reset this flag in that case
-                ((TableCell) temp).flagAsHavingRetrieveTableMarker();
-            }
             if (temp.getNameId() == ancestorID) {
                 return found;
             }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java?rev=1722725&r1=1722724&r2=1722725&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java Sun Jan  3 14:30:10 2016
@@ -25,6 +25,7 @@ import org.xml.sax.Locator;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.flow.table.TableCell;
 
 /**
  * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-table-marker">
@@ -81,6 +82,33 @@ public class RetrieveTableMarker extends
     }
 
     /**
+     * Overridden to flag the ancestor table-cell.
+     *
+     * @param ancestorID    ID of node name to check for (e.g., FO_ROOT)
+     * @return number of levels above FO where ancestor exists,
+     *         -1 if not found
+     */
+    @Override
+    protected int findAncestor(int ancestorID) {
+        int found = 1;
+        FONode temp = getParent();
+        while (temp != null) {
+            if (temp instanceof TableCell
+                    && (ancestorID == FO_TABLE_HEADER || ancestorID == FO_TABLE_FOOTER)) {
+                // note that if the retrieve-table-marker is not in a table-header/footer an exception is
+                // thrown, so no need to reset this flag in that case
+                ((TableCell) temp).flagAsHavingRetrieveTableMarker();
+            }
+            if (temp.getNameId() == ancestorID) {
+                return found;
+            }
+            found += 1;
+            temp = temp.getParent();
+        }
+        return -1;
+    }
+
+    /**
      * Return the value for the <code>retrieve-position-within-table</code>
      * property
      * @return  the value for retrieve-position-within-table; one of



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org