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 2008/04/15 21:18:52 UTC

svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Author: jeremias
Date: Tue Apr 15 12:18:46 2008
New Revision: 648381

URL: http://svn.apache.org/viewvc?rev=648381&view=rev
Log:
First part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-together.within-column for all block-level FOs.

Added:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KeepUtil.java   (with props)
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml   (with props)
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml   (with props)
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_2.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/build.xml
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EffRow.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/list-block_keep-together.xml
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml

Modified: xmlgraphics/fop/trunk/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/build.xml?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/build.xml (original)
+++ xmlgraphics/fop/trunk/build.xml Tue Apr 15 12:18:46 2008
@@ -924,7 +924,7 @@
     <echo message="${hyphenation.message}"/>
   </target>
 
-  <target name="junit-layout-standard" depends="junit-compile" if="junit.present" description="Runs FOP's standard JUnit layout tests">
+  <target name="junit-layout-standard" depends="junit-compile, junit-fotree" if="junit.present" description="Runs FOP's standard JUnit layout tests">
     <echo message="Running standard layout engine tests"/>
     <junit dir="${basedir}" haltonfailure="${junit.haltonfailure}" fork="${junit.fork}" errorproperty="fop.junit.error" failureproperty="fop.junit.failure">
       <sysproperty key="basedir" value="${basedir}"/>
@@ -982,7 +982,7 @@
     </junit>
   </target>
 
-  <target name="junit-intermediate-format" depends="junit-compile" description="Runs FOP's intermediate format JUnit tests" if="xmlunit.present">
+  <target name="junit-intermediate-format" depends="junit-compile, junit-layout" description="Runs FOP's intermediate format JUnit tests" if="xmlunit.present">
     <echo message="Running intermediate format tests"/>
     <junit dir="${basedir}" haltonfailure="${junit.haltonfailure}" fork="${junit.fork}" errorproperty="fop.junit.error" failureproperty="fop.junit.failure">
       <sysproperty key="basedir" value="${basedir}"/>

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EffRow.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EffRow.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EffRow.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/EffRow.java Tue Apr 15 12:18:46 2008
@@ -23,6 +23,8 @@
 import java.util.List;
 
 import org.apache.fop.fo.Constants;
+import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.table.TableRowIterator;
 import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.util.BreakUtil;
@@ -211,10 +213,26 @@
      * @return true if this row must be kept together
      */
     public boolean mustKeepTogether() {
-        TableRow row = getTableRow();
-        return row != null && row.mustKeepTogether();
+        return getKeepTogetherStrength() != BlockLevelLayoutManager.KEEP_AUTO;
     }
 
+    /**
+     * Returns the keep-together strength for this element. Note: The keep strength returned does
+     * not take the parent table's keeps into account!
+     * @return the keep-together strength
+     */
+    public int getKeepTogetherStrength() {
+        TableRow row = getTableRow();
+        int strength = BlockLevelLayoutManager.KEEP_AUTO;
+        if (row != null) {
+            strength = Math.max(strength, KeepUtil.getKeepStrength(
+                    row.getKeepTogether().getWithinPage()));
+            strength = Math.max(strength, KeepUtil.getKeepStrength(
+                    row.getKeepTogether().getWithinColumn()));
+        }
+        return strength;
+    }
+    
     /**
      * Returns the break class for this row. This is a combination of break-before set on
      * the first children of any cells starting on this row.

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/GridUnit.java Tue Apr 15 12:18:46 2008
@@ -64,11 +64,16 @@
     /** flags for the grid unit */
     private byte flags = 0;
 
+    /** the border-before specification */
     ConditionalBorder borderBefore;
+    /** the border-after specification */
     ConditionalBorder borderAfter;
+    /** the border-start specification */
     BorderSpecification borderStart;
+    /** the border-end specification */
     BorderSpecification borderEnd;
 
+    /** The border model helper associated with the table */
     protected CollapsingBorderModel collapsingBorderModel;
 
     /**
@@ -146,6 +151,10 @@
         }
     }
 
+    /**
+     * Returns the table cell associated with this grid unit.
+     * @return the table cell
+     */
     public TableCell getCell() {
         return cell;
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=648381&r1=648380&r2=648381&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 Tue Apr 15 12:18:46 2008
@@ -308,22 +308,7 @@
                     if (prevLM != null) {
                         // there is a block handled by prevLM
                         // before the one handled by curLM
-                        if (mustKeepTogether() 
-                                || prevLM.mustKeepWithNext()
-                                || curLM.mustKeepWithPrevious()) {
-                            // add an infinite penalty to forbid a break between
-                            // blocks
-                            contentList.add(new BreakElement(
-                                    new Position(this), KnuthElement.INFINITE, context));
-                        } else if (!((ListElement) contentList.getLast()).isGlue()) {
-                            // add a null penalty to allow a break between blocks
-                            contentList.add(new BreakElement(
-                                    new Position(this), 0, context));
-                        } else {
-                            // the last element in contentList is a glue;
-                            // it is a feasible breakpoint, there is no need to add
-                            // a penalty
-                        }
+                        addInBetweenBreak(contentList, context, childLC);
                     }
                     contentList.addAll(returnedList);
                     if (returnedList.size() == 0) {
@@ -1004,15 +989,19 @@
     }
 
     /** {@inheritDoc} */
-    public boolean mustKeepTogether() {
-        //TODO Keeps will have to be more sophisticated sooner or later
-        return super.mustKeepTogether()
-                || !getBlockContainerFO().getKeepTogether().getWithinPage().isAuto()
-                || !getBlockContainerFO().getKeepTogether().getWithinColumn().isAuto();
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getBlockContainerFO().getKeepTogether().getWithinPage()));
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getBlockContainerFO().getKeepTogether().getWithinColumn()));
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
     }
 
     /** {@inheritDoc} */
     public boolean mustKeepWithPrevious() {
+        //TODO Keeps will have to be more sophisticated sooner or later
         return !getBlockContainerFO().getKeepWithPrevious().getWithinPage().isAuto()
                 || !getBlockContainerFO().getKeepWithPrevious().getWithinColumn().isAuto();
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -33,7 +33,6 @@
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontTriplet;
-import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
 import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
 import org.apache.fop.layoutmgr.inline.LineLayoutManager;
 import org.apache.fop.traits.MinOptMax;
@@ -79,11 +78,13 @@
         proxyLMiter = new ProxyLMiter();
     }
 
+    /** {@inheritDoc} */
     public void initialize() {
         super.initialize();
         FontInfo fi = getBlockFO().getFOEventHandler().getFontInfo();
         FontTriplet[] fontkeys = getBlockFO().getCommonFont().getFontState(fi);
-        Font initFont = fi.getFontInstance(fontkeys[0], getBlockFO().getCommonFont().fontSize.getValue(this));
+        Font initFont = fi.getFontInstance(fontkeys[0],
+                getBlockFO().getCommonFont().fontSize.getValue(this));
         lead = initFont.getAscender();
         follow = -initFont.getDescender();
         //middleShift = -fs.getXHeight() / 2;
@@ -135,7 +136,7 @@
      */
     protected class ProxyLMiter extends LMiter {
 
-        /*
+        /**
          * Constructs a proxy iterator for Block LM.
          */
         public ProxyLMiter() {
@@ -206,40 +207,31 @@
         return llm;
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public boolean mustKeepTogether() {
-        // TODO Keeps will have to be more sophisticated sooner or later
-        // TODO This is a quick fix for the fact that the parent is not always a BlockLevelLM;
-        // eventually mustKeepTogether() must be moved up to the LM interface
-        return (!getBlockFO().getKeepTogether().getWithinPage().isAuto()
-                || !getBlockFO().getKeepTogether().getWithinColumn().isAuto()
-                || (getParent() instanceof BlockLevelLayoutManager
-                    && ((BlockLevelLayoutManager) getParent()).mustKeepTogether())
-                || (getParent() instanceof InlineLayoutManager
-                    && ((InlineLayoutManager) getParent()).mustKeepTogether()));
+    /** {@inheritDoc} */
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getBlockFO().getKeepTogether().getWithinPage()));
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getBlockFO().getKeepTogether().getWithinColumn()));
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
     }
