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 ad...@apache.org on 2008/03/23 20:36:38 UTC

svn commit: r640242 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr: ./ inline/ list/ table/

Author: adelmelle
Date: Sun Mar 23 12:36:36 2008
New Revision: 640242

URL: http://svn.apache.org/viewvc?rev=640242&view=rev
Log:
Cleanup and minor refactoring:
* consolidate addId() in AbstractLayoutManager
* replace getPSLM().addIdToPage(getXXX().getId()) in various LMs

Smaller changes/cleanup in the affected LMs include:
* removal of some redundant casts
* simplified conditionals
* avoid duplicating the reference to the FObj as much as possible:
  the reference is already stored in AbstractLM, yet every subclass seems to
  add another reference...

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -113,7 +113,7 @@
         if (curChildLM != null && !curChildLM.isFinished()) {
             return curChildLM;
         }
-        while (childLMiter.hasNext()) {
+        if (childLMiter.hasNext()) {
             curChildLM = (LayoutManager) childLMiter.next();
             curChildLM.initialize();
             return curChildLM;
@@ -350,6 +350,10 @@
     
     /**
      * Registers the FO's markers on the current PageViewport
+     *
+     * @param isStarting    boolean indicating whether the markers qualify as 'starting'
+     * @param isFirst   boolean indicating whether the markers qualify as 'first'
+     * @param isLast    boolean indicating whether the markers qualify as 'last'
      */
     protected void addMarkersToPage(boolean isStarting, boolean isFirst, boolean isLast) {
         if (this.markers != null) {
@@ -361,10 +365,18 @@
         }
     }
 
+    /**
+     * Registers the FO's id on the current PageViewport
+     */
+    protected void addId() {
+        if (fobj != null) {
+            getPSLM().addIDToPage(fobj.getId());
+        }
+    }
+    
     /** {@inheritDoc} */
     public String toString() {
         return (super.toString() + (fobj != null ? "[fobj=" + fobj.toString() + "]" : ""));
     }
-    
     
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -248,7 +248,7 @@
         
         MinOptMax stackLimit = new MinOptMax(relDims.bpd);
 
-        LinkedList returnedList = null;
+        LinkedList returnedList;
         LinkedList contentList = new LinkedList();
         LinkedList returnList = new LinkedList();
         
@@ -602,11 +602,7 @@
         }
         
         public boolean isOverflow() {
-            if (isEmpty()) {
-                return false;
-            } else {
-                return (deferredAlg.getPageBreaks().size() > 1);
-            }
+            return !isEmpty() && (deferredAlg.getPageBreaks().size() > 1);
         }
         
         protected LayoutManager getTopLevelLM() {
@@ -708,7 +704,7 @@
             addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
         }
 
-        LayoutManager childLM = null;
+        LayoutManager childLM;
         LayoutManager lastLM = null;
         LayoutContext lc = new LayoutContext(0);
         lc.setSpaceAdjust(layoutContext.getSpaceAdjust());
@@ -737,7 +733,7 @@
             }
             Position innerPosition = pos;
             if (pos instanceof NonLeafPosition) {
-                innerPosition = ((NonLeafPosition)pos).getPosition();
+                innerPosition = pos.getPosition();
             }
             if (pos instanceof BlockContainerPosition) {
                 if (bcpos != null) {
@@ -773,7 +769,7 @@
             }
         }
 
-        getPSLM().addIDToPage(getBlockContainerFO().getId());
+        addId();
         
         addMarkersToPage(true, isFirst(firstPos), isLast(lastPos));
         
@@ -874,7 +870,7 @@
         referenceArea = null;
         resetSpaces();
         
