xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vhenneb...@apache.org
Subject svn commit: r603943 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr: ElementListUtils.java table/TableContentLayoutManager.java
Date Thu, 13 Dec 2007 15:55:34 GMT
Author: vhennebert
Date: Thu Dec 13 07:55:29 2007
New Revision: 603943

URL: http://svn.apache.org/viewvc?rev=603943&view=rev
Log:
Removed calls to removeLegalBreaks since they aren't necessary (the whole content is put in
a single box anyway) and the method is buggy.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java

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=603943&r1=603942&r2=603943&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 Thu Dec
13 07:55:29 2007
@@ -31,31 +31,6 @@
 public class ElementListUtils {
 
     /**
-     * Removes all legal breaks in an element list.
-     * @param elements the element list
-     */
-    public static void removeLegalBreaks(LinkedList elements) {
-        ListIterator i = elements.listIterator();
-        while (i.hasNext()) {
-            ListElement el = (ListElement)i.next();
-            if (el.isPenalty()) {
-                BreakElement breakPoss = (BreakElement)el;
-                //Convert all penalties no break inhibitors
-                if (breakPoss.getPenaltyValue() < KnuthPenalty.INFINITE) {
-                    breakPoss.setPenaltyValue(KnuthPenalty.INFINITE);
-                }
-            } else if (el.isGlue()) {
-                i.previous();
-                if (el.isBox()) {
-                    i.next();
-                    i.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, 
-                            null, false));
-                }
-            }
-        }
-    }
-    
-    /**
      * Removes legal breaks in an element list. A constraint can be specified to limit the
      * range in which the breaks are removed. Legal breaks occuring before at least 
      * constraint.opt space is filled will be removed.
@@ -66,7 +41,7 @@
     public static boolean removeLegalBreaks(LinkedList elements, MinOptMax constraint) {
         return removeLegalBreaks(elements, constraint.opt);
     }
-    
+
     /**
      * Removes legal breaks in an element list. A constraint can be specified to limit the
      * range in which the breaks are removed. Legal breaks occuring before at least 
@@ -84,7 +59,7 @@
                 KnuthPenalty penalty = (KnuthPenalty)el;
                 //Convert all penalties to break inhibitors
                 if (penalty.getP() < KnuthPenalty.INFINITE) {
-                    iter.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE, 
+                    iter.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE,
                             penalty.isFlagged(), penalty.getPosition(), penalty.isAuxiliary()));
                 }
             } else if (el.isGlue()) {
@@ -94,7 +69,7 @@
                 el = (ListElement)iter.previous();
                 iter.next();
                 if (el.isBox()) {
-                    iter.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, 
+                    iter.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false,
                             null, false));
                 }
                 iter.next();
@@ -131,7 +106,7 @@
                 KnuthPenalty penalty = (KnuthPenalty)el;
                 //Convert all penalties to break inhibitors
                 if (penalty.getP() < KnuthPenalty.INFINITE) {
-                    i.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE, 
+                    i.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE,
                             penalty.isFlagged(), penalty.getPosition(), penalty.isAuxiliary()));
                 }
             } else if (el.isGlue()) {
@@ -140,7 +115,7 @@
                 el = (ListElement)i.previous();
                 i.next();
                 if (el.isBox()) {
-                    i.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, 
+                    i.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false,
                             null, false));
                 }
             } else if (el.isUnresolvedElement()) {
@@ -163,7 +138,7 @@
         }
         return true;
     }
-    
+
     /**
      * Calculates the content length of the given element list. Warning: It doesn't take
any
      * stretch and shrink possibilities into account.
@@ -193,7 +168,7 @@
         }
         return len;
     }
-    
+
     /**
      * Calculates the content length of the given element list. Warning: It doesn't take
any
      * stretch and shrink possibilities into account.
@@ -203,7 +178,7 @@
     public static int calcContentLength(List elems) {
         return calcContentLength(elems, 0, elems.size() - 1);
     }
-    
+
     /**
      * Indicates whether the given element list ends with a forced break.
      * @param elems the element list
@@ -213,7 +188,7 @@
         ListElement last = (ListElement)elems.getLast();
         return last.isForcedBreak();
     }
-    
+
     /**
      * Determines the position of the previous break before the start index on an
      * element list.
@@ -232,5 +207,5 @@
         }
         return prevBreak;
     }
-    
+
 }

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=603943&r1=603942&r2=603943&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
Thu Dec 13 07:55:29 2007
@@ -136,7 +136,6 @@
         if (headerIter != null && headerList == null) {
             this.headerList = getKnuthElementsForRowIterator(
                     headerIter, context, alignment, TableRowIterator.HEADER);
-            ElementListUtils.removeLegalBreaks(this.headerList);
             this.headerNetHeight
                     = ElementListUtils.calcContentLength(this.headerList);
             if (log.isDebugEnabled()) {
@@ -157,7 +156,6 @@
         if (footerIter != null && footerList == null) {
             this.footerList = getKnuthElementsForRowIterator(
                     footerIter, context, alignment, TableRowIterator.FOOTER);
-            ElementListUtils.removeLegalBreaks(this.footerList);
             this.footerNetHeight
                     = ElementListUtils.calcContentLength(this.footerList);
             if (log.isDebugEnabled()) {



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


Mime
View raw message