-
-    /**
-     * {@inheritDoc}
-     */
+    
+    /** {@inheritDoc} */
     public boolean mustKeepWithPrevious() {
+        //TODO Keeps will have to be more sophisticated sooner or later
         return !getBlockFO().getKeepWithPrevious().getWithinPage().isAuto()
                 || !getBlockFO().getKeepWithPrevious().getWithinColumn().isAuto();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public boolean mustKeepWithNext() {
         return !getBlockFO().getKeepWithNext().getWithinPage().isAuto()
                 || !getBlockFO().getKeepWithNext().getWithinColumn().isAuto();
     }
 
-    /**
-     * {@inheritDoc} 
-     */
+    /** {@inheritDoc} */
     public void addAreas(PositionIterator parentIter,
             LayoutContext layoutContext) {
         getParentArea(null);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -35,9 +35,20 @@
     /** Adjustment class: adjustment for line height */
     int LINE_HEIGHT_ADJUSTMENT = 3;
 
+    /** The integer value for "auto" keep strength */
+    int KEEP_AUTO = Integer.MIN_VALUE;
+    /** The integer value for "always" keep strength */
+    int KEEP_ALWAYS = Integer.MAX_VALUE;
+    
     int negotiateBPDAdjustment(int adj, KnuthElement lastElement);
 
     void discardSpace(KnuthGlue spaceGlue);
+
+    /**
+     * Returns the keep-together strength for this element.
+     * @return the keep-together strength
+     */
+    int getKeepTogetherStrength();
 
     /**
      * @return true if this element must be kept together

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -335,27 +335,7 @@
                 if (prevLM != null) {
                     // there is a block handled by prevLM
                     // before the one handled by curLM
-                    if (mustKeepTogether() 
-                            || context.isKeepWithNextPending()
-                            || childLC.isKeepWithPreviousPending()) {
-                        // Clear keep pending flag
-                        context.setFlags(LayoutContext.KEEP_WITH_NEXT_PENDING, false);
-                        // add an infinite penalty to forbid a break between
-                        // blocks
-                        contentList.add(new BreakElement(
-                                new Position(this), KnuthElement.INFINITE, context));
-                    } else if (!((ListElement) contentList.getLast()).isGlue()) {
-                        // add a null penalty to allow a break between blocks
-                        contentList.add(new BreakElement(
-                                new Position(this), 0, context));
-                    } else {
-                        // the last element in contentList is a glue;
-                        // it is a feasible breakpoint, there is no need to add
-                        // a penalty
-                        log.warn("glue-type break possibility not handled properly, yet");
-                        //TODO Does this happen? If yes, need to deal with border and padding
-                        //at the break possibility
-                    }
+                    addInBetweenBreak(contentList, context, childLC);
                 }
                 if (returnedList == null || returnedList.size() == 0) {
                     //Avoid NoSuchElementException below (happens with empty blocks)
@@ -433,6 +413,66 @@
     }
 
     /**
+     * Adds a break element to the content list between individual child elements.
+     * @param contentList the content list to populate
+     * @param context the current layout context
+     * @param childLC the currently active child layout context
+     */
+    protected void addInBetweenBreak(LinkedList contentList, LayoutContext context,
+            LayoutContext childLC) {
+        if (mustKeepTogether() 
+                || context.isKeepWithNextPending()
+                || childLC.isKeepWithPreviousPending()) {
+            
+            int strength = getKeepTogetherStrength();
+            if (context.isKeepWithNextPending()) {
+                context.setFlags(LayoutContext.KEEP_WITH_NEXT_PENDING, false);
+                strength = KEEP_ALWAYS;
+            }
+            if (childLC.isKeepWithPreviousPending()) {
+                childLC.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING, false);
+                strength = KEEP_ALWAYS;
+            }
+            int penalty = KeepUtil.getPenaltyForKeep(strength);
+
+            // add a penalty to forbid or discourage a break between blocks
+            contentList.add(new BreakElement(
+                    new Position(this), penalty, context));
+            return;
+        }
+        
+        ListElement last = (ListElement)contentList.getLast(); 
+        if (last.isGlue()) {
+            // the last element in contentList is a glue;
+            // it is a feasible breakpoint, there is no need to add
+            // a penalty
+            log.warn("glue-type break possibility not handled properly, yet");
+            //TODO Does this happen? If yes, need to deal with border and padding
+            //at the break possibility
+        } else if (!ElementListUtils.endsWithNonInfinitePenalty(contentList)) {
+
+            // TODO vh: this is hacky
+            // The getNextKnuthElements method of TableCellLM must not be called
+            // twice, otherwise some settings like indents or borders will be
+            // counted several times and lead to a wrong output. Anyway the
+            // getNextKnuthElements methods should be called only once eventually
+            // (i.e., when multi-threading the code), even when there are forced
+            // breaks.
+            // If we add a break possibility after a forced break the
+            // AreaAdditionUtil.addAreas method will act on a sequence starting
+            // with a SpaceResolver.SpaceHandlingBreakPosition element, having no
+            // LM associated to it. Thus it will stop early instead of adding
+            // areas for following Positions. The above test aims at preventing
+            // such a situation from occurring. add a null penalty to allow a break
+            // between blocks
+            
+            // add a null penalty to allow a break between blocks
+            contentList.add(new BreakElement(
+                    new Position(this), 0, context));
+        }
+    }
+
+    /**
      * {@inheritDoc} 
      */
     public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
@@ -759,26 +799,34 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Retrieves and returns the keep-together strength from the parent element.
+     * @return the keep-together strength
      */
-    // default action: ask parentLM
+    protected int getParentKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        if (getParent() instanceof BlockLevelLayoutManager) {
+            strength = ((BlockLevelLayoutManager)getParent()).getKeepTogetherStrength(); 
+        } else if (getParent() instanceof InlineLayoutManager) {
+            if (((InlineLayoutManager) getParent()).mustKeepTogether()) {
+                strength = KEEP_ALWAYS;
+            }
+            //TODO Fix me
+            //strength = ((InlineLayoutManager) getParent()).getKeepTogetherStrength();
+        }
+        return strength;
+    }
+    
+    /** {@inheritDoc} */
     public boolean mustKeepTogether() {
-        return ((getParent() instanceof BlockLevelLayoutManager
-                    && ((BlockLevelLayoutManager) getParent()).mustKeepTogether())
-                || (getParent() instanceof InlineLayoutManager
-                    && ((InlineLayoutManager) getParent()).mustKeepTogether()));
+        return getKeepTogetherStrength() > KEEP_AUTO;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public boolean mustKeepWithPrevious() {
         return false;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public boolean mustKeepWithNext() {
         return false;
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java Tue Apr 15 12:18:46 2008
@@ -190,6 +190,23 @@
     }
 
     /**
+     * Indicates whether the given element list ends with a penalty with a non-infinite penalty
+     * value.
+     * @param elems the element list
+     * @return true if the list ends with a non-infinite penalty
+     */
+    public static boolean endsWithNonInfinitePenalty(LinkedList elems) {
+        ListElement last = (ListElement)elems.getLast();
+        if (last.isPenalty() && ((KnuthPenalty)last).getP() < KnuthElement.INFINITE) {
+            return true;
+        } else if (last instanceof BreakElement
+                        && ((BreakElement)last).getPenaltyValue() < KnuthElement.INFINITE) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
      * Determines the position of the previous break before the start index on an
      * element list.
      * @param elems the element list

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -208,10 +208,10 @@
     }
 
     /** {@inheritDoc} */
-    public boolean mustKeepTogether() {
-        return false;
+    public int getKeepTogetherStrength() {
+        return KEEP_AUTO;
     }
-
+    
     /** {@inheritDoc} */
     public boolean mustKeepWithPrevious() {
         return false;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -19,11 +19,11 @@
 
 package org.apache.fop.layoutmgr;
 
+import java.util.LinkedList;
+
 import org.apache.fop.area.Area;
 import org.apache.fop.fo.flow.FootnoteBody;
 
-import java.util.LinkedList;
-
 /**
  * Layout manager for footnote bodies.
  */
@@ -91,4 +91,9 @@
         return (FootnoteBody) fobj;
     }
 
+    /** {@inheritDoc} */
+    public int getKeepTogetherStrength() {
+        return getParentKeepTogetherStrength();
+    }
+    
 }

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KeepUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KeepUtil.java?rev=648381&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KeepUtil.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KeepUtil.java Tue Apr 15 12:18:46 2008
@@ -0,0 +1,70 @@
+/*
+ * 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$ */
+
+package org.apache.fop.layoutmgr;
+
+import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.properties.Property;
+
+/**
+ * Utility class for working with keeps.
+ */
+public class KeepUtil {
+
+    /**
+     * Converts a keep property into an integer value.
+     * <p>
+     * Note: The conversion restricts the effectively available integer range by two values.
+     * Integer.MIN_VALUE is used to represent the value "auto" and
+     * Integer.MAX_VALUE is used to represebt the value "always".
+     * @param keep the keep property
+     * @return the keep value as an integer
+     */
+    public static int getKeepStrength(Property keep) {
+        if (keep.isAuto()) {
+            return BlockLevelLayoutManager.KEEP_AUTO;
+        } else if (keep.getEnum() == Constants.EN_ALWAYS) {
+            return BlockLevelLayoutManager.KEEP_ALWAYS;
+        } else {
+            return keep.getNumber().intValue();
+        }
+    }
+    
+    /**
+     * Returns the penalty value to be used for a certain keep strength.
+     * <ul>
+     *   <li>"auto": returns 0</li>
+     *   <li>"always": returns KnuthElement.INFINITE</li>
+     *   <li>otherwise: returns KnuthElement.INFINITE - 1</li>
+     * </ul>
+     * @param keepStrength the keep strength
+     * @return the penalty value
+     */
+    public static int getPenaltyForKeep(int keepStrength) {
+        if (keepStrength == BlockLevelLayoutManager.KEEP_AUTO) {
+            return 0;
+        }
+        int penalty = KnuthElement.INFINITE;
+        if (keepStrength < BlockLevelLayoutManager.KEEP_ALWAYS) {
+            penalty--;
+        }
+        return penalty;
+    }
+    
+}

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KeepUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -405,5 +405,10 @@
         this.contentAreaBPD = contentAreaBPD;
     }
     
+    /** {@inheritDoc} */
+    public int getKeepTogetherStrength() {
+        return KEEP_AUTO;
+    }
+    
 }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -1271,13 +1271,16 @@
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public boolean mustKeepTogether() {
         return ((BlockLevelLayoutManager) getParent()).mustKeepTogether();
     }
 
+    /** {@inheritDoc} */
+    public int getKeepTogetherStrength() {
+        return ((BlockLevelLayoutManager) getParent()).getKeepTogetherStrength();
+    }
+    
     /**
      * {@inheritDoc}
      */

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -32,6 +32,7 @@
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.ConditionalElementListener;
 import org.apache.fop.layoutmgr.ElementListUtils;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.LayoutManager;
 import org.apache.fop.layoutmgr.NonLeafPosition;