-        getPSLM().notifyEndOfLayout(((BlockContainer)getFObj()).getId());
+        getPSLM().notifyEndOfLayout(fobj.getId());
     }
     
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -147,7 +147,7 @@
          * @return true if there are more child lms
          */
         public boolean hasNext() {
-            return (curPos < listLMs.size()) ? true : createNextChildLMs(curPos);
+            return (curPos < listLMs.size()) || createNextChildLMs(curPos);
         }
 
         /**
@@ -250,7 +250,7 @@
             addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
         }
 
-        LayoutManager childLM = null;
+        LayoutManager childLM;
         LayoutManager lastLM = null;
         LayoutContext lc = new LayoutContext(0);
         lc.setSpaceAdjust(layoutContext.getSpaceAdjust());
@@ -280,7 +280,7 @@
             Position innerPosition = pos;
             if (pos instanceof NonLeafPosition) {
                 //Not all elements are wrapped
-                innerPosition = ((NonLeafPosition) pos).getPosition();
+                innerPosition = pos.getPosition();
             }
             if (innerPosition == null) {
                 // pos was created by this BlockLM and was inside an element
@@ -309,7 +309,7 @@
             }
         }
 
-        getPSLM().addIDToPage(getBlockFO().getId());
+        addId();
         
         addMarkersToPage(true, isFirst(firstPos), isLast(lastPos));
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -124,13 +124,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    protected void addId() {
-        getPSLM().addIDToPage(fobj.getId());
-    }
-
-    /**
      * Returns the image of foreign object area to be put into
      * the viewport.
      * @return the appropriate area

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -51,7 +51,7 @@
      * Constructor
      *
      * @param node the formatting object that creates this area
-     * @todo better retrieval of font info
+     * TODO better retrieval of font info
      */
     public AbstractPageNumberCitationLayoutManager(AbstractPageNumberCitation node) {
         super(node);
@@ -83,7 +83,7 @@
 
     /** {@inheritDoc} */
     public InlineArea get(LayoutContext context) {
-        curArea = getPageNumberCitationInlineArea(parentLM);
+        curArea = getPageNumberCitationInlineArea();
         return curArea;
     }
     
@@ -99,12 +99,15 @@
     }
     
     /**
-     * if id can be resolved then simply return a word, otherwise
+     * If id can be resolved then simply return a word, otherwise
      * return a resolvable area
+     *
+     * @param parentLM  the parent LayoutManager
+     * @return a corresponding InlineArea
      */
-    private InlineArea getPageNumberCitationInlineArea(LayoutManager parentLM) {
+    private InlineArea getPageNumberCitationInlineArea() {
         PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
-        TextArea text = null;
+        TextArea text;
         if (page != null) {
             String str = page.getPageNumberString();
             // get page string from parent, build area
@@ -150,9 +153,5 @@
         return width;
     }
 
-    /** {@inheritDoc} */
-    protected void addId() {
-        getPSLM().addIDToPage(fobj.getId());
-    }
 }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -45,7 +45,6 @@
  * LayoutManager for the fo:character formatting object
  */
 public class CharacterLayoutManager extends LeafNodeLayoutManager {
-    private Character fobj;
     private MinOptMax letterSpaceIPD;
     private int hyphIPD;
     private Font font;
@@ -57,13 +56,13 @@
      * @param node the fo:character formatting object
      */
     public CharacterLayoutManager(Character node) {
-        // @todo better null checking of node
         super(node);
-        fobj = node;
     }
     
     /** {@inheritDoc} */
     public void initialize() {
+        Character fobj = (Character)this.fobj;
+        
         FontInfo fi = fobj.getFOEventHandler().getFontInfo();
         FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi);
         font = fi.getFontInstance(fontkeys[0], fobj.getCommonFont().fontSize.getValue(this));
@@ -90,7 +89,7 @@
             text.addWord(String.valueOf(ch), 0);
         }
         TraitSetter.setProducerID(text, node.getId());
-        TraitSetter.addTextDecoration(text, fobj.getTextDecoration());
+        TraitSetter.addTextDecoration(text, node.getTextDecoration());
         return text;
     }
 
@@ -105,6 +104,8 @@
             return null;
         }
 
+        Character fobj = (Character)this.fobj;
+        
         ipd = new MinOptMax(font.getCharWidth(fobj.getCharacter()));
 
         curArea.setIPD(ipd.opt);
