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 vh...@apache.org on 2008/08/16 23:02:34 UTC

svn commit: r686561 [2/2] - in /xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype: ./ breaking/ breaking/layout/ fo/ font/ knuth/ layoutmgr/

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/KnuthElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/KnuthElement.java?rev=686561&r1=686560&r2=686561&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/KnuthElement.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/KnuthElement.java Sat Aug 16 14:02:24 2008
@@ -5,9 +5,9 @@
  * 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.

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/LineBox.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/LineBox.java?rev=686561&r1=686560&r2=686561&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/LineBox.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/LineBox.java Sat Aug 16 14:02:24 2008
@@ -5,9 +5,9 @@
  * 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.

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/Penalty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/Penalty.java?rev=686561&r1=686560&r2=686561&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/Penalty.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/knuth/Penalty.java Sat Aug 16 14:02:24 2008
@@ -5,9 +5,9 @@
  * 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.
@@ -24,7 +24,7 @@
  */
 public class Penalty extends KnuthElement {
 
-    public static final Penalty DEFAULT_PENALTY = new Penalty(0, 0); 
+    public static final Penalty DEFAULT_PENALTY = new Penalty(0, 0);
 
     public static final int INFINITE = 1000;
 
@@ -40,7 +40,7 @@
     }
 
     public boolean isForcedBreak() {
-        return penalty == -INFINITE; 
+        return penalty == -INFINITE;
     }
 
     /** {@inheritDoc} */