@@ -278,15 +279,19 @@
     }
 
     /** {@inheritDoc} */
-    public boolean mustKeepTogether() {
-        //TODO Keeps will have to be more sophisticated sooner or later
-        return super.mustKeepTogether() 
-                || !getListBlockFO().getKeepTogether().getWithinPage().isAuto()
-                || !getListBlockFO().getKeepTogether().getWithinColumn().isAuto();
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getListBlockFO().getKeepTogether().getWithinPage()));
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getListBlockFO().getKeepTogether().getWithinColumn()));
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
     }
-
+    
     /** {@inheritDoc} */
     public boolean mustKeepWithPrevious() {
+        //TODO Keeps will have to be more sophisticated sooner or later
         return !getListBlockFO().getKeepWithPrevious().getWithinPage().isAuto()
             || !getListBlockFO().getKeepWithPrevious().getWithinColumn().isAuto();
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -28,8 +28,8 @@
 import org.apache.fop.fo.flow.AbstractListItemPart;
 import org.apache.fop.fo.flow.ListItemBody;
 import org.apache.fop.fo.flow.ListItemLabel;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.LayoutManager;
 import org.apache.fop.layoutmgr.NonLeafPosition;
@@ -221,12 +221,15 @@
     }
 
     /** {@inheritDoc} */
-    public boolean mustKeepTogether() {
-        //TODO Keeps will have to be more sophisticated sooner or later
-        return ((BlockLevelLayoutManager)getParent()).mustKeepTogether() 
-                || !getPartFO().getKeepTogether().getWithinPage().isAuto()
-                || !getPartFO().getKeepTogether().getWithinColumn().isAuto();
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getPartFO().getKeepTogether().getWithinPage()));
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getPartFO().getKeepTogether().getWithinColumn()));
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
     }
-
+    
 }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -32,12 +32,12 @@
 import org.apache.fop.fo.flow.ListItem;
 import org.apache.fop.fo.flow.ListItemBody;
 import org.apache.fop.fo.flow.ListItemLabel;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.BreakElement;
 import org.apache.fop.layoutmgr.ConditionalElementListener;
 import org.apache.fop.layoutmgr.ElementListObserver;
 import org.apache.fop.layoutmgr.ElementListUtils;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.KnuthBox;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthPenalty;
@@ -305,14 +305,17 @@
             
             //Additional penalty height from penalties in the source lists
             int additionalPenaltyHeight = 0;
+            int stepPenalty = 0;
             KnuthElement endEl = (KnuthElement)elementLists[0].get(end[0]);
             if (endEl instanceof KnuthPenalty) {
                 additionalPenaltyHeight = endEl.getW();
+                stepPenalty = Math.max(stepPenalty, endEl.getP());
             }
             endEl = (KnuthElement)elementLists[1].get(end[1]);
             if (endEl instanceof KnuthPenalty) {
                 additionalPenaltyHeight = Math.max(
                         additionalPenaltyHeight, endEl.getW());
+                stepPenalty = Math.max(stepPenalty, endEl.getP());
             }
             
             int boxHeight = step - addedBoxHeight - penaltyHeight;
@@ -324,10 +327,13 @@
                     start[0], end[0], start[1], end[1]);
             returnList.add(new KnuthBox(boxHeight, stepPosition, false));
             if (addedBoxHeight < totalHeight) {
-                int p = 0;
-                if (keepWithNextActive || mustKeepTogether()) {
+                int p = stepPenalty;
+                if (keepWithNextActive) {
                     p = KnuthPenalty.INFINITE;
                 }
+                if (mustKeepTogether()) {
+                    p = Math.max(p, KeepUtil.getPenaltyForKeep(getKeepTogetherStrength()));
+                }
                 returnList.add(new BreakElement(stepPosition, penaltyHeight, p, -1, context));
             }
         }
@@ -630,15 +636,19 @@
     }
 
     /** {@inheritDoc} */
-    public boolean mustKeepTogether() {
-        //TODO Keeps will have to be more sophisticated sooner or later
-        return ((BlockLevelLayoutManager)getParent()).mustKeepTogether() 
-                || !getListItemFO().getKeepTogether().getWithinPage().isAuto()
-                || !getListItemFO().getKeepTogether().getWithinColumn().isAuto();
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getListItemFO().getKeepTogether().getWithinPage()));
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getListItemFO().getKeepTogether().getWithinColumn()));
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
     }
 
     /** {@inheritDoc} */
     public boolean mustKeepWithPrevious() {
+        //TODO Keeps will have to be more sophisticated sooner or later
         return !getListItemFO().getKeepWithPrevious().getWithinPage().isAuto()
             || !getListItemFO().getKeepWithPrevious().getWithinColumn().isAuto();
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -19,12 +19,12 @@
  
 package org.apache.fop.layoutmgr.table;
 
+import org.apache.fop.area.Area;
+import org.apache.fop.area.Block;
 import org.apache.fop.fo.flow.table.TableAndCaption;
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.PositionIterator;
-import org.apache.fop.area.Area;
-import org.apache.fop.area.Block;
 
 /**
  * LayoutManager for a table-and-caption FO.
@@ -191,5 +191,18 @@
             curBlockArea.addBlock((Block) childArea);
         }
     }
-}
-
+    
+    /** {@inheritDoc} */
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        /* TODO Complete me!
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getTableAndCaption().getKeepTogether().getWithinPage()));
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getTableAndCaption().getKeepTogether().getWithinColumn()));
+        */
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
+    }    
+    
+}
\ No newline at end of file

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -19,12 +19,12 @@
  
 package org.apache.fop.layoutmgr.table;
 
+import org.apache.fop.area.Area;
+import org.apache.fop.area.Block;
 import org.apache.fop.fo.flow.table.TableCaption;
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.PositionIterator;
-import org.apache.fop.area.Area;
-import org.apache.fop.area.Block;
 
 /**
  * LayoutManager for a table-caption FO.
@@ -46,6 +46,11 @@
         super(node);
     }
 
+    /** @return the table-caption FO */
+    public TableCaption getTableCaption() {
+        return (TableCaption)this.fobj;
+    }
+    
     /**
      * Get the next break position for the caption.
      *
@@ -190,5 +195,19 @@
                 curBlockArea.addBlock((Block) childArea);
         }
     }
+    
+    /** {@inheritDoc} */
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        /* TODO Complete me!
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getTableCaption().getKeepTogether().getWithinPage()));
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getTableCaption().getKeepTogether().getWithinColumn()));
+        */
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
+    }
+    
 }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -27,7 +27,6 @@
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.Trait;
-import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.flow.table.ConditionalBorder;
 import org.apache.fop.fo.flow.table.GridUnit;
 import org.apache.fop.fo.flow.table.PrimaryGridUnit;
@@ -41,13 +40,12 @@
 import org.apache.fop.layoutmgr.AreaAdditionUtil;
 import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
-import org.apache.fop.layoutmgr.BreakElement;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.KnuthBox;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthGlue;
 import org.apache.fop.layoutmgr.KnuthPenalty;
 import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.ListElement;
 import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.PositionIterator;
 import org.apache.fop.layoutmgr.SpaceResolver;