@@ -178,14 +179,7 @@
     /** {@inheritDoc} */
     public boolean applyChanges(List oldList) {
         setFinished(false);
-        if (isSomethingChanged) {
-            // there is nothing to do,
-            // possible changes have already been applied
-            // in the hyphenate() method
-            return true;
-        } else {
-            return false;
-        }
+        return isSomethingChanged;
     }
 
     /** {@inheritDoc} */
@@ -236,11 +230,6 @@
 
         setFinished(true);
         return returnList;
-    }
-
-    /** {@inheritDoc} */
-    protected void addId() {
-        getPSLM().addIDToPage(fobj.getId());
     }
 
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -31,12 +31,10 @@
  * and id areas are maintained for later retrieval.
  */
 public class ICLayoutManager extends LeafNodeLayoutManager {
-    private InlineContainer fobj;
     private List childrenLM;
 
     public ICLayoutManager(InlineContainer node, List childLM) {
         super(node);
-        fobj = node;
         childrenLM = childLM;
     }
 
@@ -44,7 +42,4 @@
         return null;
     }
 
-    protected void addId() {
-        getPSLM().addIDToPage(fobj.getId());
-    }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -297,7 +297,7 @@
              );
         }
         
-        while ((curLM = (LayoutManager) getChildLM()) != null) {
+        while ((curLM = getChildLM()) != null) {
             
             if (!(curLM instanceof InlineLevelLayoutManager)) {
                 // A block LM
@@ -436,7 +436,7 @@
         // layout context given to lastLM, but must be cleared in the
         // layout context given to the other LMs.
         LinkedList positionList = new LinkedList();
-        NonLeafPosition pos = null;
+        NonLeafPosition pos;
         LayoutManager lastLM = null;// last child LM in this iterator
         Position lastPos = null;
         while (parentIter.hasNext()) {
@@ -598,11 +598,6 @@
             this.auxiliaryPosition = new NonLeafPosition(this, null);
         //}
         return this.auxiliaryPosition;
-    }
-    
-    /** {@inheritDoc} */
-    protected void addId() {
-        getPSLM().addIDToPage(fobj.getId());
     }
     
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -75,15 +75,9 @@
 
     private Area currentArea; // LineArea or InlineParent
 
-    //private BreakPoss prevBP;
-    
     /** The child layout context */
     protected LayoutContext childLC;
 
-    private boolean bAreaCreated = false;
-
-    //private LayoutManager currentLM = null;
-
     /** Used to store previous content IPD for each child LM. */
     private HashMap hmPrevIPD = new HashMap();
 
@@ -171,14 +165,6 @@
     }
 
     /**
-     * This method is called by addAreas() so IDs can be added to a page for FOs that 
-     * support the 'id' property.
-     */
-    protected void addId() {
-        // Do nothing here, overriden in subclasses that have an 'id' property.
-    }
-    
-    /**
      * Returns the current area.
      * @return the current area
      */
@@ -255,7 +241,7 @@
         // "unwrap" the Position stored in each element of oldList
         while (oldListIterator.hasNext()) {
             element = (KnuthElement) oldListIterator.next();
-            element.setPosition(((NonLeafPosition)element.getPosition()).getPosition());
+            element.setPosition(element.getPosition().getPosition());
         }
 
         // The last element may not have a layout manager (its position == null);
@@ -288,7 +274,7 @@
         // "unwrap" the Position stored in each element of oldList
         while (oldListIterator.hasNext()) {
             element = (KnuthElement) oldListIterator.next();
-            element.setPosition(((NonLeafPosition)element.getPosition()).getPosition());
+            element.setPosition(element.getPosition().getPosition());
         }
 
         ((InlineLevelLayoutManager)
@@ -298,14 +284,14 @@
 
     /** {@inheritDoc} */
     public void getWordChars(StringBuffer sbChars, Position pos) {
-        Position newPos = ((NonLeafPosition) pos).getPosition();
+        Position newPos = pos.getPosition();
         ((InlineLevelLayoutManager)
          newPos.getLM()).getWordChars(sbChars, newPos);
     }
 
     /** {@inheritDoc} */
     public void hyphenate(Position pos, HyphContext hc) {
-        Position newPos = ((NonLeafPosition) pos).getPosition();
+        Position newPos = pos.getPosition();
         ((InlineLevelLayoutManager)
          newPos.getLM()).hyphenate(newPos, hc);
     }
@@ -318,7 +304,7 @@
         while (oldListIterator.hasNext()) {
             oldElement = (KnuthElement) oldListIterator.next();
             oldElement.setPosition
-                (((NonLeafPosition) oldElement.getPosition()).getPosition());
+                (oldElement.getPosition().getPosition());
         }
         // reset the iterator
         oldListIterator = oldList.listIterator();
@@ -385,7 +371,7 @@
         while (oldListIterator.hasNext()) {
             oldElement = (KnuthElement) oldListIterator.next();
             oldElement.setPosition
-                (((NonLeafPosition) oldElement.getPosition()).getPosition());
+                (oldElement.getPosition().getPosition());
         }
         // reset the iterator
         oldListIterator = oldList.listIterator();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -339,11 +339,6 @@
         return returnList;
     }
 
-    /** {@inheritDoc} */
-    protected void addId() {
-        getPSLM().addIDToPage(fobj.getId());
-    }
-
     /**
      * {@inheritDoc} 
      */

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -65,8 +65,6 @@
     /** The alignment context applying to this area */
     protected AlignmentContext alignmentContext = null;
     
-    private MinOptMax ipd;
-
     /** Flag to indicate if something was changed as part of the getChangeKnuthElements sequence */
     protected boolean isSomethingChanged = false;
     /** Our area info for the Knuth elements */
@@ -202,14 +200,6 @@
      */
     protected InlineArea getEffectiveArea() {
         return curArea;
-    }
-    
-    /**
-     * This method is called by addAreas() so IDs can be added to a page for FOs that 
-     * support the 'id' property.
-     */
-    protected void addId() {
-        // Do nothing here, overriden in subclasses that have an 'id' property.
     }
     
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -42,7 +42,7 @@
      * Constructor
      *
      * @param node the fo:page-number formatting object that creates the area
-     * @todo better null checking of node, font
+     * TODO better null checking of node, font
      */
     public PageNumberLayoutManager(PageNumber node) {
         super(node);
@@ -131,9 +131,5 @@
         return width;
     }
     
-    /** {@inheritDoc} */
-    protected void addId() {
-        getPSLM().addIDToPage(fobj.getId());
-    }
 }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -156,11 +156,11 @@
             addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
         }
 
