xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r471725 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java status.xml test/layoutengine/standard-testcases/table_table-layout_fixed_3.xml
Date Mon, 06 Nov 2006 13:33:13 GMT
Author: jeremias
Date: Mon Nov  6 05:33:12 2006
New Revision: 471725

URL: http://svn.apache.org/viewvc?view=rev&rev=471725
Log:
Bugfix: Fixed bug when the sum of column widths of a table is larger than the specified widths.
The table width was not adjusted.

Added:
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_table-layout_fixed_3.xml
  (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java?view=diff&rev=471725&r1=471724&r2=471725
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java Mon Nov
 6 05:33:12 2006
@@ -228,4 +228,23 @@
         return xoffset;
     }
 
+    /**
+     * Calculates the sum of all column widths.
+     * @param context the context for percentage based calculations
+     * @return the requested sum in millipoints
+     */
+    public int getSumOfColumnWidths(PercentBaseContext context) {
+        int sum = 0;
+        for (int i = 1, c = getColumnCount(); i <= c; i++) {
+            int effIndex = i;
+            if (i >= colWidths.size()) {
+                effIndex = colWidths.size() - 1;
+            }
+            if (colWidths.get(effIndex) != null) {
+                sum += ((Length) colWidths.get(effIndex)).getValue(context);
+            }
+        }
+        return sum;
+    }
+    
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?view=diff&rev=471725&r1=471724&r2=471725
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
Mon Nov  6 05:33:12 2006
@@ -21,12 +21,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.flow.Table;
-import org.apache.fop.fo.flow.TableFObj;
 import org.apache.fop.fo.flow.TableColumn;
-import org.apache.fop.fo.properties.TableColLength;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.ConditionalElementListener;
 import org.apache.fop.layoutmgr.KnuthElement;
@@ -176,6 +172,14 @@
                         + "=> assuming width=\"100%\"");
             }
             updateContentAreaIPDwithOverconstrainedAdjust();
+        }
+
+        int sumOfColumns = columns.getSumOfColumnWidths(this);
+        if (!autoLayout && sumOfColumns > getContentAreaIPD()) {
+            log.debug(FONode.decorateWithContextInfo(
+                    "The sum of all column widths is larger than the specified table width.",

+                    getTable()));
+            updateContentAreaIPDwithOverconstrainedAdjust(sumOfColumns);
         }
 
         int availableIPD = referenceIPD - getIPIndents();

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?view=diff&rev=471725&r1=471724&r2=471725
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Mon Nov  6 05:33:12 2006
@@ -29,6 +29,10 @@
   <changes>
     <release version="FOP Trunk">
       <action context="Code" dev="JM" type="fix">
+        Bugfix: Fixed bug when the sum of column widths of a table is larger than the
+        specified widths. The table width was not adjusted.
+      </action>
+      <action context="Code" dev="JM" type="fix">
         Bugfix: Nested tables with headers and footers were not handled correctly and could
         overlap with the region-after.
       </action>

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_table-layout_fixed_3.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_table-layout_fixed_3.xml?view=auto&rev=471725
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_table-layout_fixed_3.xml
(added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_table-layout_fixed_3.xml
Mon Nov  6 05:33:12 2006
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks tables with table-layout="fixed" and when width is set but is less
+      than the sum of all column widths.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in"
margin="20pt">
+          <fo:region-body margin="0pt" background-color="lightgray"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal" white-space-collapse="true">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:table table-layout="fixed" width="100%" border-collapse="separate" 
+              border="solid 5pt red" border-separation.inline-progression-direction="10pt">
+            <fo:table-column column-width="90pt"/>
+            <fo:table-column column-width="90pt"/>
+            <fo:table-column column-width="90pt"/>
+            <fo:table-column column-width="60pt"/>
+            <fo:table-body>
+              <fo:table-row>
+                <fo:table-cell border="solid 2.5pt">
+                  <fo:block>cell1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="solid 2.5pt" background-color="yellow">
+                  <fo:block>cell2</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="solid 2.5pt">
+                  <fo:block>cell3</fo:block>
+                </fo:table-cell>
+                <fo:table-cell border="solid 2.5pt" background-color="yellow">
+                  <fo:block>cell4</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row>
+                <fo:table-cell background-color="orange">
+                  <fo:block>cell5</fo:block>
+                </fo:table-cell>
+                <fo:table-cell>
+                  <fo:block>cell6</fo:block>
+                </fo:table-cell>
+                <fo:table-cell background-color="orange">
+                  <fo:block>cell7</fo:block>
+                </fo:table-cell>
+                <fo:table-cell>
+                  <fo:block>cell8</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="340000" xpath="//flow/block[1]/@ipda"/>
+    <eval expected="330000" xpath="//flow/block[1]/@ipd"/>
+    <eval expected="80000" xpath="//flow/block[1]/block[1]/@ipda"/>
+    <eval expected="7500" xpath="//flow/block[1]/block[1]/@left-offset"/>
+    <eval expected="80000" xpath="//flow/block[1]/block[2]/@ipda"/>
+    <eval expected="97500" xpath="//flow/block[1]/block[2]/@left-offset"/>
+    <eval expected="80000" xpath="//flow/block[1]/block[3]/@ipda"/>
+    <eval expected="187500" xpath="//flow/block[1]/block[3]/@left-offset"/>
+    <eval expected="50000" xpath="//flow/block[1]/block[4]/@ipda"/>
+    <eval expected="277500" xpath="//flow/block[1]/block[4]/@left-offset"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_table-layout_fixed_3.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_table-layout_fixed_3.xml
------------------------------------------------------------------------------
    svn:keywords = Id



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


Mime
View raw message