@@ -162,46 +160,7 @@
             if (prevLM != null) {
                 // there is a block handled by prevLM
                 // before the one handled by curLM
-                if (mustKeepTogether()
-                        || context.isKeepWithNextPending()
-                        || childLC.isKeepWithPreviousPending()) {
-                    //Clear keep pending flag
-                    context.setFlags(LayoutContext.KEEP_WITH_NEXT_PENDING, false);
-                    childLC.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING, false);
-                    // add an infinite penalty to forbid a break between
-                    // blocks
-                    contentList.add(new BreakElement(
-                            new Position(this), KnuthElement.INFINITE, context));
-                    //contentList.add(new KnuthPenalty(0,
-                    //        KnuthElement.INFINITE, false,
-                    //        new Position(this), false));
-                } else if (!(((ListElement) contentList.getLast()).isGlue()
-                        || (((ListElement)contentList.getLast()).isPenalty()
-                                && ((KnuthPenalty)contentList.getLast()).getP() < KnuthElement.INFINITE)
-                                || (contentList.getLast() instanceof BreakElement
-                                        && ((BreakElement)contentList.getLast()).getPenaltyValue() < KnuthElement.INFINITE))) {
-                    // TODO vh: this is hacky
-                    // The getNextKnuthElements method of TableCellLM must not be called
-                    // twice, otherwise some settings like indents or borders will be
-                    // counted several times and lead to a wrong output. Anyway the
-                    // getNextKnuthElements methods should be called only once eventually
-                    // (i.e., when multi-threading the code), even when there are forced
-                    // breaks.
-                    // If we add a break possibility after a forced break the
-                    // AreaAdditionUtil.addAreas method will act on a sequence starting
-                    // with a SpaceResolver.SpaceHandlingBreakPosition element, having no
-                    // LM associated to it. Thus it will stop early instead of adding
-                    // areas for following Positions. The above test aims at preventing
-                    // such a situation from occurring. add a null penalty to allow a break
-                    // between blocks
-                    contentList.add(new BreakElement(
-                            new Position(this), 0, context));
-                    //contentList.add(new KnuthPenalty(0, 0, false,
-                    //        new Position(this), false));
-                } else {
-                    // the last element in contentList is a feasible breakpoint, there is
-                    // no need to add a penalty
-                }
+                addInBetweenBreak(contentList, context, childLC);
             }
             contentList.addAll(returnedList);
             if (returnedList.size() == 0) {
@@ -596,22 +555,22 @@
         // TODO Auto-generated method stub
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public boolean mustKeepTogether() {
-        //TODO Keeps will have to be more sophisticated sooner or later
-        boolean keep = ((BlockLevelLayoutManager)getParent()).mustKeepTogether();
+    /** {@inheritDoc} */
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
         if (primaryGridUnit.getRow() != null) {
-            keep |= primaryGridUnit.getRow().mustKeepTogether();
+            strength = Math.max(strength, KeepUtil.getKeepStrength(
+                    primaryGridUnit.getRow().getKeepTogether().getWithinPage()));
+            strength = Math.max(strength, KeepUtil.getKeepStrength(
+                    primaryGridUnit.getRow().getKeepTogether().getWithinColumn()));
         }
-        return keep;
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
     }
-
-    /**
-     * {@inheritDoc}
-     */
+    
+    /** {@inheritDoc} */
     public boolean mustKeepWithPrevious() {
+        //TODO Keeps will have to be more sophisticated sooner or later
         return false; //TODO FIX ME
         /*
         return !fobj.getKeepWithPrevious().getWithinPage().isAuto()
@@ -619,9 +578,7 @@
             */
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public boolean mustKeepWithNext() {
         return false; //TODO FIX ME
         /*

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Tue Apr 15 12:18:46 2008
@@ -27,6 +27,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FObj;
@@ -36,6 +37,7 @@
 import org.apache.fop.fo.flow.table.TableBody;
 import org.apache.fop.layoutmgr.BreakElement;
 import org.apache.fop.layoutmgr.ElementListUtils;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.KnuthBox;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthPossPosIter;
@@ -226,9 +228,12 @@
                 nextRowGroupElems = rowGroupLM.getNextKnuthElements(context, alignment, bodyType);
                 int penaltyValue = 0;
                 keepBetween |= context.isKeepWithPreviousPending();
-                if (keepBetween || tableLM.getTable().mustKeepTogether()) {
+                if (keepBetween) {
                     penaltyValue = KnuthElement.INFINITE;
                 }
+                penaltyValue = Math.max(penaltyValue,
+                        KeepUtil.getPenaltyForKeep(getTableLM().getKeepTogetherStrength()));
+                
                 breakBetween = BreakUtil.compareBreakClasses(breakBetween,
                         context.getBreakBefore());
                 if (breakBetween != Constants.EN_AUTO) {

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?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- 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 Tue Apr 15 12:18:46 2008
@@ -39,6 +39,7 @@
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.BreakElement;
 import org.apache.fop.layoutmgr.ConditionalElementListener;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthGlue;
 import org.apache.fop.layoutmgr.LayoutContext;
@@ -445,16 +446,17 @@
         
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public boolean mustKeepTogether() {
-        //TODO Keeps will have to be more sophisticated sooner or later
-        return super.mustKeepTogether() 
-                || !getTable().getKeepTogether().getWithinPage().isAuto()
-                || !getTable().getKeepTogether().getWithinColumn().isAuto();
+    /** {@inheritDoc} */
+    public int getKeepTogetherStrength() {
+        int strength = KEEP_AUTO;
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getTable().getKeepTogether().getWithinPage()));
+        strength = Math.max(strength, KeepUtil.getKeepStrength(
+                getTable().getKeepTogether().getWithinColumn()));
+        strength = Math.max(strength, getParentKeepTogetherStrength());
+        return strength;
     }
-
+    
     /**
      * {@inheritDoc}
      */

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java Tue Apr 15 12:18:46 2008
@@ -25,11 +25,13 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.flow.table.EffRow;
 import org.apache.fop.fo.flow.table.GridUnit;
 import org.apache.fop.fo.flow.table.PrimaryGridUnit;
 import org.apache.fop.layoutmgr.BreakElement;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.KnuthBox;
 import org.apache.fop.layoutmgr.KnuthGlue;
 import org.apache.fop.layoutmgr.KnuthPenalty;
@@ -234,13 +236,15 @@
                 ActiveCell activeCell = (ActiveCell) iter.next();
                 keepWithNext |= activeCell.keepWithNextSignal();
             }