-        getPSLM().addIDToPage(getListBlockFO().getId());
+        addId();
 
         // the list block contains areas stacked from each list item
 
-        LayoutManager childLM = null;
+        LayoutManager childLM;
         LayoutContext lc = new LayoutContext(0);
         LayoutManager firstLM = null;
         LayoutManager lastLM = null;
@@ -181,10 +181,10 @@
             }
             if (pos instanceof NonLeafPosition
                     && (pos.getPosition() != null)
-                    && ((NonLeafPosition) pos).getPosition().getLM() != this) {
+                    && pos.getPosition().getLM() != this) {
                 // pos was created by a child of this ListBlockLM
-                positionList.add(((NonLeafPosition) pos).getPosition());
-                lastLM = ((NonLeafPosition) pos).getPosition().getLM();
+                positionList.add(pos.getPosition());
+                lastLM = pos.getPosition().getLM();
                 if (firstLM == null) {
                     firstLM = lastLM;
                 }
@@ -218,7 +218,7 @@
         curBlockArea = null;
         resetSpaces();
         
-        getPSLM().notifyEndOfLayout(((ListBlock)getFObj()).getId());
+        getPSLM().notifyEndOfLayout(fobj.getId());
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -115,9 +115,9 @@
                          LayoutContext layoutContext) {
         getParentArea(null);
         
-        getPSLM().addIDToPage(getPartFO().getId());
+        addId();
 
-        LayoutManager childLM = null;
+        LayoutManager childLM;
         LayoutContext lc = new LayoutContext(0);
         LayoutManager firstLM = null;
         LayoutManager lastLM = null;
@@ -141,8 +141,8 @@
             }
             if (pos instanceof NonLeafPosition) {
                 // pos was created by a child of this ListBlockLM
-                positionList.add(((NonLeafPosition) pos).getPosition());
-                lastLM = ((NonLeafPosition) pos).getPosition().getLM();
+                positionList.add(pos.getPosition());
+                lastLM = pos.getPosition().getLM();
                 if (firstLM == null) {
                     firstLM = lastLM;
                 }
@@ -172,7 +172,7 @@
 
         curBlockArea = null;
         
-        getPSLM().notifyEndOfLayout(((AbstractListItemPart)getFObj()).getId());
+        getPSLM().notifyEndOfLayout(fobj.getId());
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -73,8 +73,6 @@
     private LinkedList labelList = null;
     private LinkedList bodyList = null;
 
-    private int listItemHeight;
-    
     private boolean discardBorderBefore;
     private boolean discardBorderAfter;
     private boolean discardPaddingBefore;
@@ -84,7 +82,9 @@
     
     private boolean keepWithNextPendingOnLabel;
     private boolean keepWithNextPendingOnBody;
-  
+
+    private int listItemHeight;
+    
     private class ListItemPosition extends Position {
         private int iLabelFirstIndex;
         private int iLabelLastIndex;
@@ -307,12 +307,12 @@
             int additionalPenaltyHeight = 0;
             KnuthElement endEl = (KnuthElement)elementLists[0].get(end[0]);
             if (endEl instanceof KnuthPenalty) {
-                additionalPenaltyHeight = ((KnuthPenalty)endEl).getW();
+                additionalPenaltyHeight = endEl.getW();
             }
             endEl = (KnuthElement)elementLists[1].get(end[1]);
             if (endEl instanceof KnuthPenalty) {
                 additionalPenaltyHeight = Math.max(
-                        additionalPenaltyHeight, ((KnuthPenalty)endEl).getW());
+                        additionalPenaltyHeight, endEl.getW());
             }
             
             int boxHeight = step - addedBoxHeight - penaltyHeight;
@@ -419,10 +419,10 @@
         // body
         // "unwrap" the Positions stored in the elements
         ListIterator oldListIterator = oldList.listIterator();
-        KnuthElement oldElement = null;
+        KnuthElement oldElement;
         while (oldListIterator.hasNext()) {
             oldElement = (KnuthElement)oldListIterator.next();
-            Position innerPosition = ((NonLeafPosition) oldElement.getPosition()).getPosition();
+            Position innerPosition = oldElement.getPosition().getPosition();
             //log.debug(" BLM> unwrapping: " + (oldElement.isBox() 
             //  ? "box    " : (oldElement.isGlue() ? "glue   " : "penalty")) 
             //  + " creato da " + oldElement.getLayoutManager().getClass().getName());
@@ -465,7 +465,7 @@
                          LayoutContext layoutContext) {
         getParentArea(null);
 
-        getPSLM().addIDToPage(getListItemFO().getId());
+        addId();
 
         LayoutContext lc = new LayoutContext(0);
         Position firstPos = null;
@@ -484,7 +484,7 @@
             }
             if (pos instanceof NonLeafPosition && pos.getPosition() != null) {
                 // pos contains a ListItemPosition created by this ListBlockLM
-                positionList.add(((NonLeafPosition) pos).getPosition());
+                positionList.add(pos.getPosition());
             }
         }
 