Added: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/AbstractLayoutManager.java?rev=686561&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/AbstractLayoutManager.java (added)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/AbstractLayoutManager.java Sat Aug 16 14:02:24 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.prototype.layoutmgr;
+
+import org.apache.fop.prototype.breaking.ActiveLayouts;
+import org.apache.fop.prototype.breaking.layout.Layout;
+
+/**
+ * TODO javadoc
+ */
+abstract class AbstractLayoutManager<L extends Layout> {
+
+    protected NonLeafLayoutManager<Layout> parent;
+
+    protected ActiveLayouts<L> layouts;
+
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/AbstractLayoutManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/AbstractLayoutManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/BlockLayoutManager.java?rev=686561&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/BlockLayoutManager.java (added)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/BlockLayoutManager.java Sat Aug 16 14:02:24 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.prototype.layoutmgr;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.fop.prototype.breaking.ActiveLayouts;
+import org.apache.fop.prototype.breaking.CompletedPart;
+import org.apache.fop.prototype.breaking.KnuthIterator;
+import org.apache.fop.prototype.breaking.LegalBreakHandler;
+import org.apache.fop.prototype.breaking.layout.Layout;
+import org.apache.fop.prototype.knuth.KnuthElement;
+
+/**
+ * TODO javadoc
+ */
+public class BlockLayoutManager extends AbstractLayoutManager<Layout> implements
+        LayoutManager<Layout> {
+
+    KnuthIterator<Layout> knuthIterator;
+
+    public BlockLayoutManager(KnuthElement... content) {
+        knuthIterator = new KnuthIterator<Layout>(Arrays.asList(content),
+                new LegalBreakHandler<Layout>());
+    }
+
+    @Override
+    public void initialize(NonLeafLayoutManager<Layout> parent, ActiveLayouts<Layout> previousLayouts) {
+        this.parent = parent;
+        this.layouts = previousLayouts;
+        knuthIterator.initialize(previousLayouts);
+    }
+
+    @Override
+    public boolean hasNext() {
+        return knuthIterator.hasNext();
+    }
+
+    @Override
+    public void next() {
+        Collection<CompletedPart> parts = knuthIterator.next();
+        if (parts != null) {
+            for (CompletedPart part: parts) {
+                Layout newLayout = parent.partCompleted(part);
+                layouts.add(newLayout);
+            }
+        }
+    }
+
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/BlockLayoutManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/BlockLayoutManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/DefaultLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/DefaultLayoutManager.java?rev=686561&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/DefaultLayoutManager.java (added)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/DefaultLayoutManager.java Sat Aug 16 14:02:24 2008
@@ -0,0 +1,81 @@
+/*
+ * 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.prototype.layoutmgr;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.fop.prototype.breaking.ActiveLayouts;
+import org.apache.fop.prototype.breaking.CompletedPart;
+import org.apache.fop.prototype.breaking.layout.Layout;
+
+/**
+ * TODO javadoc
+ */
+public class DefaultLayoutManager extends AbstractLayoutManager<Layout> implements
+        NonLeafLayoutManager<Layout> {
+
+    Iterator<LayoutManager<Layout>> childLMIter;
+
+    LayoutManager<Layout> currentChildLM;
+
+    protected DefaultLayoutManager() { }
+
+    /**
+     * @param childLMs
+     */
+    public DefaultLayoutManager(List<LayoutManager<Layout>> childLMs) {
+        childLMIter = childLMs.iterator();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void initialize(NonLeafLayoutManager<Layout> parent, ActiveLayouts<Layout> previousLayouts) {
+        this.parent = parent;
+        this.layouts = previousLayouts;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean hasNext() {
+        if (currentChildLM != null && currentChildLM.hasNext()) {
+            return true;
+        } else if (!childLMIter.hasNext()) {
+            return false;
+        } else {
+            currentChildLM = childLMIter.next();
+            currentChildLM.initialize(this, layouts);
+            return true;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void next() {
+        assert hasNext();
+        currentChildLM.next();
+    }
+
+    @Override
+    public Layout partCompleted(CompletedPart part) {
+        return parent.partCompleted(part);
+    }
+
+}
\ No newline at end of file

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/DefaultLayoutManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/DefaultLayoutManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/Dimensions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/Dimensions.java?rev=686561&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/Dimensions.java (added)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/Dimensions.java Sat Aug 16 14:02:24 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.prototype.layoutmgr;
+
+/**
+ * TODO javadoc
+ */
+public interface Dimensions {
+
+    int getBPD(int partNumber);
+
+    int getIPD(int partNumber, int bpd);
+
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/Dimensions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/Dimensions.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/LayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/LayoutManager.java?rev=686561&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/LayoutManager.java (added)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/LayoutManager.java Sat Aug 16 14:02:24 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.prototype.layoutmgr;
+
+
+import org.apache.fop.prototype.breaking.ActiveLayouts;
+import org.apache.fop.prototype.breaking.layout.Layout;
+
+/**
+ * TODO javadoc
+ */
+public interface LayoutManager<L extends Layout> {
+
+    void initialize(NonLeafLayoutManager<Layout> parent, ActiveLayouts<Layout> previousLayouts);
+
+    boolean hasNext();
+
+    void next();
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/LayoutManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/LayoutManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/NonLeafLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/NonLeafLayoutManager.java?rev=686561&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/NonLeafLayoutManager.java (added)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/NonLeafLayoutManager.java Sat Aug 16 14:02:24 2008
@@ -0,0 +1,32 @@
+/*
+ * 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.prototype.layoutmgr;
+
+import org.apache.fop.prototype.breaking.CompletedPart;
+import org.apache.fop.prototype.breaking.layout.Layout;
+
+/**
+ * TODO javadoc
+ */
+public interface NonLeafLayoutManager<L extends Layout> extends LayoutManager<L> {
+
+    Layout partCompleted(CompletedPart part);
+
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/NonLeafLayoutManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/NonLeafLayoutManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/PageLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/PageLayoutManager.java?rev=686561&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/PageLayoutManager.java (added)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/PageLayoutManager.java Sat Aug 16 14:02:24 2008
@@ -0,0 +1,82 @@
+/*
+ * 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.prototype.layoutmgr;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.fop.prototype.Dot;
+import org.apache.fop.prototype.breaking.ActiveLayouts;
+import org.apache.fop.prototype.breaking.Alternative;
+import org.apache.fop.prototype.breaking.CompletedPart;
+import org.apache.fop.prototype.breaking.PageDimensions;
+import org.apache.fop.prototype.breaking.layout.BlockLayout;
+import org.apache.fop.prototype.breaking.layout.Layout;
+
+/**
+ * TODO javadoc
+ */
+public class PageLayoutManager extends DefaultLayoutManager {
+
+    private List<PageDimensions> pageDims;
+
+    /**
+     * @param childLMs
+     */
+    public PageLayoutManager(List<LayoutManager<Layout>> childLMs, final List<PageDimensions> pageDims) {
+        super(childLMs);
+        this.pageDims = pageDims;
+        ActiveLayouts<Layout> layouts = new ActiveLayouts<Layout>();
+        layouts.add(new BlockLayout(pageDims.get(0)));
+        initialize(this, layouts);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public Layout partCompleted(CompletedPart part) {
+        Collection<Alternative> alts = part.getAlternatives();
+        List<Alternative> alternatives = null;
+        if (alts != null) { // TODO should this ever happen?
+            alternatives = new ArrayList<Alternative>(alts.size());
+            for (Alternative a: alts) {
+                alternatives.add(new Alternative(a.getLayout().getPrevious(), a.getDemerits()));
+            }
+        }
+        Layout previous = part.getLayout().clone(alternatives);
+        previous.setPage();
+        previous.setDemerits(part.getDemerits());
+        int partNumber = previous.getProgress().getPartNumber() + 1;
+        Layout newLayout = new BlockLayout(previous, partNumber, pageDims.get(partNumber));
+        return newLayout;
+    }
+
+    public void findBreaks() {
+        while (hasNext()) {
+            next();
+        }
+        try {
+            Dot.createGraph(layouts);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/PageLayoutManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/PageLayoutManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/ParagraphLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/ParagraphLayoutManager.java?rev=686561&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/ParagraphLayoutManager.java (added)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/ParagraphLayoutManager.java Sat Aug 16 14:02:24 2008
@@ -0,0 +1,129 @@
+/*
+ * 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.prototype.layoutmgr;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.fop.prototype.Log;
+import org.apache.fop.prototype.breaking.ActiveLayouts;
+import org.apache.fop.prototype.breaking.Alternative;
+import org.apache.fop.prototype.breaking.CompletedPart;
+import org.apache.fop.prototype.breaking.KnuthIterator;
+import org.apache.fop.prototype.breaking.LegalBreakHandler;
+import org.apache.fop.prototype.breaking.layout.Layout;
+import org.apache.fop.prototype.breaking.layout.LineLayout;
+import org.apache.fop.prototype.fo.Paragraph;
+import org.apache.fop.prototype.font.Font;
+import org.apache.fop.prototype.knuth.KnuthElement;
+import org.apache.fop.prototype.knuth.LineBox;
+import org.apache.fop.prototype.knuth.Penalty;
+
+/**
+ * TODO javadoc
+ */
+public class ParagraphLayoutManager extends AbstractLayoutManager<Layout> implements
+        LayoutManager<Layout> {
+
+    private KnuthIterator<LineLayout> lineIterator;
+
+    private ActiveLayouts<LineLayout> lineLayouts;
+
+    private ActiveLayouts<Layout> newLayouts;
+
+    private LegalBreakHandler<Layout> blockLevelBreakHandler;
+
+    private boolean finalized;
+
+    public ParagraphLayoutManager(Paragraph paragraph) {
+        lineIterator = new KnuthIterator<LineLayout>(paragraph.getKnuthElements(),
+                new LegalBreakHandler<LineLayout>(7.6));
+        blockLevelBreakHandler = new LegalBreakHandler<Layout>();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void initialize(NonLeafLayoutManager<Layout> parent, ActiveLayouts<Layout> previousLayouts) {
+        this.parent = parent;
+        this.layouts = previousLayouts;
+        lineLayouts = new ActiveLayouts<LineLayout>();
+        for (Layout l: previousLayouts) {
+            lineLayouts.add(new LineLayout(l));
+        }
+        lineIterator.initialize(lineLayouts);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean hasNext() {
+        if (lineIterator.hasNext()) {
+            return true;
+        } else if (!finalized) {
+            finalized = true;
+            layouts.clear();
+            for (LineLayout l: lineLayouts) {
+                layouts.add(l.getBlockLayout());
+            }
+        }
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void next() {
+        Collection<CompletedPart> lines;
+        do {
+            lines = lineIterator.next();
+        } while (lines.isEmpty());
+        newLayouts = new ActiveLayouts<Layout>();
+        for (CompletedPart line: lines) {
+            LineLayout completedLayout = (LineLayout) line.getLayout(); // TODO cast
+            Log.LOG.info("completed line:\n" + completedLayout);
+            List<KnuthElement> elements = new ArrayList<KnuthElement>(completedLayout.getElements());
+            LineBox lineBox = new LineBox(1000/* TODO line bpd */, elements, line.getDifference(),
+                    Font.TIMES_FONT.getCharWidth(' ')/* TODO */);
+            List<Alternative> alternatives = new ArrayList<Alternative>(line.getAlternatives().size());
+            for (Alternative a: line.getAlternatives()) {
+                alternatives.add(new Alternative(((LineLayout) a.getLayout()).getBlockLayout(),
+                        a.getDemerits()));
+            }
+            Layout newBlockLayout = completedLayout.getBlockLayout().clone(alternatives);
+            newBlockLayout.setPrevious(completedLayout.getBlockLayout());
+            newBlockLayout.setDemerits(line.getDemerits());
+            newBlockLayout.addElement(lineBox);
+            newLayouts.add(newBlockLayout);
+        }
+        // Don't try to break if the end of the paragraph has been reached
+        if (lineIterator.hasNext()) {
+            Collection<CompletedPart> blocks = blockLevelBreakHandler.considerBreak(
+                    Penalty.DEFAULT_PENALTY, newLayouts);
+            for (CompletedPart block: blocks) {
+                Layout newBlockLayout = parent.partCompleted(block);
+                LineLayout newLineLayout = new LineLayout(newBlockLayout);
+                lineLayouts.add(newLineLayout);
+            }
+        }
+        for (Layout blockLayout: newLayouts) {
+            lineLayouts.add(new LineLayout(blockLayout)); // TODO line number
+        }
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/ParagraphLayoutManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/prototype/java/src/org/apache/fop/prototype/layoutmgr/ParagraphLayoutManager.java
------------------------------------------------------------------------------
    svn:keywords = Id



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