xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acumis...@apache.org
Subject svn commit: r674497 [6/11] - in /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign: ./ lib/ lib/build/ src/codegen/unicode/data/ src/codegen/unicode/java/org/apache/fop/text/linebreak/ src/documentation/ src/documentation/content/xdocs/ src/documentation...
Date Mon, 07 Jul 2008 14:09:10 GMT
Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -21,7 +21,7 @@
 
 import java.awt.Dimension;
 import java.awt.Rectangle;
-import java.util.LinkedList;
+import java.util.List;
 
 import org.apache.fop.area.Area;
 import org.apache.fop.area.inline.Viewport;
@@ -39,16 +39,14 @@
  */
 public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManager {
     
-    /** The graphics object this LM deals with */
-    protected AbstractGraphics fobj;
-    
     /**
-     * Constructor
-     * @param node the formatting object that creates this area
+     * Constructor.
+     * 
+     * @param node
+     *            the formatting object that creates this area
      */
     public AbstractGraphicsLayoutManager(AbstractGraphics node) {
         super(node);
-        fobj = node;
     }
 
     /**
@@ -57,6 +55,7 @@
      * @return the viewport inline area
      */
     private Viewport getInlineArea() {
+        final AbstractGraphics fobj = (AbstractGraphics)this.fobj;
         Dimension intrinsicSize = new Dimension(
                 fobj.getIntrinsicWidth(),
                 fobj.getIntrinsicHeight());
@@ -104,7 +103,7 @@
     }
     
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context,
+    public List getNextKnuthElements(LayoutContext context,
                                            int alignment) {
         Viewport areaCurrent = getInlineArea();
         setCurrentArea(areaCurrent);
@@ -113,6 +112,7 @@
     
     /** {@inheritDoc} */
     protected AlignmentContext makeAlignmentContext(LayoutContext context) {
+        final AbstractGraphics fobj = (AbstractGraphics)this.fobj;
         return new AlignmentContext(
                 get(context).getAllocBPD()
                 , fobj.getAlignmentAdjust()
@@ -128,7 +128,7 @@
      * the viewport.
      * @return the appropriate area
      */
-    abstract Area getChildArea();
+    protected abstract Area getChildArea();
     
     // --------- Property Resolution related functions --------- //
     
@@ -138,31 +138,14 @@
     public int getBaseLength(int lengthBase, FObj fobj) {
         switch (lengthBase) {
         case LengthBase.IMAGE_INTRINSIC_WIDTH:
-            return getIntrinsicWidth();
+            return ((AbstractGraphics)fobj).getIntrinsicWidth();
         case LengthBase.IMAGE_INTRINSIC_HEIGHT:
-            return getIntrinsicHeight();
+            return ((AbstractGraphics)fobj).getIntrinsicHeight();
         case LengthBase.ALIGNMENT_ADJUST:
             return get(null).getBPD();
         default: // Delegate to super class
             return super.getBaseLength(lengthBase, fobj);
         }
     }
-
-    /**
-     * Returns the intrinsic width of the e-g.
-     * @return the width of the element
-     */
-    protected int getIntrinsicWidth() {
-        return fobj.getIntrinsicWidth();
-    }
-
-    /**
-     * Returns the intrinsic height of the e-g.
-     * @return the height of the element
-     */
-    protected int getIntrinsicHeight() {
-        return fobj.getIntrinsicHeight();
-    }
-
 }
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -26,8 +26,7 @@
 import org.apache.fop.fo.flow.Character;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.fonts.Font;
-import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.fonts.FontTriplet;
+import org.apache.fop.fonts.FontSelector;
 import org.apache.fop.layoutmgr.InlineKnuthSequence;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthGlue;
@@ -62,7 +61,7 @@
     /** {@inheritDoc} */
     public void initialize() {
         Character fobj = (Character)this.fobj;        
-        font = this.selectFontForCharacter(fobj);
+        font = FontSelector.selectFontForCharacter(fobj, this);
         SpaceVal ls = SpaceVal.makeLetterSpacing(fobj.getLetterSpacing());
         letterSpaceIPD = ls.getSpace();
         hyphIPD = fobj.getCommonHyphenation().getHyphIPD(font);
@@ -72,33 +71,6 @@
         chArea.setBaselineOffset(font.getAscender());
         setCurrentArea(chArea);
     }
-    
-    /**
-     * Selects a font which is able to display the given character.
-     * <p>
-     * Please note: this implements the font-selection-strategy
-     * character-by-character.
-     * <p>
-     * TODO: The same function could apply to other elements as well.
-     * 
-     * @param fobj
-     *            a Character object containing the character and its
-     *            attributed.
-     * @return a Font object.
-     */
-    private Font selectFontForCharacter(Character fobj) {
-        FontInfo fi = fobj.getFOEventHandler().getFontInfo();
-        FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi);
-        for (int i = 0; i < fontkeys.length; i++) {
-            font = fi.getFontInstance(fontkeys[i],
-                    fobj.getCommonFont().fontSize.getValue(this));
-            if (font.hasChar(fobj.getCharacter())) {
-                return font;
-            }
-        }
-        return fi.getFontInstance(fontkeys[0],
-                fobj.getCommonFont().fontSize.getValue(this));
-    }
 
     private org.apache.fop.area.inline.TextArea getCharacterInlineArea(Character node) {
         org.apache.fop.area.inline.TextArea text
@@ -118,7 +90,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
         MinOptMax ipd;
         curArea = get(context);
         KnuthSequence seq = new InlineKnuthSequence();
@@ -207,7 +179,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+    public List getChangedKnuthElements(List oldList, int alignment) {
         if (isFinished()) {
             return null;
         }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -27,8 +27,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.LineArea;
@@ -131,7 +129,7 @@
 
         stackSize = 0;
 
-        LinkedList contentList =
+        List contentList =
             getNextKnuthElements(childLC, Constants.EN_START);
         ListIterator contentIter = contentList.listIterator();
         while (contentIter.hasNext()) {
@@ -254,9 +252,9 @@
         }
     }
 
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
-        LinkedList contentList = new LinkedList();
-        LinkedList returnedList;
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
+        List contentList = new LinkedList();
+        List returnedList;
 
         childLM.initialize();
         while (!childLM.isFinished()) {
@@ -267,7 +265,7 @@
                 // move elements to contentList, and accumulate their size
                KnuthElement contentElement;
                while (returnedList.size() > 0) {
-                    Object obj = returnedList.removeFirst();
+                    Object obj = returnedList.remove(0);
                     if (obj instanceof KnuthSequence) {
                         KnuthSequence ks = (KnuthSequence)obj;
                         for (Iterator it = ks.iterator(); it.hasNext(); ) {
@@ -312,7 +310,7 @@
         return false;
     }
 
-    public LinkedList getChangedKnuthElements(List oldList,
+    public List getChangedKnuthElements(List oldList,
                                               /*int flaggedPenalty,*/
                                               int alignment) {
         return null;

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -29,20 +29,20 @@
  */
 public class ExternalGraphicLayoutManager extends AbstractGraphicsLayoutManager {
     
-    private ExternalGraphic fobj;
-
     /**
-     * Constructor
-     * @param node the fo:external-graphic formatting object that creates the area
+     * Constructor.
+     * 
+     * @param node
+     *            the fo:external-graphic formatting object that creates the
+     *            area
      */
     public ExternalGraphicLayoutManager(ExternalGraphic node) {
         super(node);
-        fobj = node;
     }
 
     /** {@inheritDoc} */
     protected Area getChildArea() {
-        return new Image(fobj.getSrc());
+        return new Image(((ExternalGraphic) fobj).getSrc());
     }
     
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -71,7 +71,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context,
+    public List getNextKnuthElements(LayoutContext context,
                                            int alignment) {
         // for the moment, this LM is set as the citationLM's parent
         // later on, when this LM will have nothing more to do, the citationLM's parent
@@ -82,9 +82,9 @@
         bodyLM.initialize();
 
         // get Knuth elements representing the footnote citation
-        LinkedList returnedList = new LinkedList();
+        List returnedList = new LinkedList();
         while (!citationLM.isFinished()) {
-            LinkedList partialList = citationLM.getNextKnuthElements(context, alignment);
+            List partialList = citationLM.getNextKnuthElements(context, alignment);
             if (partialList != null) {
                 returnedList.addAll(partialList);
             }
@@ -122,9 +122,9 @@
     /**
      * {@inheritDoc} 
      */
-    public LinkedList getChangedKnuthElements(List oldList,
+    public List getChangedKnuthElements(List oldList,
                                               int alignment) {
-        LinkedList returnedList = super.getChangedKnuthElements(oldList, alignment);
+        List returnedList = super.getChangedKnuthElements(oldList, alignment);
         addAnchor(returnedList);
         return returnedList;
     }
@@ -164,7 +164,7 @@
      * Find the last box in the sequence, and add a reference to the FootnoteBodyLM
      * @param citationList the list of elements representing the footnote citation
      */
-    private void addAnchor(LinkedList citationList) {
+    private void addAnchor(List citationList) {
         KnuthInlineBox lastBox = null;
         // the list of elements is searched backwards, until we find a box
         ListIterator citationIterator = citationList.listIterator(citationList.size());

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -56,6 +56,7 @@
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.traits.SpaceVal;
+import org.apache.fop.util.ListUtil;
 
 /**
  * LayoutManager for objects which stack children in the inline direction,
@@ -233,14 +234,14 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
         LayoutManager curLM;
 
         // the list returned by child LM
-        LinkedList returnedList;
+        List returnedList;
 
         // the list which will be returned to the parent LM
-        LinkedList returnList = new LinkedList();
+        List returnList = new LinkedList();
         KnuthSequence lastSequence = null;
 
         SpaceSpecifier leadingSpace = context.getLeadingSpace();
@@ -312,11 +313,11 @@
             
             // get KnuthElements from curLM
             returnedList = curLM.getNextKnuthElements(childLC, alignment);
-            if (returnList.size() == 0 && childLC.isKeepWithPreviousPending()) {
+            if (returnList.isEmpty() && childLC.isKeepWithPreviousPending()) {
                 childLC.clearKeepWithPreviousPending();
             }
             if (returnedList == null
-                    || returnedList.size() == 0) {
+                    || returnedList.isEmpty()) {
                 // curLM returned null or an empty list, because it finished;
                 // just iterate once more to see if there is another child
                 continue;
@@ -335,7 +336,7 @@
                     returnedList.remove(0);
                 }
                 // add border and padding to the first complete sequence of this LM
-                if (!borderAdded && returnedList.size() != 0) {
+                if (!borderAdded && !returnedList.isEmpty()) {
                     addKnuthElementsForBorderPaddingStart((KnuthSequence) returnedList.get(0));
                     borderAdded = true;
                 }
@@ -367,7 +368,7 @@
                 context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
                 childLC.clearKeepsPending();
             }
-            lastSequence = (KnuthSequence) returnList.getLast();
+            lastSequence = (KnuthSequence) ListUtil.getLast(returnList);
             lastChildLM = curLM;
         }
         
@@ -378,7 +379,7 @@
         setFinished(true);
         log.trace(trace);
         
-        if (returnList.size() == 0) {
+        if (returnList.isEmpty()) {
             /*
              * if the FO itself is empty, but has an id specified 
              * or associated fo:markers, then we still need a dummy
@@ -395,7 +396,7 @@
             }
         }
         
-        return returnList.size() == 0 ? null : returnList;
+        return returnList.isEmpty() ? null : returnList;
     }
 
     /**
@@ -432,7 +433,7 @@
         // set in the layout context, it must be also set in the
         // layout context given to lastLM, but must be cleared in the
         // layout context given to the other LMs.
-        LinkedList positionList = new LinkedList();
+        List positionList = new LinkedList();
         NonLeafPosition pos;
         LayoutManager lastLM = null;// last child LM in this iterator
         Position lastPos = null;
@@ -533,8 +534,8 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getChangedKnuthElements(List oldList, int alignment) {
-        LinkedList returnedList = new LinkedList();
+    public List getChangedKnuthElements(List oldList, int alignment) {
+        List returnedList = new LinkedList();
         addKnuthElementsForBorderPaddingStart(returnedList);
         returnedList.addAll(super.getChangedKnuthElements(oldList, alignment));
         addKnuthElementsForBorderPaddingEnd(returnedList);

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -364,7 +364,7 @@
     /**
      * {@inheritDoc} 
      */
-    public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+    public List getChangedKnuthElements(List oldList, int alignment) {
         // "unwrap" the Positions stored in the elements
         ListIterator oldListIterator = oldList.listIterator();
         KnuthElement oldElement;

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java
Mon Jul  7 07:09:01 2008
@@ -29,20 +29,19 @@
  */
 public class InstreamForeignObjectLM extends AbstractGraphicsLayoutManager {
     
-    private InstreamForeignObject fobj;
-    
     /**
-     * Constructor
-     * @param node the formatting object that creates this area
+     * Constructor.
+     * 
+     * @param node
+     *            the formatting object that creates this area
      */
     public InstreamForeignObjectLM(InstreamForeignObject node) {
         super(node);
-        fobj = node;
     }
 
     /** {@inheritDoc} */
     protected Area getChildArea() {
-        XMLObj child = (XMLObj) fobj.getChildXMLObj();
+        XMLObj child = ((InstreamForeignObject) fobj).getChildXMLObj();
 
         org.w3c.dom.Document doc = child.getDOMDocument();
         String ns = child.getNamespaceURI();

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -52,7 +52,7 @@
     private Leader fobj;
     private Font font = null;
     
-    private LinkedList contentList = null;
+    private List contentList = null;
     private ContentLayoutManager clm = null;
     
     private int contentAreaIPD = 0;
@@ -230,7 +230,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context,
+    public List getNextKnuthElements(LayoutContext context,
                                            int alignment) {
         MinOptMax ipd;
         curArea = get(context);
@@ -305,13 +305,13 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getChangedKnuthElements(List oldList,
+    public List getChangedKnuthElements(List oldList,
                                               int alignment) {
         if (isFinished()) {
             return null;
         }
 
-        LinkedList returnList = new LinkedList();
+        List returnList = new LinkedList();
 
         addKnuthElementsForBorderPaddingStart(returnList);
         

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -91,7 +91,7 @@
 
 
     /**
-     * Create a Leaf node layout mananger.
+     * Create a Leaf node layout manager.
      * @param node the FObj to attach to this LM.
      */
     public LeafNodeLayoutManager(FObj node) {
@@ -99,7 +99,7 @@
     }
 
     /**
-     * Create a Leaf node layout mananger.
+     * Create a Leaf node layout manager.
      */
     public LeafNodeLayoutManager() {
     }
@@ -249,7 +249,7 @@
     }
     
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
         curArea = get(context);
         
         if (curArea == null) {
@@ -313,7 +313,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getChangedKnuthElements(List oldList,
+    public List getChangedKnuthElements(List oldList,
                                               int alignment) {
         if (isFinished()) {
             return null;

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -46,6 +46,7 @@
 import org.apache.fop.layoutmgr.BreakingAlgorithm;
 import org.apache.fop.layoutmgr.ElementListObserver;
 import org.apache.fop.layoutmgr.InlineKnuthSequence;
+import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.KnuthBlockBox;
 import org.apache.fop.layoutmgr.KnuthBox;
 import org.apache.fop.layoutmgr.KnuthElement;
@@ -386,9 +387,8 @@
                     InlineLevelEventProducer eventProducer
                         = InlineLevelEventProducer.Provider.get(
                             getFObj().getUserAgent().getEventBroadcaster());
-                    eventProducer.lineOverflows(this, addedPositions + 1,
+                    eventProducer.lineOverflows(this, bestActiveNode.line,
                             -lack, getFObj().getLocator());
-                    String textDiff = (lack < -50000 ? "more than 50 points" : (-lack)
+ "mpt");
                 }
             }
             
@@ -573,7 +573,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
         FontInfo fi = fobj.getFOEventHandler().getFontInfo();
         FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi);
         Font fs = fi.getFontInstance(fontkeys[0], fobj.getCommonFont().fontSize.getValue(this));
@@ -643,7 +643,7 @@
         LayoutContext inlineLC = new LayoutContext(context);
         
         InlineLevelLayoutManager curLM;
-        LinkedList returnedList = null;
+        List returnedList = null;
         iLineWidth = context.getStackLimitIP().opt;
             
         // convert all the text in a sequence of paragraphs made
@@ -665,7 +665,7 @@
             }
             
             if (lastPar != null) {
-                KnuthSequence firstSeq = (KnuthSequence) returnedList.getFirst();
+                KnuthSequence firstSeq = (KnuthSequence) returnedList.get(0);
                 
                 // finish last paragraph before a new block sequence
                 if (!firstSeq.isInlineSequence()) {
@@ -900,7 +900,7 @@
      * @param context the layout context
      * @return a list of Knuth elements representing broken lines
      */
-    private LinkedList createLineBreaks(int alignment, LayoutContext context) {
+    private List createLineBreaks(int alignment, LayoutContext context) {
 
         // find the optimal line breaking points for each paragraph
         ListIterator paragraphsIterator
@@ -1047,16 +1047,19 @@
      * @param context the layout context
      * @return the newly built element list
      */
-    private LinkedList postProcessLineBreaks(int alignment, LayoutContext context) {
+    private List postProcessLineBreaks(int alignment, LayoutContext context) {
     
-        LinkedList returnList = new LinkedList();
+        List returnList = new LinkedList();
         
         for (int p = 0; p < knuthParagraphs.size(); p++) {
-            // null penalty between paragraphs
-            if (p > 0 && !((BlockLevelLayoutManager) parentLM).mustKeepTogether())
{
-                returnList.add(new BreakElement(
-                        new Position(this), 0, context));
-                //returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
+            // penalty between paragraphs
+            if (p > 0) {
+                int strength = getKeepTogetherStrength();
+                int penalty = KeepUtil.getPenaltyForKeep(strength);
+                if (penalty < KnuthElement.INFINITE) {
+                    returnList.add(new BreakElement(
+                            new Position(this), penalty, context));
+                }
             }
         
             LineLayoutPossibilities llPoss;
@@ -1064,7 +1067,7 @@
             KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(p);
 
             if (!seq.isInlineSequence()) {
-                LinkedList targetList = new LinkedList();
+                List targetList = new LinkedList();
                 ListIterator listIter = seq.listIterator();
                 while (listIter.hasNext()) {
                     ListElement tempElement;
@@ -1090,20 +1093,23 @@
                 for (int i = 0;
                         i < llPoss.getChosenLineCount();
                         i++) {
-                    if (!((BlockLevelLayoutManager) parentLM).mustKeepTogether()
+                    if (returnList.size() > 0
+                            && i > 0 //if i==0 break generated above already
                             && i >= fobj.getOrphans()
-                            && i <= llPoss.getChosenLineCount() - fobj.getWidows()
-                            && returnList.size() > 0) {
-                        // null penalty allowing a page break between lines
-                        returnList.add(new BreakElement(
-                                returnPosition, 0, context));
-                        //returnList.add(new KnuthPenalty(0, 0, false, returnPosition, false));
+                            && i <= llPoss.getChosenLineCount() - fobj.getWidows())
{
+                        // penalty allowing a page break between lines
+                        int strength = getKeepTogetherStrength();
+                        int penalty = KeepUtil.getPenaltyForKeep(strength);
+                        if (penalty < KnuthElement.INFINITE) {
+                            returnList.add(new BreakElement(
+                                    returnPosition, penalty, context));
+                        }
                     }
                     int endIndex
                       = ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos();
                     // create a list of the FootnoteBodyLM handling footnotes 
                     // whose citations are in this line
-                    LinkedList footnoteList = new LinkedList();
+                    List footnoteList = new LinkedList();
                     ListIterator elementIterator = seq.listIterator(startIndex);
                     while (elementIterator.nextIndex() <= endIndex) {
                         KnuthElement element = (KnuthElement) elementIterator.next();
@@ -1327,8 +1333,8 @@
     /**
      * {@inheritDoc} 
      */
-    public LinkedList getChangedKnuthElements(List oldList, int alignment) {
-        LinkedList returnList = new LinkedList();
+    public List getChangedKnuthElements(List oldList, int alignment) {
+        List returnList = new LinkedList();
         for (int p = 0; p < knuthParagraphs.size(); p++) {
             LineLayoutPossibilities llPoss;
             llPoss = (LineLayoutPossibilities)lineLayoutsList.get(p);
@@ -1377,7 +1383,7 @@
         ListIterator currParIterator
             = currPar.listIterator(currPar.ignoreAtStart);
         // list of TLM involved in hyphenation
-        LinkedList updateList = new LinkedList();
+        List updateList = new LinkedList();
         KnuthElement firstElement = null;
         KnuthElement nextElement = null;
         // current InlineLevelLayoutManager
@@ -1490,7 +1496,7 @@
                 .applyChanges(currPar.subList(fromIndex + iAddedElements,
                                               toIndex + iAddedElements))) {
                 // insert the new KnuthElements
-                LinkedList newElements = null;
+                List newElements = null;
                 newElements
                     = currUpdate.inlineLM.getChangedKnuthElements
                     (currPar.subList(fromIndex + iAddedElements,

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
(original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
Mon Jul  7 07:09:01 2008
@@ -44,7 +44,7 @@
     
     /** {@inheritDoc} */
     public InlineArea get(LayoutContext context) {
-        curArea = getPageNumberCitationInlineArea(parentLM);
+        curArea = getPageNumberCitationInlineArea();
         return curArea;
     }
     
@@ -52,7 +52,7 @@
      * if id can be resolved then simply return a word, otherwise
      * return a resolvable area
      */
-    private InlineArea getPageNumberCitationInlineArea(LayoutManager parentLM) {
+    private InlineArea getPageNumberCitationInlineArea() {
         PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
         TextArea text = null;
         if (page != null) {



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