]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Should run my own tests.... :-(
authorJeremias Maerki <jeremias@apache.org>
Tue, 22 Feb 2005 15:32:45 +0000 (15:32 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 22 Feb 2005 15:32:45 +0000 (15:32 +0000)
Bugfix for NPE on empty cells.
Skip adding helper areas for border painting when there are no borders to paint.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198455 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
src/java/org/apache/fop/layoutmgr/table/Cell.java
src/java/org/apache/fop/layoutmgr/table/Row.java

index fcaa0e217fe4caedceb716e8d84a43545d03c16f..f60b37bcabacd599b09390283cce68b308d4bb26 100755 (executable)
@@ -339,6 +339,12 @@ public class CommonBorderPaddingBackground implements Cloneable {
         return ((backgroundColor != null || getFopImage() != null));
     }
 
+    /** @return true if border is non-zero. */
+    public boolean hasBorder() {
+        return ((getBorderBeforeWidth(false) + getBorderAfterWidth(false) 
+                + getBorderStartWidth(false) + getBorderEndWidth(false)) > 0);
+    }
+
     /** @return true if padding is non-zero. */
     public boolean hasPadding() {
         return ((getPaddingBefore(false) + getPaddingAfter(false) 
index cd2c9a7ba286f94ab095fb77ea79e18c4af72d28..2c66f6d39c19a727e010a10e85bde0c82662b40e 100644 (file)
@@ -324,6 +324,10 @@ public class Cell extends BlockStackingLayoutManager {
                     int lastRowHeight = 0;
                     for (int x = 0; x < gridUnits.size(); x++) {
                         GridUnit gu = (GridUnit)gridUnits.get(x);
+                        if (!gu.effBorders.hasBorder()) {
+                            continue;
+                        }
+                        
                         //Blocks for painting grid unit borders
                         Block block = new Block();
                         block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
index 29d1ce281732b3b4c05a31fad2649d2e7457e7b0..bd03c5e3b9545993dc5f6af1cafd9ceb6b4ed6c8 100644 (file)
@@ -220,7 +220,9 @@ public class Row extends BlockStackingLayoutManager {
                 
                 //Ending grid unit for current cell
                 GridUnit ending = null;
-                pos += starting.layoutManager.getFObj().getNumberColumnsSpanned() - 1;
+                if (starting.layoutManager != null) {
+                    pos += starting.layoutManager.getFObj().getNumberColumnsSpanned() - 1;
+                }
                 ending = (GridUnit)gridUnits.get(pos - 1);
                 
                 //Neighbouring grid unit at end edge