xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adelme...@apache.org
Subject svn commit: r1067681 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
Date Sun, 06 Feb 2011 15:15:12 GMT
Author: adelmelle
Date: Sun Feb  6 15:15:10 2011
New Revision: 1067681

URL: http://svn.apache.org/viewvc?rev=1067681&view=rev
Log:
Minor fixups

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java

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=1067681&r1=1067680&r2=1067681&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
Sun Feb  6 15:15:10 2011
@@ -875,7 +875,7 @@ public class LineLayoutManager extends I
      */
     private List postProcessLineBreaks(int alignment, LayoutContext context) {
 
-        List returnList = new LinkedList();
+        List<ListElement> returnList = new LinkedList<ListElement>();
 
         int endIndex = -1;
         for (int p = 0; p < knuthParagraphs.size(); p++) {
@@ -893,7 +893,7 @@ public class LineLayoutManager extends I
             KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(p);
 
             if (!seq.isInlineSequence()) {
-                List targetList = new LinkedList();
+                List<ListElement> targetList = new LinkedList<ListElement>();
                 ListIterator listIter = seq.listIterator();
                 while (listIter.hasNext()) {
                     ListElement tempElement;
@@ -933,10 +933,10 @@ public class LineLayoutManager extends I
                     endIndex = ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos();
                     // create a list of the FootnoteBodyLM handling footnotes
                     // whose citations are in this line
-                    List footnoteList = new LinkedList();
-                    ListIterator elementIterator = seq.listIterator(startIndex);
+                    List<LayoutManager> footnoteList = new LinkedList<LayoutManager>();
+                    ListIterator<KnuthElement> elementIterator = seq.listIterator(startIndex);
                     while (elementIterator.nextIndex() <= endIndex) {
-                        KnuthElement element = (KnuthElement) elementIterator.next();
+                        KnuthElement element = elementIterator.next();
                         if (element instanceof KnuthInlineBox
                                 && ((KnuthInlineBox) element).isAnchor()) {
                             footnoteList.add(((KnuthInlineBox) element).getFootnoteBodyLM());
@@ -949,15 +949,6 @@ public class LineLayoutManager extends I
                     returnList.add(new KnuthBlockBox
                                    (lbp.lineHeight + lbp.spaceBefore + lbp.spaceAfter,
                                     footnoteList, lbp, false));
-                    /* // add stretch and shrink to the returnlist
-                    if (!seq.isInlineSequence()
-                            && lbp.availableStretch != 0 || lbp.availableShrink !=
0) {
-                        returnList.add(new KnuthPenalty(0, -KnuthElement.INFINITE,
-                                false, new Position(this), false));
-                        returnList.add(new KnuthGlue(0, lbp.availableStretch, lbp.availableShrink,
-                                new Position(this), false));
-                    }
-                    */
                 }
             }
         }
@@ -965,7 +956,7 @@ public class LineLayoutManager extends I
         return returnList;
     }
 
-    private void createElements(List list, LineLayoutPossibilities llPoss,
+    private void createElements(List<ListElement> list, LineLayoutPossibilities llPoss,
                                 Position elementPosition) {
         /* number of normal, inner lines */
         int innerLines = 0;
@@ -984,36 +975,27 @@ public class LineLayoutManager extends I
         /* number of the last unbreakable lines */
         int lastLines = fobj.getWidows();
         /* sub-sequence used to separate the elements representing different lines */
-        List breaker = new LinkedList();
+        List<KnuthElement> breaker = new LinkedList<KnuthElement>();
 
         /* comment out the next lines in order to test particular situations */
         if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getMinLineCount()) {
-            innerLines = llPoss.getMinLineCount()
-                          - (fobj.getOrphans() + fobj.getWidows());
-            optionalLines = llPoss.getMaxLineCount()
-                             - llPoss.getOptLineCount();
-            eliminableLines = llPoss.getOptLineCount()
-                               - llPoss.getMinLineCount();
+            innerLines = llPoss.getMinLineCount() - (fobj.getOrphans() + fobj.getWidows());
+            optionalLines = llPoss.getMaxLineCount()- llPoss.getOptLineCount();
+            eliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount();
         } else if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getOptLineCount()) {
-            optionalLines = llPoss.getMaxLineCount()
-                             - llPoss.getOptLineCount();
-            eliminableLines = llPoss.getOptLineCount()
-                               - (fobj.getOrphans() + fobj.getWidows());
-            conditionalEliminableLines = (fobj.getOrphans() + fobj.getWidows())
-                                          - llPoss.getMinLineCount();
+            optionalLines = llPoss.getMaxLineCount() - llPoss.getOptLineCount();
+            eliminableLines = llPoss.getOptLineCount() - (fobj.getOrphans() + fobj.getWidows());
+            conditionalEliminableLines
+                    = (fobj.getOrphans() + fobj.getWidows()) - llPoss.getMinLineCount();
         } else if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getMaxLineCount()) {
-            optionalLines = llPoss.getMaxLineCount()
-                             - (fobj.getOrphans() + fobj.getWidows());
-            conditionalOptionalLines = (fobj.getOrphans() + fobj.getWidows())
-                                        - llPoss.getOptLineCount();
-            conditionalEliminableLines = llPoss.getOptLineCount()
-                                          - llPoss.getMinLineCount();
+            optionalLines = llPoss.getMaxLineCount() - (fobj.getOrphans() + fobj.getWidows());
+            conditionalOptionalLines
+                    = (fobj.getOrphans() + fobj.getWidows()) - llPoss.getOptLineCount();
+            conditionalEliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount();
             firstLines -= conditionalOptionalLines;
         } else {
-            conditionalOptionalLines = llPoss.getMaxLineCount()
-                                        - llPoss.getOptLineCount();
-            conditionalEliminableLines = llPoss.getOptLineCount()
-                                          - llPoss.getMinLineCount();
+            conditionalOptionalLines = llPoss.getMaxLineCount() - llPoss.getOptLineCount();
+            conditionalEliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount();
             firstLines = llPoss.getOptLineCount();
             lastLines = 0;
         }
@@ -1044,12 +1026,6 @@ public class LineLayoutManager extends I
             breaker.add(new KnuthPenalty(0, 0, false, elementPosition, false));
         }
 
-        //log.debug("first=" + firstLines + " inner=" + innerLines
-        //                   + " optional=" + optionalLines + " eliminable=" + eliminableLines
-        //                   + " last=" + lastLines
-        //                   + " (condOpt=" + conditionalOptionalLines
-        //                   + " condEl=" + conditionalEliminableLines + ")");
-
         // creation of the elements:
         // first group of lines
         list.add(new KnuthBox(firstLines * constantLineHeight, elementPosition,



---------------------------------------------------------------------
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