-            if (keepWithNext || getTableLM().mustKeepTogether()) {
+            if (keepWithNext) {
                 p = KnuthPenalty.INFINITE;
             }
             if (!rowFinished) {
-                if (rowGroup[activeRowIndex].mustKeepTogether()) {
-                    p = KnuthPenalty.INFINITE;
-                }
+                p = Math.max(p, KeepUtil.getPenaltyForKeep(
+                        rowGroup[activeRowIndex].getKeepTogetherStrength()));
+                //The above call doesn't take the penalty from the table into account, so...
+                p = Math.max(p, KeepUtil.getPenaltyForKeep(
+                        getTableLM().getKeepTogetherStrength()));
             } else if (activeRowIndex < rowGroup.length - 1) {
                 if (rowGroup[activeRowIndex].mustKeepWithNext()
                         || rowGroup[activeRowIndex + 1].mustKeepWithPrevious()) {

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml?rev=648381&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml Tue Apr 15 12:18:46 2008
@@ -0,0 +1,95 @@
+<?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 keep-together with integer values.
+    </p>
+    <p>
+      Widows and Orphans are disabled in this test to avoid side-effects.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" widows="0" orphans="0">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="12 * 14.4pt">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block-container keep-together.within-column="1" background-color="rgb(230,230,255)">
+            <fo:block-container keep-together.within-column="2" background-color="rgb(200,200,255)">
+              <fo:block-container keep-together.within-column="3" background-color="rgb(170,170,255)">
+                <fo:block>block1</fo:block>
+                <fo:block>block2</fo:block>
+              </fo:block-container>
+              <fo:block-container keep-together.within-column="always" background-color="rgb(0,0,255)" color="white">
+                <fo:block>block3</fo:block>
+                <fo:block>block4</fo:block>
+              </fo:block-container>
+            </fo:block-container>
+            <fo:block-container keep-together.within-column="always" background-color="rgb(0,0,255)" color="white">
+              <fo:block>block5</fo:block>
+              <fo:block>block6</fo:block>
+            </fo:block-container>
+              <fo:block-container keep-together.within-column="3" background-color="rgb(170,170,255)">
+                <fo:block-container keep-together.within-column="2" background-color="rgb(200,200,255)">
+                <fo:block>block7</fo:block>
+                <fo:block>block8</fo:block>
+                </fo:block-container>
+              </fo:block-container>
+            <fo:block-container keep-together.within-column="always" background-color="rgb(170,170,255)">
+              <fo:block-container keep-together.within-column="2" background-color="rgb(200,200,255)">
+                <fo:block>block9</fo:block>
+                <fo:block>blockA</fo:block>
+              </fo:block-container>
+            </fo:block-container>
+          </fo:block-container>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <element-list category="breaker">
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="INF"/> <!-- 3/4 -->
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="INF"/> <!-- 5/6 -->
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="INF"/> <!-- 9/A -->
+      <box/>
+      
+      <skip>3</skip>
+    </element-list>
+    
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_keep-together_integers_1.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml?rev=648381&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_1.xml Tue Apr 15 12:18:46 2008
@@ -0,0 +1,100 @@
+<?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 keep-together with integer values.
+    </p>
+    <p>
+      Widows and Orphans are disabled in this test to avoid side-effects.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" widows="0" orphans="0">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="4.5 * 14.4pt">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>block1</fo:block>
+          <fo:block>block2</fo:block>
+          <fo:block keep-together.within-column="3">block3 
+            <fo:inline font-style="italic">
+              The quick brown fox jumps over the lazy dog.
+              The quick brown fox jumps over the lazy dog.
+              The quick brown fox jumps over the lazy dog.
+            </fo:inline>
+          </fo:block>
+          <fo:block keep-together.within-column="1">
+            <fo:block>block4</fo:block>
+            <fo:block>block5</fo:block>
+            <fo:block keep-together.within-page="always" color="red">
+              <fo:block>block6</fo:block>
+              <fo:block>block7</fo:block>
+              <fo:block>block8</fo:block>
+              <fo:block>block9</fo:block>
+            </fo:block>
+            <fo:block>block10</fo:block>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="1" xpath="//lineArea[starts-with(., 'block1')]/ancestor::pageViewport/@nr"/>
+    <eval expected="1" xpath="//lineArea[starts-with(., 'block2')]/ancestor::pageViewport/@nr"/>
+    <eval expected="2" xpath="//lineArea[starts-with(., 'block3')]/ancestor::pageViewport/@nr"/>
+    <eval expected="3" xpath="//lineArea[starts-with(., 'block4')]/ancestor::pageViewport/@nr"/>
+    <eval expected="3" xpath="//lineArea[starts-with(., 'block5')]/ancestor::pageViewport/@nr"/>
+    <eval expected="4" xpath="//lineArea[starts-with(., 'block6')]/ancestor::pageViewport/@nr"/>
+    <eval expected="4" xpath="//lineArea[starts-with(., 'block7')]/ancestor::pageViewport/@nr"/>
+    <eval expected="4" xpath="//lineArea[starts-with(., 'block8')]/ancestor::pageViewport/@nr"/>
+    <eval expected="4" xpath="//lineArea[starts-with(., 'block9')]/ancestor::pageViewport/@nr"/>
+    <eval expected="5" xpath="//lineArea[starts-with(., 'block10')]/ancestor::pageViewport/@nr"/>
+    
+    <element-list category="breaker">
+      <box/>
+      <penalty w="0" p="0"/>
+      <box/>
+      <penalty w="0" p="0"/>
+      <box/> <!-- block 3 -->
+      <box/>
+      <box/>
+      <penalty w="0" p="0"/>
+      <box/> <!-- block4 -->
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/> <!-- block6 -->
+      <penalty w="0" p="INF"/>
+      <box/>
+      <penalty w="0" p="INF"/>
+      <box/>
+      <penalty w="0" p="INF"/>
+      <box/> <!-- block9 -->
+      <penalty w="0" p="999"/>
+      <box/>
+      
+      <skip>3</skip>
+    </element-list>
+    
+  </checks>
+</testcase>

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

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

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_2.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_2.xml?rev=648381&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_2.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_integers_2.xml Tue Apr 15 12:18:46 2008
@@ -0,0 +1,95 @@
+<?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 keep-together with integer values.
+    </p>
+    <p>
+      Widows and Orphans are disabled in this test to avoid side-effects.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" widows="0" orphans="0">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="12 * 14.4pt">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block keep-together.within-column="1" background-color="rgb(230,230,255)">
+            <fo:block keep-together.within-column="2" background-color="rgb(200,200,255)">
+              <fo:block keep-together.within-column="3" background-color="rgb(170,170,255)">
+                <fo:block>block1</fo:block>
+                <fo:block>block2</fo:block>
+              </fo:block>
+              <fo:block keep-together.within-column="always" background-color="rgb(0,0,255)" color="white">
+                <fo:block>block3</fo:block>
+                <fo:block>block4</fo:block>
+              </fo:block>
+            </fo:block>
+            <fo:block keep-together.within-column="always" background-color="rgb(0,0,255)" color="white">
+              <fo:block>block5</fo:block>
+              <fo:block>block6</fo:block>
+            </fo:block>
+            <fo:block keep-together.within-column="3" background-color="rgb(170,170,255)">
+              <fo:block keep-together.within-column="2" background-color="rgb(200,200,255)">
+                <fo:block>block7</fo:block>
+                <fo:block>block8</fo:block>
+              </fo:block>
+            </fo:block>
+            <fo:block keep-together.within-column="always" background-color="rgb(170,170,255)">
+              <fo:block keep-together.within-column="2" background-color="rgb(200,200,255)">
+                <fo:block>block9</fo:block>
+                <fo:block>blockA</fo:block>
+              </fo:block>
+            </fo:block>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <element-list category="breaker">
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="INF"/> <!-- 3/4 -->
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="INF"/> <!-- 5/6 -->
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="999"/>
+      <box/>
+      <penalty w="0" p="INF"/> <!-- 9/A -->
+      <box/>
+      
+      <skip>3</skip>
+    </element-list>
+    
+  </checks>
+</testcase>

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

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

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml Tue Apr 15 12:18:46 2008
@@ -44,7 +44,7 @@
         <fo:flow flow-name="xsl-region-body">
           <fo:block>block1</fo:block>
           <fo:block>block2</fo:block>
-          <fo:block keep-together.within-page="10" color="blue">
+          <fo:block keep-together.within-page="always" color="blue">
             <fo:block>block3</fo:block>
             <fo:block>block4</fo:block>
             <fo:block>block5</fo:block>
@@ -53,7 +53,7 @@
           </fo:block>
           <fo:block>block8</fo:block>
           <fo:block>block9</fo:block>
-          <fo:block keep-together.within-page="10" color="green">
+          <fo:block keep-together.within-page="always" color="green">
             <fo:block>block10</fo:block>
             <fo:block>block11</fo:block>
             <fo:block>block12</fo:block>

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/list-block_keep-together.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/list-block_keep-together.xml?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/list-block_keep-together.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/list-block_keep-together.xml Tue Apr 15 12:18:46 2008
@@ -25,14 +25,15 @@
   <fo>
     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" white-space-collapse="true" widows="0" orphans="0">
       <fo:layout-master-set>
-        <fo:simple-page-master master-name="normal" page-width="5in" page-height="4.5 * 14.4pt">
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="20 * 14.4pt">
           <fo:region-body/>
         </fo:simple-page-master>
       </fo:layout-master-set>
       <fo:page-sequence master-reference="normal">
         <fo:flow flow-name="xsl-region-body">
           <fo:block>block1</fo:block>
-          <fo:list-block 
+          <!-- Keeps on list-block level -->
+          <fo:list-block background-color="rgb(150,150,255)"
               provisional-distance-between-starts="25mm"
               provisional-label-separation="5mm" 
               keep-together.within-page="always">
@@ -54,16 +55,16 @@
             </fo:list-item>
           </fo:list-block>
           <fo:block>block2</fo:block>
-          <fo:list-block 
-              provisional-distance-between-starts="25mm"
-              provisional-label-separation="5mm">
-            <fo:list-item keep-together.within-page="always">
+          <fo:list-block background-color="rgb(230,230,255)" 
+            provisional-distance-between-starts="25mm"
+            provisional-label-separation="5mm" 
+            keep-together.within-column="1">
+            <fo:list-item>
               <fo:list-item-label end-indent="label-end()">
                 <fo:block>label1</fo:block>
               </fo:list-item-label>
               <fo:list-item-body start-indent="body-start()">
                 <fo:block>item1</fo:block>
-                <fo:block>item1</fo:block>
               </fo:list-item-body>
             </fo:list-item>
             <fo:list-item>
@@ -76,11 +77,44 @@
             </fo:list-item>
           </fo:list-block>
           <fo:block>block3</fo:block>
+          <!-- Keeps on list-item level -->
           <fo:list-block 
               provisional-distance-between-starts="25mm"
               provisional-label-separation="5mm">
+            <fo:list-item keep-together.within-page="always" background-color="rgb(150,150,255)">
+              <fo:list-item-label end-indent="label-end()">
+                <fo:block>label1</fo:block>
+              </fo:list-item-label>
+              <fo:list-item-body start-indent="body-start()">
+                <fo:block>item1</fo:block>
+                <fo:block>item1</fo:block>
+              </fo:list-item-body>
+            </fo:list-item>
+            <fo:list-item keep-together.within-column="1" background-color="rgb(230,230,255)">
+              <fo:list-item-label end-indent="label-end()">
+                <fo:block>label1</fo:block>
+              </fo:list-item-label>
+              <fo:list-item-body start-indent="body-start()">
+                <fo:block>item1</fo:block>
+                <fo:block>item1</fo:block>
+              </fo:list-item-body>
+            </fo:list-item>
             <fo:list-item>
               <fo:list-item-label end-indent="label-end()">
+                <fo:block>label3</fo:block>
+              </fo:list-item-label>
+              <fo:list-item-body start-indent="body-start()">
+                <fo:block>item3</fo:block>
+              </fo:list-item-body>
+            </fo:list-item>
+          </fo:list-block>
+          <fo:block>block4</fo:block>
+          <!-- Keeps on list-item-body level -->
+          <fo:list-block 
+              provisional-distance-between-starts="25mm"
+              provisional-label-separation="5mm">
+            <fo:list-item background-color="rgb(150,150,255)">
+              <fo:list-item-label end-indent="label-end()">
                 <fo:block>label1</fo:block>
               </fo:list-item-label>
               <fo:list-item-body start-indent="body-start()" keep-together.within-page="always">
@@ -88,47 +122,80 @@
                 <fo:block>item1</fo:block>
               </fo:list-item-body>
             </fo:list-item>
-            <fo:list-item>
+            <fo:list-item background-color="rgb(230,230,255)">
               <fo:list-item-label end-indent="label-end()">
                 <fo:block>label2</fo:block>
               </fo:list-item-label>
-              <fo:list-item-body start-indent="body-start()">
+              <fo:list-item-body start-indent="body-start()" keep-together.within-column="1">
+                <fo:block>item2</fo:block>
                 <fo:block>item2</fo:block>
               </fo:list-item-body>
             </fo:list-item>
+            <fo:list-item>
+              <fo:list-item-label end-indent="label-end()">
+                <fo:block>label3</fo:block>
+              </fo:list-item-label>
+              <fo:list-item-body start-indent="body-start()">
+                <fo:block>item3</fo:block>
+              </fo:list-item-body>
+            </fo:list-item>
           </fo:list-block>
-          <fo:block>block4</fo:block>
+          <fo:block>block5</fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
     <element-list category="breaker">
-      <box w="14400"/>
+      <box/> <!-- block1 -->
       <penalty w="0" p="0"/>
+      
       <!-- list 1 starts -->
       <box w="14400"/>
       <penalty w="0" p="INF"/>
       <box w="14400"/>
       <!-- list 1 end -->
+      
       <penalty w="0" p="0"/>
-      <box w="14400"/>
+      <box/> <!-- block2 -->
       <penalty w="0" p="0"/>
+      
       <!-- list 2 starts -->
-      <box w="28800"/>
-      <penalty w="0" p="0"/>
+      <box w="14400"/>
+      <penalty w="0" p="999"/>
       <box w="14400"/>
       <!-- list 2 end -->
+      
       <penalty w="0" p="0"/>
-      <box w="14400"/>
+      <box/> <!-- block3 -->
       <penalty w="0" p="0"/>
+      
       <!-- list 3 starts -->
       <box w="28800"/>
       <penalty w="0" p="0"/>
       <box w="14400"/>
+      <penalty w="0" p="999"/>
+      <box w="14400"/>
+      <penalty w="0" p="0"/>
+      <box w="14400"/>
       <!-- list 3 end -->
+      
       <penalty w="0" p="0"/>
+      <box/> <!-- block4 -->
+      <penalty w="0" p="0"/>
+      
+      <!-- list 4 starts -->
+      <box w="28800"/>
+      <penalty w="0" p="0"/>
+      <box w="14400"/>
+      <penalty w="0" p="999"/>
       <box w="14400"/>
+      <penalty w="0" p="0"/>
+      <box w="14400"/>
+      <!-- list 4 end -->
+      
+      <penalty w="0" p="0"/>
+      <box/> <!-- block5 -->
       <skip>3</skip>
     </element-list>
   </checks>

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml?rev=648381&r1=648380&r2=648381&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml Tue Apr 15 12:18:46 2008
@@ -25,16 +25,16 @@
   <fo>
     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" white-space-collapse="true" widows="0" orphans="0">
       <fo:layout-master-set>
-        <fo:simple-page-master master-name="normal" page-width="5in" page-height="4.5 * 14.4pt">
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="5 * 14.4pt">
           <fo:region-body/>
         </fo:simple-page-master>
       </fo:layout-master-set>
       <fo:page-sequence master-reference="normal">
         <fo:flow flow-name="xsl-region-body">
           <fo:block>block1</fo:block>
-          <fo:table table-layout="fixed" keep-together.within-page="always">
-            <fo:table-column/>
-            <fo:table-column/>
+          <fo:table table-layout="fixed" width="100%" keep-together.within-page="always">
+            <fo:table-column column-width="proportional-column-width(1)"/>
+            <fo:table-column column-width="proportional-column-width(1)"/>
             <fo:table-body>
               <fo:table-row>
                 <fo:table-cell id="cell1">
@@ -58,6 +58,35 @@
           <fo:block>block2</fo:block>
         </fo:flow>
       </fo:page-sequence>
+      <fo:page-sequence master-reference="normal">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>block1b</fo:block>
+          <fo:table table-layout="fixed" width="100%" keep-together.within-column="1">
+            <fo:table-column column-width="proportional-column-width(1)"/>
+            <fo:table-column column-width="proportional-column-width(1)"/>
+            <fo:table-body>
+              <fo:table-row>
+                <fo:table-cell id="cell1b">
+                  <fo:block>line1</fo:block>
+                  <fo:block>line2</fo:block>
+                </fo:table-cell>
+                <fo:table-cell id="cell2b">
+                  <fo:block>line1</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+              <fo:table-row>
+                <fo:table-cell id="cell3b">
+                  <fo:block>line1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell id="cell4b">
+                  <fo:block>line1</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:block>block2b</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
@@ -69,11 +98,33 @@
     <element-list category="table-cell" id="cell2">
       <box w="14400"/>
     </element-list>
-    <element-list category="breaker">
+    <element-list category="breaker" index="0">
       <box w="14400"/>
       <penalty w="0" p="0"/>
       <box w="28800"/>
       <penalty w="0" p="INF"/>
+      <box w="14400"/>
+      <penalty w="0" p="0"/>
+      <box w="14400"/>
+      <skip>3</skip>
+    </element-list>
+
+    <!-- the same again but this time with keep="1" -->
+    <element-list category="table-cell" id="cell1b">
+      <box w="14400"/>
+      <penalty w="0" p="999"/>
+      <box w="14400"/>
+    </element-list>
+    <element-list category="table-cell" id="cell2b">
+      <box w="14400"/>
+    </element-list>
+    <element-list category="breaker" index="1">
+      <box w="14400"/>
+      <penalty w="0" p="0"/>
+      <box w="14400"/>
+      <penalty w="0" p="999"/>
+      <box w="14400"/>
+      <penalty w="0" p="999"/>
       <box w="14400"/>
       <penalty w="0" p="0"/>
       <box w="14400"/>



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


Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Simon, Peter, Clay, Andreas, Chris,
thank you very much for your valuable feedback! It's reassuring to know
that I'm not totally off course.

Vincent, please keep the bug reports and other suggestions coming in the
future. But please try to treat me as a peer. I'll do the same back.
Thank you.

Have a good rest of the weekend, everyone!
Jeremias Maerki


Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Andreas Delmelle <an...@telenet.be>.
On Apr 21, 2008, at 12:22, Vincent Hennebert wrote:
>
> My reaction was not so much triggered by this (indeed) minor issue, as
> by the fact that once again I was being answered “feel free to  
> improve”
> when asking for cleanup/documentation, and I got tired of it. Each  
> time,
> they were small issues that were not a big deal in themselves, but  
> when
> combined together make the code IMO unnecessarily difficult to
> understand. We are dealing with a very complex piece of software,  
> so it
> looks even more important to me to keep the code as clean and readable
> as possible. Actually I consider this to be my duty whenever I commit
> something, and not spending the little time this requires for that
> eludes me completely.

FWIW: I think you do have a major point here. If it really concerns  
documentation, it's /always/ better if this is kept up-to-date by the  
dev that committed the changes in the first place. Someone else is  
much more likely to make errors in interpretation. Only the creator  
knows precisely what a certain part of the code is meant to do.

Cleanup is maybe more subjective than documentation (*), but that  
said, some simple rules of thumb would probably not hurt here.

In this last case, however, I got the impression (as Jeremias, I  
presume) that it was not about documentation or cleanup.
I initially read it more as a suggestion --What would you think  
if...? As such, Jeremias' reaction was very understandable to me, and  
it surprised me to see it escalate further.

(*) as in: My apartment is clean enough for me, but I know of people  
that would get a heart-attack if they entered here... ;-)


Cheers

Andreas

Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Thanks guys for chiming in. I’ll try to keep it short in order to not
relaunch the debate.

Let me just give some background that maybe will explain my reaction:
when I started to work on the implementation of collapsing borders in
tables, I spent almost twice the time that was initially estimated for
this on just trying to understand the current code and figure out where
I had to start. I am /very/ lucky that my sponsor was patient enough to
give me my chance and get it completed; had I worked on this in my free
time I would have abandoned long time ago. I really had the feeling that
I was doing the documentation and clean-up job in place of someone else;
there’s no fun in it and the perspective that I’ll have to do that again
for the next big task I’ll carry out makes me go mad. But apparently
that’s normal and I have to try and live with that.

My reaction was not so much triggered by this (indeed) minor issue, as
by the fact that once again I was being answered “feel free to improve”
when asking for cleanup/documentation, and I got tired of it. Each time,
they were small issues that were not a big deal in themselves, but when
combined together make the code IMO unnecessarily difficult to
understand. We are dealing with a very complex piece of software, so it
looks even more important to me to keep the code as clean and readable
as possible. Actually I consider this to be my duty whenever I commit
something, and not spending the little time this requires for that
eludes me completely.

Jeremias, I have absolutely nothing personal against you, and I did
enjoy the time we had together during the ApacheCon. You are much more
experienced than me and I wish I were as quick as you can be when
implementing new features. But I don’t change my mind on this and still
think you should try and clean-up your code a bit more.

Cheers,
Vincent


--
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting


Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by "Peter B. West" <li...@pbw.id.au>.
Jeremias,

For what it's worth, I think you have done an extraordinary job with 
FOP. From my outside perspective, you have been the primary driver of 
the progress of the product since you came to the forefront of development.

There's an inherent problem of clashing egos in OS development. I know 
all about that one. When that starts to happen, project productivity can 
dive until the conflict is sorted out.

If you are feeling burnt-out, it might be time to consider tailing off 
your involvement in the project.

Let me say, however, that on at least two occasions that I remember, 
Vincent has displayed a breath-taking and unwarranted arrogance. Vincent 
has a very high opinion of his own ability and I suspect he sees himself 
as the natural leader of the project.

Unless Vincent develops some hitherto unsuspected humility and 
consideration, this difficulty can only end in one of you bowing out. 
That would be a pity.


Jeremias Maerki wrote:
> On 18.04.2008 19:24:05 Vincent Hennebert wrote:
>> Jeremias Maerki wrote:
>>> On 18.04.2008 16:51:37 Vincent Hennebert wrote:
>>>> Jeremias Maerki wrote:
>>>>> On 18.04.2008 12:48:53 Vincent Hennebert wrote:
>>>>>> Hi,
>>>>>>
>>>>>> A few comments:
>>>>>>
>>>>>> - some time ago I created a BreakUtil class in the o.a.f.util package.
>>>>>>   I think this class and KeepUtil should be put in the same place.
>>>>>>   Perhaps we could even merge them into a unique KeepsAndBreaksUtil
>>>>>>   class. I don’t really know what the best place would be. I put it in
>>>>>>   o.a.f.util because it already contains all sorts of utility classes,
>>>>>>   but o.a.f.layoutmgr would also make sense. WDYT?
>>>>> Whatever.
>>>> I let you choose, but please take care of this.
>>> "Whatever" means: I don't care and you can fix this if it is important
>>> to you.
>> Yeah, sure, let’s all do our own mess in our own corner and everything
>> will be fine.
>>
>> I’m not asking you to finish my work, so please don’t ask me to finish
>> yours. You created a class that’s closely related to another existing
>> one that’s somewhere else; it’s your responsibility to try and maintain
>> some coherence in the codebase by fixing this.
>>
>> Give me any good reason for not doing this simple thing, other than that
>> you don’t care or you don’t have enough time, and I’m shutting up
>> straight away. But you can’t call for contributors on one side and not
>> do even the most basic cleaning behind you on the other side.
> 
> Ok, let's do it this way: If one other FOP committers says that this
> (Vincent's idea) is something I should do, I'll do it. No discussion.
> Otherwise, it's 1:1 and I won't waste my time on something I don't think
> helps in any way. Remember, this is a democracy and a meritocracy here.
> 
> http://www.apache.org/foundation/how-it-works.html#meritocracy
> http://www.apache.org/foundation/how-it-works.html#committers
> 
> We've had a long discussion together around this last week during
> ApacheCon. IMO, you're going too far now. I increasingly feel like I'm
> your bitch. Today alone I lost almost half a day because I was too angry
> to work. I couldn't concentrate on what I should have been looking into.
> It's ok if you point out bugs and if I fix them because the bug is one
> of mine. I'm actually grateful for that. It's something else entirely if
> you have some idea and expect me to do the work. For free, notabene. I
> can also send you an invoice. In that case, I don't mind the additional
> work.
> 
> OTOH, if I'm creating a mess here, maybe I should leave the project in
> order not to damage it any more because I care about it. Or better
> revert all my changes on Trunk in the last 3 years to undo the damage.
> Sorry for getting sarcastic, but it's not that far off.
> 
> The other option: we could to switch to R-T-C:
> http://www.apache.org/foundation/glossary.html#ReviewThenCommit
> The PMC can decide to do that. That way we're always sure the community
> stands behind every change. But of course, you know what that would mean
> for the project.
> 
> FOP community, if you think I drifted out of line lately, please set me
> straight. Vincent's voice is only one. I know this scene here is ugly
> and nobody wants to waste his precious free time on participating in
> fights between two people. The fight also doesn't help the project at
> all. Quite the opposite. In the case of Avalon...... Anyway, I keep
> finding myself in confrontations with team members from time to time. At
> this time, I'm seriously questioning myself and I'm not sure if that's
> just me and my thick head, if I care too much about the project, or if I
> simply have more attack area because I'm one of the most active people
> here. Some hints would be great (on- or off-list). Please be frank.
> Thanks and my apologies for the ugly scene!
> 
> 
> Jeremias Maerki (whose boss is Jeremias and to a certain degree the XML
> Graphics PMC, but certainly not Vincent as an individual)
> 
> 
> 


-- 
Peter B. West <http://cv.pbw.id.au/>
Folio <http://defoe.sourceforge.net/folio/>

Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Andreas Delmelle <an...@telenet.be>.
On Apr 18, 2008, at 21:52, Simon Pepping wrote:
> Easy please. Vincent has a preference. Jeremias is OK with it, but he
> is not hot about it, so he is not going to do it. Vincent did not add
> the new utilities, so he is not going to do it. That leaves Andreas to
> do it, or me, or ..., or it remains undone.

My thoughts on this:

a) if anyone really has a /strong/ preference to have it one way or  
the other, then I would expect a commit rather than a 'comment'. ;-)
b) if anyone states that he does not care that much, such 'comments'  
are probably never going to get him to make the necessary changes  
anyway. At most, any further insistence would irritate him slightly.  
(If he were me, at least...)

