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/08/21 16:11:03 UTC

svn commit: r234204 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java

Author: jeremias
Date: Sun Aug 21 07:10:59 2005
New Revision: 234204

URL: http://svn.apache.org/viewcvs?rev=234204&view=rev
Log:
An attempt at helpful error output when the top/left/bottom/right properties on block-containers are not right.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java   (contents, props changed)

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=234204&r1=234203&r2=234204&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Sun Aug 21 07:10:59 2005
@@ -342,14 +342,33 @@
         } else {
             allocBPD = 0;
             if (abProps.bottom.getEnum() != EN_AUTO) {
+                int availHeight;
                 if (isFixed()) {
-                    allocBPD = (int)getCurrentPV().getViewArea().getHeight();
+                    availHeight = (int)getCurrentPV().getViewArea().getHeight();
                 } else {
-                    allocBPD = context.getStackLimit().opt; 
+                    availHeight = context.getStackLimit().opt; 
                 }
+                allocBPD = availHeight;
                 allocBPD -= offset.y;
                 if (abProps.bottom.getEnum() != EN_AUTO) {
                     allocBPD -= abProps.bottom.getValue();
+                    if (allocBPD < 0) {
+                        log.error("The current combination of top and bottom properties results"
+                                + " in a negative extent for the block-container. 'bottom' may be"
+                                + " at most " + (allocBPD + abProps.bottom.getValue()) + " mpt,"
+                                + " but was actually " + abProps.bottom.getValue() + " mpt."
+                                + " The nominal available height is " + availHeight + " mpt.");
+                        allocBPD = 0;
+                    }
+                } else {
+                    if (allocBPD < 0) {
+                        log.error("The current combination of top and bottom properties results"
+                                + " in a negative extent for the block-container. 'top' may be"
+                                + " at most " + availHeight + " mpt,"
+                                + " but was actually " + offset.y + " mpt."
+                                + " The nominal available height is " + availHeight + " mpt.");
+                        allocBPD = 0;
+                    }
                 }
             } else {
                 autoHeight = true;
@@ -359,16 +378,35 @@
             allocIPD = width.getValue(); //this is the content-width
             allocIPD += getIPIndents();
         } else {
+            int availWidth;
             if (isFixed()) {
-                allocIPD = (int)getCurrentPV().getViewArea().getWidth(); 
+                availWidth = (int)getCurrentPV().getViewArea().getWidth(); 
             } else {
-                allocIPD = context.getRefIPD();
+                availWidth = context.getRefIPD();
             }
+            allocIPD = availWidth;
             if (abProps.left.getEnum() != EN_AUTO) {
                 allocIPD -= abProps.left.getValue();
             }
             if (abProps.right.getEnum() != EN_AUTO) {
                 allocIPD -= abProps.right.getValue();
+                if (allocIPD < 0) {
+                    log.error("The current combination of left and right properties results"
+                            + " in a negative extent for the block-container. 'right' may be"
+                            + " at most " + (allocIPD + abProps.right.getValue()) + " mpt,"
+                            + " but was actually " + abProps.right.getValue() + " mpt."
+                            + " The nominal available width is " + availWidth + " mpt.");
+                    allocIPD = 0;
+                }
+            } else {
+                if (allocIPD < 0) {
+                    log.error("The current combination of left and right properties results"
+                            + " in a negative extent for the block-container. 'left' may be"
+                            + " at most " + allocIPD + " mpt,"
+                            + " but was actually " + abProps.left.getValue() + " mpt."
+                            + " The nominal available width is " + availWidth + " mpt.");
+                    allocIPD = 0;
+                }
             }
         }
 

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
------------------------------------------------------------------------------
    svn:keywords = Id



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