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 je...@apache.org on 2005/07/15 19:52:40 UTC

svn commit: r219226 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr: LayoutManagerMapping.java LeafNodeLayoutManager.java WrapperLayoutManager.java

Author: jeremias
Date: Fri Jul 15 10:52:39 2005
New Revision: 219226

URL: http://svn.apache.org/viewcvs?rev=219226&view=rev
Log:
Bugzilla #35749:
IDs on fo:wrapper didn't register on the pages because fo:wrapper didn't have an LM that does that job for it.
The new LM for wrapper creates a dummy area so addId() can be triggered. No area is actually sent to the area tree. The WrapperLM is simply inserted before its children.

Added:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java?rev=219226&r1=219225&r2=219226&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java Fri Jul 15 10:52:39 2005
@@ -332,6 +332,9 @@
      
     public class WrapperLayoutManagerMaker extends Maker {
         public void make(FONode node, List lms) {
+            //We insert the wrapper LM before it's children so an ID
+            //on the node can be registered on a page.
+            lms.add(new WrapperLayoutManager((Wrapper)node));
             Iterator baseIter;
             baseIter = node.getChildNodes();
             if (baseIter == null) {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java?rev=219226&r1=219225&r2=219226&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java Fri Jul 15 10:52:39 2005
@@ -169,9 +169,11 @@
         addId();
 
         InlineArea area = getEffectiveArea();
-        offsetArea(area, context);
-        widthAdjustArea(area, context);
-        parentLM.addChildArea(area);
+        if (area.getAllocIPD() > 0 || area.getAllocBPD() > 0) {
+            offsetArea(area, context);
+            widthAdjustArea(area, context);
+            parentLM.addChildArea(area);
+        }
 
         while (posIter.hasNext()) {
             posIter.next();

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java?rev=219226&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/WrapperLayoutManager.java Fri Jul 15 10:52:39 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.layoutmgr;
+
+import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.fo.flow.Wrapper;
+
+/**
+ * This is the layout manager for the fo:wrapper formatting object.
+ */
+public class WrapperLayoutManager extends LeafNodeLayoutManager {
+    
+    private Wrapper fobj;
+
+    /**
+     * Creates a new LM for fo:wrapper.
+     * @param node the fo:wrapper
+     */
+    public WrapperLayoutManager(Wrapper node) {
+        super(node);
+        fobj = node;
+    }
+
+    /** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager */
+    public InlineArea get(LayoutContext context) {
+        //Create a zero-width, zero-height dummy area so this node can 
+        //participate in the ID handling. Otherwise, addId() wouldn't 
+        //be called.
+        InlineArea area = new InlineArea();
+        return area;
+    }
+    
+    /** @see org.apache.fop.layoutmgr.LeafNodeLayoutManager#addId() */
+    protected void addId() {
+        getPSLM().addIDToPage(fobj.getId());
+    }
+    
+}



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