@@ -560,7 +560,7 @@
         curBlockArea = null;
         resetSpaces();
         
-        getPSLM().notifyEndOfLayout(((ListItem)getFObj()).getId());
+        getPSLM().notifyEndOfLayout(fobj.getId());
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -23,7 +23,6 @@
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.PositionIterator;
-import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
 
@@ -36,8 +35,7 @@
  * @todo Implement getNextKnuthElements()
  */
 public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager {
-    private TableAndCaption fobj;
-    
+
     private Block curBlockArea;
 
     //private List childBreaks = new java.util.ArrayList();
@@ -48,7 +46,6 @@
      */
     public TableAndCaptionLayoutManager(TableAndCaption node) {
         super(node);
-        fobj = node;
     }
 
     /**
@@ -134,7 +131,7 @@
     public void addAreas(PositionIterator parentIter,
                          LayoutContext layoutContext) {
         getParentArea(null);
-        getPSLM().addIDToPage(fobj.getId());
+        addId();
 
         /* TODO: Reimplement using Knuth approach
         LayoutManager childLM;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -23,7 +23,6 @@
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.PositionIterator;
-import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
 
@@ -34,7 +33,6 @@
  * @todo Implement getNextKnuthElements()
  */
 public class TableCaptionLayoutManager extends BlockStackingLayoutManager {
-    private TableCaption fobj;
 
     private Block curBlockArea;
 
@@ -46,7 +44,6 @@
      */
     public TableCaptionLayoutManager(TableCaption node) {
         super(node);
-        fobj = node;
     }
 
     /**
@@ -133,7 +130,7 @@
     public void addAreas(PositionIterator parentIter,
                          LayoutContext layoutContext) {
         getParentArea(null);
-        getPSLM().addIDToPage(fobj.getId());
+        addId();
 
         /* TODO: Reimplement using Knuth approach
         LayoutManager childLM;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -136,7 +136,7 @@
         cellIPD = referenceIPD;
         cellIPD -= getIPIndents();
 
-        LinkedList returnedList = null;
+        LinkedList returnedList;
         LinkedList contentList = new LinkedList();
         LinkedList returnList = new LinkedList();
 
@@ -242,7 +242,7 @@
             p.setP(0);
         }
 
-        getPSLM().notifyEndOfLayout(((TableCell)getFObj()).getId());
+        getPSLM().notifyEndOfLayout(fobj.getId());
 
         setFinished(true);
         return returnList;
@@ -330,7 +330,7 @@
                          int firstRowHeight) {
         getParentArea(null);
 
-        getPSLM().addIDToPage(getTableCell().getId());
+        addId();
 
         int borderBeforeWidth = primaryGridUnit.getBeforeBorderWidth(startRow, borderBeforeWhich);
         int borderAfterWidth = primaryGridUnit.getAfterBorderWidth(endRow, borderAfterWhich);
@@ -419,7 +419,7 @@
                     int dx = xoffset;
                     for (int x = 0; x < gridUnits.length; x++) {
                         int ipd = getTable().getColumn(primaryGridUnit.getColIndex() + x)
-                                .getColumnWidth().getValue((PercentBaseContext) getParent());
+                                .getColumnWidth().getValue(getParent());
                         if (blocks[y][x] != null) {
                             Block block = blocks[y][x];
                             adjustYOffset(block, dy);
@@ -491,7 +491,7 @@
             Block rowBackgroundArea = getBackgroundArea(paddingRectBPD, borderBeforeWidth);
             ((TableLayoutManager) parentLM).addBackgroundArea(rowBackgroundArea);
             TraitSetter.addBackground(rowBackgroundArea, row.getCommonBorderPaddingBackground(),
-                    (TableLayoutManager) parentLM,
+                    parentLM,
                     -xoffset - startIndent, -borderBeforeWidth,
                     parentLM.getContentAreaIPD(), firstRowHeight);
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=640242&r1=640241&r2=640242&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Sun Mar 23 12:36:36 2008
@@ -233,7 +233,7 @@
 
 
         // Elements for the table-header/footer/body
-        LinkedList contentKnuthElements = null;
+        LinkedList contentKnuthElements;
         contentLM = new TableContentLayoutManager(this);
         LayoutContext childLC = new LayoutContext(0);
         /*
@@ -319,7 +319,7 @@
     public void addAreas(PositionIterator parentIter,
                          LayoutContext layoutContext) {
         getParentArea(null);
-        getPSLM().addIDToPage(getTable().getId());
+        addId();
 
         // add space before, in order to implement display-align = "center" or "after"
         if (layoutContext.getSpaceBefore() != 0) {
@@ -379,7 +379,7 @@
         resetSpaces();
         curBlockArea = null;
         
-        getPSLM().notifyEndOfLayout(((Table)getFObj()).getId());
+        getPSLM().notifyEndOfLayout(fobj.getId());
     }
 
     /**



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