All fine by me if you're just raising the question to check if anyone  
would disagree with such a change, but as soon as the answer is:  
'Whatever, go right ahead if you prefer', then, please, take the hint  
and either shut up and live with it, or commit the changes yourself  
if it is /that/ important to you.

No amount of nagging about it is going to help anyone. Quite on the  
contrary, as we are now seeing (yet again?), if this passes a certain  
threshold, it starts to hurt productivity.

I suggest we let the matter rest here before it grows to ridiculous  
proportions --if it hasn't already... After all, it's not as if it  
concerns any Major design decisions--, and get back to coding,  
helping FOP users and everything else that /really/ matters.


Cheers

Andreas

Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Simon Pepping <sp...@leverkruid.eu>.
Easy please. Vincent has a preference. Jeremias is OK with it, but he
is not hot about it, so he is not going to do it. Vincent did not add
the new utilities, so he is not going to do it. That leaves Andreas to
do it, or me, or ..., or it remains undone. Fortunately, that would
not create a mess. 

Jeremias has never been in the habit of creating a mess. Nor has
Vincent. But Jeremias does not code in the manner of Vincent, nor does
Vincent in Jeremias' style. We have to live with that diversity. FOP
is that sort of project. It benefits from that diversity, because the
project has so many diverse sides to it. But the style will never be
uniform. Alas?

