]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Integrate layout managers for text and block
authorKaren Lease <klease@apache.org>
Sun, 11 Nov 2001 14:15:10 +0000 (14:15 +0000)
committerKaren Lease <klease@apache.org>
Sun, 11 Nov 2001 14:15:10 +0000 (14:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194558 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/FOText.java
src/org/apache/fop/fo/FObj.java
src/org/apache/fop/fo/flow/Block.java
src/org/apache/fop/fo/pagination/PageSequence.java

index b0ebd2b4bc12295bbbc6c077f2822845d1b23c18..8c02cc07ef9516c0928d0178e7899b1babe5ed17 100644 (file)
@@ -16,6 +16,8 @@ import org.apache.fop.datatypes.*;
 import org.apache.fop.fo.properties.*;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.system.BufferManager;
+import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.TextLayoutManager;
 
 /**
  * a text node in the formatting object tree
@@ -234,5 +236,8 @@ public class FOText extends FObj {
         return -1;
     }
 
+    public LayoutManager getLayoutManager() {
+       return new TextLayoutManager(this, ca);
+    }
 }
 
index dc74a8a01ec175a7185412886cadffe3be9d6408..f4b6b52e641704d8b36d51dca919c56731a78253 100644 (file)
@@ -25,6 +25,7 @@ import java.util.Iterator;
 import org.xml.sax.Attributes;
 
 import java.util.Iterator;
+import java.util.ListIterator;
 import java.util.Vector;
 import java.util.Hashtable;
 
@@ -199,8 +200,8 @@ public class FObj extends FONode {
     }
 
     
-    public Iterator getChildren() {
-       return children.iterator();
+    public ListIterator getChildren() {
+       return children.listIterator();
     }
 
     public void setIsInTableCell() {
index cb8335c4c08f08cf39278d2f3eafcc2f26847e54..f548b9e1c93b447c2ccd841359d39d18437017c8 100644 (file)
@@ -14,7 +14,7 @@ import org.apache.fop.layout.*;
 import org.apache.fop.datatypes.*;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.layoutmgr.LayoutManager;
-//import org.apache.fop.layoutmgr.BlockLayoutManager;
+import org.apache.fop.layoutmgr.BlockLayoutManager;
 
 import org.xml.sax.Attributes;
 
@@ -353,8 +353,7 @@ public class Block extends FObjMixed {
     }
 
     public LayoutManager getLayoutManager() {
-       //return new BlockLayoutManager(this);
-       return null;
+       return new BlockLayoutManager(this);
     }
 
 }
index 389be2c649e51aff89e98d3a8b9f1076e852c78d..da1e22883a306dafc07ca8fb26f418f22b0db1d6 100644 (file)
@@ -242,6 +242,7 @@ public class PageSequence extends FObj {
                else {
                    this.mainFlow = (Flow)child;
                    addFlow(mainFlow);
+                   super.addChild(child); // For getChildren
                }
            } 
            else if (childName.equals("fo:static-content")) {
@@ -267,7 +268,10 @@ public class PageSequence extends FObj {
 
     public void end() {
        try {
-           format(null);
+           AreaTree at = new AreaTree();
+           at.setTreeModel(AreaTree.createStorePagesModel());
+           at.startPageSequence(null);
+           format(at);
        } catch (FOPException fopex) {
            log.error("Error in PageSequence.end(): " +
                      fopex.getMessage());
@@ -277,27 +281,27 @@ public class PageSequence extends FObj {
 
 
 
-    /**
-     * Return children for layout. Only the main flow is laid out directly.
-     */
-    public Iterator getChildren() {
-       return new Iterator() {
-               boolean bFirst=true;
-               public boolean hasNext() {
-                   return (bFirst==true && mainFlow != null);
-               }
-               public Object next() {
-                   if (bFirst==true && mainFlow != null) {
-                       bFirst=false;
-                       return mainFlow;
-                   }
-                   else throw new NoSuchElementException();
-               }
-               public void remove() {
-                   throw new UnsupportedOperationException();
-               }
-           };
-    }
+//     /**
+//      * Return children for layout. Only the main flow is laid out directly.
+//      */
+//     public ListIterator getChildren() {
+//     return new ListIterator() {
+//             boolean bFirst=true;
+//             public boolean hasNext() {
+//                 return (bFirst==true && mainFlow != null);
+//             }
+//             public Object next() {
+//                 if (bFirst==true && mainFlow != null) {
+//                     bFirst=false;
+//                     return mainFlow;
+//                 }
+//                 else throw new NoSuchElementException();
+//             }
+//             public void remove() {
+//                 throw new UnsupportedOperationException();
+//             }
+//         };
+//     }
 
     /**
      * Runs the formatting of this page sequence into the given area tree