Simon

On Fri, Apr 18, 2008 at 09:14:01PM +0200, Jeremias Maerki wrote:
> On 18.04.2008 19:24:05 Vincent Hennebert wrote:
> > Jeremias Maerki wrote:
> > > On 18.04.2008 16:51:37 Vincent Hennebert wrote:
> > >> Jeremias Maerki wrote:
> > >>> On 18.04.2008 12:48:53 Vincent Hennebert wrote:
> > >>>> Hi,
> > >>>>
> > >>>> A few comments:
> > >>>>
> > >>>> - some time ago I created a BreakUtil class in the o.a.f.util package.
> > >>>>   I think this class and KeepUtil should be put in the same place.
> > >>>>   Perhaps we could even merge them into a unique KeepsAndBreaksUtil
> > >>>>   class. I don???t really know what the best place would be. I put it in
> > >>>>   o.a.f.util because it already contains all sorts of utility classes,
> > >>>>   but o.a.f.layoutmgr would also make sense. WDYT?
> > >>> Whatever.
> > >> I let you choose, but please take care of this.
> > >
> > > "Whatever" means: I don't care and you can fix this if it is important
> > > to you.
> > 
> 
> Ok, let's do it this way: If one other FOP committers says that this
> (Vincent's idea) is something I should do, I'll do it. No discussion.
> Otherwise, it's 1:1 and I won't waste my time on something I don't think
> helps in any way. Remember, this is a democracy and a meritocracy here.

-- 
Simon Pepping
home page: http://www.leverkruid.eu

Re: [!! SPAM] Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Chris Bowditch <bo...@hotmail.com>.
Jeremias Maerki wrote:

<snip/>

> 
> FOP community, if you think I drifted out of line lately, please set me
> straight. Vincent's voice is only one. I know this scene here is ugly
> and nobody wants to waste his precious free time on participating in
> fights between two people. The fight also doesn't help the project at
> all. Quite the opposite. In the case of Avalon...... Anyway, I keep
> finding myself in confrontations with team members from time to time. At
> this time, I'm seriously questioning myself and I'm not sure if that's
> just me and my thick head, if I care too much about the project, or if I
> simply have more attack area because I'm one of the most active people
> here. Some hints would be great (on- or off-list). Please be frank.
> Thanks and my apologies for the ugly scene!

I have the utmost respect for both Jeremias and Vincent. Both have put a 
lot into the project over the years. Both are clever people, hard 
working individuals. I know them both and think they are both great people.

Over my years as a Software Engineer I have noticed that everyone has a 
very different style of developing code. Sometimes people critise my 
coding style and it annoys me. Sometimes I see a coding style I don't 
like. It's a fact of life. Whatever project you work on. You just have 
to accept it.

Vincent and Jeremias both have a very different style of programming. 
Both are very effective at delivering new features. Neither is wrong or 
better than the other. Please try to recognise that you both have a very 
different style of working and accept that you cannot make the other 
adopt your style.

Thanks,

Chris



Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 18.04.2008 19:24:05 Vincent Hennebert wrote:
> Jeremias Maerki wrote:
> > On 18.04.2008 16:51:37 Vincent Hennebert wrote:
> >> Jeremias Maerki wrote:
> >>> On 18.04.2008 12:48:53 Vincent Hennebert wrote:
> >>>> Hi,
> >>>>
> >>>> A few comments:
> >>>>
> >>>> - some time ago I created a BreakUtil class in the o.a.f.util package.
> >>>>   I think this class and KeepUtil should be put in the same place.
> >>>>   Perhaps we could even merge them into a unique KeepsAndBreaksUtil
> >>>>   class. I don’t really know what the best place would be. I put it in
> >>>>   o.a.f.util because it already contains all sorts of utility classes,
> >>>>   but o.a.f.layoutmgr would also make sense. WDYT?
> >>> Whatever.
> >> I let you choose, but please take care of this.
> >
> > "Whatever" means: I don't care and you can fix this if it is important
> > to you.
> 
> Yeah, sure, let’s all do our own mess in our own corner and everything
> will be fine.
> 
> I’m not asking you to finish my work, so please don’t ask me to finish
> yours. You created a class that’s closely related to another existing
> one that’s somewhere else; it’s your responsibility to try and maintain
> some coherence in the codebase by fixing this.
> 
> Give me any good reason for not doing this simple thing, other than that
> you don’t care or you don’t have enough time, and I’m shutting up
> straight away. But you can’t call for contributors on one side and not
> do even the most basic cleaning behind you on the other side.

Ok, let's do it this way: If one other FOP committers says that this
(Vincent's idea) is something I should do, I'll do it. No discussion.
Otherwise, it's 1:1 and I won't waste my time on something I don't think
helps in any way. Remember, this is a democracy and a meritocracy here.

http://www.apache.org/foundation/how-it-works.html#meritocracy
http://www.apache.org/foundation/how-it-works.html#committers

We've had a long discussion together around this last week during
ApacheCon. IMO, you're going too far now. I increasingly feel like I'm
your bitch. Today alone I lost almost half a day because I was too angry
to work. I couldn't concentrate on what I should have been looking into.
It's ok if you point out bugs and if I fix them because the bug is one
of mine. I'm actually grateful for that. It's something else entirely if
you have some idea and expect me to do the work. For free, notabene. I
can also send you an invoice. In that case, I don't mind the additional
work.

OTOH, if I'm creating a mess here, maybe I should leave the project in
order not to damage it any more because I care about it. Or better
revert all my changes on Trunk in the last 3 years to undo the damage.
Sorry for getting sarcastic, but it's not that far off.

The other option: we could to switch to R-T-C:
http://www.apache.org/foundation/glossary.html#ReviewThenCommit
The PMC can decide to do that. That way we're always sure the community
stands behind every change. But of course, you know what that would mean
for the project.

FOP community, if you think I drifted out of line lately, please set me
straight. Vincent's voice is only one. I know this scene here is ugly
and nobody wants to waste his precious free time on participating in
fights between two people. The fight also doesn't help the project at
all. Quite the opposite. In the case of Avalon...... Anyway, I keep
finding myself in confrontations with team members from time to time. At
this time, I'm seriously questioning myself and I'm not sure if that's
just me and my thick head, if I care too much about the project, or if I
simply have more attack area because I'm one of the most active people
here. Some hints would be great (on- or off-list). Please be frank.
Thanks and my apologies for the ugly scene!


Jeremias Maerki (whose boss is Jeremias and to a certain degree the XML
Graphics PMC, but certainly not Vincent as an individual)


Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Jeremias Maerki wrote:
> On 18.04.2008 16:51:37 Vincent Hennebert wrote:
>> Jeremias Maerki wrote:
>>> On 18.04.2008 12:48:53 Vincent Hennebert wrote:
>>>> Hi,
>>>>
>>>> A few comments:
>>>>
>>>> - some time ago I created a BreakUtil class in the o.a.f.util package.
>>>>   I think this class and KeepUtil should be put in the same place.
>>>>   Perhaps we could even merge them into a unique KeepsAndBreaksUtil
>>>>   class. I don’t really know what the best place would be. I put it in
>>>>   o.a.f.util because it already contains all sorts of utility classes,
>>>>   but o.a.f.layoutmgr would also make sense. WDYT?
>>> Whatever.
>> I let you choose, but please take care of this.
>
> "Whatever" means: I don't care and you can fix this if it is important
> to you.

Yeah, sure, let’s all do our own mess in our own corner and everything
will be fine.

I’m not asking you to finish my work, so please don’t ask me to finish
yours. You created a class that’s closely related to another existing
one that’s somewhere else; it’s your responsibility to try and maintain
some coherence in the codebase by fixing this.

Give me any good reason for not doing this simple thing, other than that
you don’t care or you don’t have enough time, and I’m shutting up
straight away. But you can’t call for contributors on one side and not
do even the most basic cleaning behind you on the other side.


Vincent


-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 18.04.2008 16:51:37 Vincent Hennebert wrote:
> Jeremias Maerki wrote:
> > On 18.04.2008 12:48:53 Vincent Hennebert wrote:
> >> Hi,
> >>
> >> A few comments:
> >>
> >> - some time ago I created a BreakUtil class in the o.a.f.util package.
> >>   I think this class and KeepUtil should be put in the same place.
> >>   Perhaps we could even merge them into a unique KeepsAndBreaksUtil
> >>   class. I don’t really know what the best place would be. I put it in
> >>   o.a.f.util because it already contains all sorts of utility classes,
> >>   but o.a.f.layoutmgr would also make sense. WDYT?
> >
> > Whatever.
> 
> I let you choose, but please take care of this.

"Whatever" means: I don't care and you can fix this if it is important
to you.

<snip/> 



Jeremias Maerki


Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Jeremias Maerki wrote:
> On 18.04.2008 12:48:53 Vincent Hennebert wrote:
>> Hi,
>>
>> A few comments:
>>
>> - some time ago I created a BreakUtil class in the o.a.f.util package.
>>   I think this class and KeepUtil should be put in the same place.
>>   Perhaps we could even merge them into a unique KeepsAndBreaksUtil
>>   class. I don’t really know what the best place would be. I put it in
>>   o.a.f.util because it already contains all sorts of utility classes,
>>   but o.a.f.layoutmgr would also make sense. WDYT?
>
> Whatever.

I let you choose, but please take care of this.


>> - it would be better to create the testcases such that the rendering
>>   will become wrong if the feature is broken. For example, put the block
>>   at the bottom of the page, such that it gets deferred to the next page
>>   if keep is working, and split over 2 pages if keep is broken. Exactly
>>   like you did in block_keep-together_integers_1.xml.
>>   There are 2 reasons for this:
>>   - just because the element list looks ok doesn’t ensure that the
>>     rendering will be fine. Actually a recent post on fop-users [1]
>>     shows that.
>
> We've had the other case, too: Rendering looked fine but the element
> list was wrong and lead to bad break decisions. I'm not sure if your
> example is a good one.

At least it shows that testing only one thing is not enough.


>>   - if the generation of Knuth elements is changed somehow, all the
>>     testcases must be adapted accordingly. I had to do that several
>>     times when working on tables in the past months, and this is really
>>     painful. Tests on Knuth elements should be reserved for special
>>     situations IMO.
>
> I'm doing unit testing here, or at least as "unit" testing as possible.
> What you're talking about is component testing and larger. I want to
> make sure that the element list is correct and I trust that the breaking
> algorithm does the right thing because it is already tested elsewhere. I
> completely disagree that element list test should be reserved for
> special situations. Or else this is exactly such a special situation for
> me.

Fair enough.

Vincent


-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 18.04.2008 12:48:53 Vincent Hennebert wrote:
> Hi,
> 
> A few comments:
> 
> - some time ago I created a BreakUtil class in the o.a.f.util package.
>   I think this class and KeepUtil should be put in the same place.
>   Perhaps we could even merge them into a unique KeepsAndBreaksUtil
>   class. I don’t really know what the best place would be. I put it in
>   o.a.f.util because it already contains all sorts of utility classes,
>   but o.a.f.layoutmgr would also make sense. WDYT?

Whatever.

> - it would be better to create the testcases such that the rendering
>   will become wrong if the feature is broken. For example, put the block
>   at the bottom of the page, such that it gets deferred to the next page
>   if keep is working, and split over 2 pages if keep is broken. Exactly
>   like you did in block_keep-together_integers_1.xml.
>   There are 2 reasons for this:
>   - just because the element list looks ok doesn’t ensure that the
>     rendering will be fine. Actually a recent post on fop-users [1]
>     shows that.

We've had the other case, too: Rendering looked fine but the element
list was wrong and lead to bad break decisions. I'm not sure if your
example is a good one.

>   - if the generation of Knuth elements is changed somehow, all the
>     testcases must be adapted accordingly. I had to do that several
>     times when working on tables in the past months, and this is really
>     painful. Tests on Knuth elements should be reserved for special
>     situations IMO.

I'm doing unit testing here, or at least as "unit" testing as possible.
What you're talking about is component testing and larger. I want to
make sure that the element list is correct and I trust that the breaking
algorithm does the right thing because it is already tested elsewhere. I
completely disagree that element list test should be reserved for
special situations. Or else this is exactly such a special situation for
me.

> [1] http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-users/200804.mbox/%3c61ed064e0804172036h3e712d5co1b0bce5fdb9f1fbb@mail.gmail.com%3e
> 
> Thanks,
> Vincent
> 
> 
> > Author: jeremias
> > Date: Tue Apr 15 12:18:46 2008
> > New Revision: 648381
> >
> > URL: http://svn.apache.org/viewvc?rev=648381&view=rev
> > Log:
> > First part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-together.within-column for all block-level FOs.
> 
> <split/>
> 
> -- 
> Vincent Hennebert                            Anyware Technologies
> http://people.apache.org/~vhennebert         http://www.anyware-tech.com
> Apache FOP Committer                         FOP Development/Consulting




Jeremias Maerki


Re: svn commit: r648381 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ src/java/org/apache/fop/layoutmgr/list/ src/java/org/apache/fop/layoutmgr/table/ tes...

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi,

A few comments:

- some time ago I created a BreakUtil class in the o.a.f.util package.
  I think this class and KeepUtil should be put in the same place.
  Perhaps we could even merge them into a unique KeepsAndBreaksUtil
  class. I don’t really know what the best place would be. I put it in
  o.a.f.util because it already contains all sorts of utility classes,
  but o.a.f.layoutmgr would also make sense. WDYT?

- it would be better to create the testcases such that the rendering
  will become wrong if the feature is broken. For example, put the block
  at the bottom of the page, such that it gets deferred to the next page
  if keep is working, and split over 2 pages if keep is broken. Exactly
  like you did in block_keep-together_integers_1.xml.
  There are 2 reasons for this:
  - just because the element list looks ok doesn’t ensure that the
    rendering will be fine. Actually a recent post on fop-users [1]
    shows that.
  - if the generation of Knuth elements is changed somehow, all the
    testcases must be adapted accordingly. I had to do that several
    times when working on tables in the past months, and this is really
    painful. Tests on Knuth elements should be reserved for special
    situations IMO.

[1] http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-users/200804.mbox/%3c61ed064e0804172036h3e712d5co1b0bce5fdb9f1fbb@mail.gmail.com%3e

Thanks,
Vincent


> Author: jeremias
> Date: Tue Apr 15 12:18:46 2008
> New Revision: 648381
>
> URL: http://svn.apache.org/viewvc?rev=648381&view=rev
> Log:
> First part of the implementation of stage 1 for advanced keeps (see Wiki): Integer values are treated differently from "always" values in keep-together.within-column for all block-level FOs.

<split/>

-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting