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 je...@apache.org on 2011/02/10 15:09:46 UTC

svn commit: r1069397 [2/6] - in /xmlgraphics/fop/branches/Temp_Color: ./ lib/ lib/build/ src/codegen/java/org/apache/fop/tools/ src/documentation/content/xdocs/ src/documentation/content/xdocs/trunk/ src/documentation/resources/images/ src/java/org/apa...

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/CTM.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/CTM.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/CTM.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/CTM.java Thu Feb 10 14:09:42 2011
@@ -25,7 +25,10 @@ import java.awt.geom.Rectangle2D;
 import java.io.Serializable;
 
 import org.apache.fop.datatypes.FODimension;
-import org.apache.fop.fo.Constants;
+
+import static org.apache.fop.fo.Constants.EN_LR_TB;
+import static org.apache.fop.fo.Constants.EN_RL_TB;
+import static org.apache.fop.fo.Constants.EN_TB_RL;
 
 /**
  * Describe a PDF or PostScript style coordinate transformation matrix (CTM).
@@ -133,14 +136,14 @@ public class CTM implements Serializable
     public static CTM getWMctm(int wm, int ipd, int bpd) {
         CTM wmctm;
         switch (wm) {
-            case Constants.EN_LR_TB:
+            case EN_LR_TB:
                 return new CTM(CTM_LRTB);
-            case Constants.EN_RL_TB:
+            case EN_RL_TB:
                 wmctm = new CTM(CTM_RLTB);
                 wmctm.e = ipd;
                 return wmctm;
                 //return  CTM_RLTB.translate(ipd, 0);
-            case Constants.EN_TB_RL:  // CJK
+            case EN_TB_RL:  // CJK
                 wmctm = new CTM(CTM_TBRL);
                 wmctm.e = bpd;
                 return wmctm;
@@ -157,13 +160,12 @@ public class CTM implements Serializable
      * @return CTM The result of multiplying premult * this.
      */
     public CTM multiply(CTM premult) {
-        CTM result = new CTM ((premult.a * a) + (premult.b * c),
+        return new CTM ((premult.a * a) + (premult.b * c),
                               (premult.a * b) + (premult.b * d),
                               (premult.c * a) + (premult.d * c),
                               (premult.c * b) + (premult.d * d),
                               (premult.e * a) + (premult.f * c) + e,
                               (premult.e * b) + (premult.f * d) + f);
-        return result;
     }
 
     /**
@@ -249,6 +251,7 @@ public class CTM implements Serializable
      *
      * @return a string with the transform values
      */
+    @Override
     public String toString() {
         return "[" + a + " " + b + " " + c + " " + d + " " + e + " "
                + f + "]";
@@ -332,7 +335,7 @@ public class CTM implements Serializable
          * can set ipd and bpd appropriately based on the writing mode.
          */
 
-        if (writingMode == Constants.EN_LR_TB || writingMode == Constants.EN_RL_TB) {
+        if (writingMode == EN_LR_TB || writingMode == EN_RL_TB) {
             reldims.ipd = width;
             reldims.bpd = height;
         } else {

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/CachedRenderPagesModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/CachedRenderPagesModel.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/CachedRenderPagesModel.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/CachedRenderPagesModel.java Thu Feb 10 14:09:42 2011
@@ -48,7 +48,8 @@ import org.apache.fop.fonts.FontInfo;
  * the contents are reloaded.
  */
 public class CachedRenderPagesModel extends RenderPagesModel {
-    private Map pageMap = new HashMap();
+
+    private Map<PageViewport, String> pageMap = new HashMap<PageViewport, String>();
 
     /** Base directory to save temporary file in, typically points to the user's temp dir. */
     protected File baseDir;
@@ -64,12 +65,12 @@ public class CachedRenderPagesModel exte
     public CachedRenderPagesModel (FOUserAgent userAgent, String outputFormat,
             FontInfo fontInfo, OutputStream stream) throws FOPException {
         super(userAgent, outputFormat, fontInfo, stream);
+        //TODO: Avoid System.getProperty()?
         this.baseDir = new File(System.getProperty("java.io.tmpdir"));
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
+    @Override
     protected boolean checkPreparedPages(PageViewport newpage, boolean renderUnresolved) {
         for (Iterator iter = prepared.iterator(); iter.hasNext();) {
             PageViewport pageViewport = (PageViewport)iter.next();
@@ -77,7 +78,7 @@ public class CachedRenderPagesModel exte
                 if (pageViewport != newpage) {
                     try {
                         // load page from cache
-                        String name = (String)pageMap.get(pageViewport);
+                        String name = pageMap.get(pageViewport);
                         File tempFile = new File(baseDir, name);
                         log.debug("Loading page from: " + tempFile);
                         ObjectInputStream in = new ObjectInputStream(
@@ -152,6 +153,7 @@ public class CachedRenderPagesModel exte
     }
 
     /** {@inheritDoc} */
+    @Override
     public void endDocument() throws SAXException {
         super.endDocument();
     }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/DestinationData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/DestinationData.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/DestinationData.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/DestinationData.java Thu Feb 10 14:09:42 2011
@@ -66,9 +66,7 @@ public class DestinationData extends Abs
         return idRef;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public String[] getIDRefs() {
         return idRefs;
     }
@@ -97,12 +95,12 @@ public class DestinationData extends Abs
      * Resolves the idref of this object by getting the PageViewport
      * object that corresponds to the IDRef
      *
-     * {@inheritDoc} List)
+     * {@inheritDoc}
      * TODO check to make sure it works if multiple bookmark-items
      * have the same idref
      */
-    public void resolveIDRef(String id, List pages) {
-        pageRef = (PageViewport) pages.get(0);
+    public void resolveIDRef(String id, List<PageViewport> pages) {
+        pageRef = pages.get(0);
         // TODO get rect area of id on page
     }
 

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Footnote.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Footnote.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Footnote.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Footnote.java Thu Feb 10 14:09:42 2011
@@ -80,6 +80,7 @@ public class Footnote extends BlockParen
      *
      * @param child the block area.
      */
+    @Override
     public void addBlock(Block child) {
         addChildArea(child);
         this.setBPD(this.getBPD() + child.getBPD());

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/IDTracker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/IDTracker.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/IDTracker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/IDTracker.java Thu Feb 10 14:09:42 2011
@@ -19,8 +19,7 @@
 
 package org.apache.fop.area;
 
-import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -36,18 +35,20 @@ public class IDTracker {
 
     private static final Log LOG = LogFactory.getLog(IDTracker.class);
 
-    // HashMap of ID's whose area is located on one or more consecutive
-    // PageViewports. Each ID has an arraylist of PageViewports that
+    // Map of ID's whose area is located on one or more consecutive
+    // PageViewports. Each ID has a list of PageViewports that
     // form the defined area of this ID
-    private Map idLocations = new java.util.HashMap();
+    private Map<String, List<PageViewport>> idLocations
+            = new java.util.HashMap<String, List<PageViewport>>();
 
     // idref's whose target PageViewports have yet to be identified
     // Each idref has a HashSet of Resolvable objects containing that idref
-    private Map unresolvedIDRefs = new java.util.HashMap();
+    private Map<String, Set<Resolvable>> unresolvedIDRefs
+            = new java.util.HashMap<String, Set<Resolvable>>();
 
-    private Set unfinishedIDs = new java.util.HashSet();
+    private Set<String> unfinishedIDs = new java.util.HashSet<String>();
 
-    private Set alreadyResolvedIDs = new java.util.HashSet();
+    private Set<String> alreadyResolvedIDs = new java.util.HashSet<String>();
 
     /**
      * Tie a PageViewport with an ID found on a child area of the PV. Note that
@@ -61,9 +62,9 @@ public class IDTracker {
         if (LOG.isDebugEnabled()) {
             LOG.debug("associateIDWithPageViewport(" + id + ", " + pv + ")");
         }
-        List pvList = (List) idLocations.get(id);
+        List<PageViewport> pvList = idLocations.get(id);
         if (pvList == null) { // first time ID located
-            pvList = new ArrayList();
+            pvList = new java.util.ArrayList<PageViewport>();
             idLocations.put(id, pvList);
             pvList.add(pv);
             // signal the PageViewport that it is the first PV to contain this id:
@@ -73,7 +74,7 @@ public class IDTracker {
              * Resolvable objects tied to it.
              */
             if (!unfinishedIDs.contains(id)) {
-                tryIDResolution(id, pv, pvList);
+                tryIDResolution(id, pvList);
             }
         } else {
             /* TODO: The check is a quick-fix to avoid a waste
@@ -116,12 +117,11 @@ public class IDTracker {
         }
         unfinishedIDs.remove(id);
 
-        List pvList = (List) idLocations.get(id);
-        Set todo = (Set) unresolvedIDRefs.get(id);
+        List<PageViewport> idLocs = idLocations.get(id);
+        Set<Resolvable> todo = unresolvedIDRefs.get(id);
         if (todo != null) {
-            for (Iterator iter = todo.iterator(); iter.hasNext();) {
-                Resolvable res = (Resolvable) iter.next();
-                res.resolveIDRef(id, pvList);
+            for (Resolvable res : todo) {
+                res.resolveIDRef(id, idLocs);
             }
             unresolvedIDRefs.remove(id);
         }
@@ -138,17 +138,15 @@ public class IDTracker {
     }
 
     /**
-     * Tries to resolve all unresolved ID references on the given page.
+     * Tries to resolve all unresolved ID references on the given set of pages.
      *
      * @param id ID to resolve
-     * @param pv page viewport whose ID refs to resolve
-     * @param pvList of PageViewports
+     * @param pvList list of PageViewports
      */
-    private void tryIDResolution(String id, PageViewport pv, List pvList) {
-        Set todo = (Set) unresolvedIDRefs.get(id);
+    private void tryIDResolution(String id, List<PageViewport> pvList) {
+        Set<Resolvable> todo = unresolvedIDRefs.get(id);
         if (todo != null) {
-            for (Iterator iter = todo.iterator(); iter.hasNext();) {
-                Resolvable res = (Resolvable) iter.next();
+            for (Resolvable res : todo) {
                 if (!unfinishedIDs.contains(id)) {
                     res.resolveIDRef(id, pvList);
                 } else {
@@ -168,10 +166,10 @@ public class IDTracker {
     public void tryIDResolution(PageViewport pv) {
         String[] ids = pv.getIDRefs();
         if (ids != null) {
-            for (int i = 0; i < ids.length; i++) {
-                List pvList = (List) idLocations.get(ids[i]);
-                if (pvList != null) {
-                    tryIDResolution(ids[i], pv, pvList);
+            for (String id : ids) {
+                List<PageViewport> pvList = idLocations.get(id);
+                if (!(pvList == null || pvList.isEmpty())) {
+                    tryIDResolution(id, pvList);
                 }
             }
         }
@@ -183,8 +181,46 @@ public class IDTracker {
      * @param id the id to lookup
      * @return the list of PageViewports
      */
-    public List getPageViewportsContainingID(String id) {
-        return (List) idLocations.get(id);
+    public List<PageViewport> getPageViewportsContainingID(String id) {
+        if (!(idLocations == null || idLocations.isEmpty())) {
+            List<PageViewport> idLocs = idLocations.get(id);
+            if (idLocs != null) {
+                return idLocs;
+            }
+        }
+        return Collections.emptyList();
+    }
+
+    /**
+     * Get the first {@link PageViewport} containing content generated
+     * by the FO with the given {@code id}.
+     *
+     * @param id    the id
+     * @return  the first {@link PageViewport} for the id; {@code null} if
+     *          no matching {@link PageViewport} was found
+     */
+    public PageViewport getFirstPageViewportContaining(String id) {
+        List<PageViewport> list = getPageViewportsContainingID(id);
+        if (!(list == null || list.isEmpty())) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    /**
+     * Get the last {@link PageViewport} containing content generated
+     * by the FO with the given {@code id}.
+     *
+     * @param id    the id
+     * @return  the last {@link PageViewport} for the id; {@code null} if
+     *          no matching {@link PageViewport} was found
+     */
+    public PageViewport getLastPageViewportContaining(String id) {
+        List<PageViewport> list = getPageViewportsContainingID(id);
+        if (!(list == null || list.isEmpty())) {
+            return list.get(list.size() - 1);
+        }
+        return null;
     }
 
     /**
@@ -194,9 +230,9 @@ public class IDTracker {
      * @param res the Resolvable object needing the idref to be resolved
      */
     public void addUnresolvedIDRef(String idref, Resolvable res) {
-        Set todo = (Set) unresolvedIDRefs.get(idref);
+        Set<Resolvable> todo = unresolvedIDRefs.get(idref);
         if (todo == null) {
-            todo = new java.util.HashSet();
+            todo = new java.util.HashSet<Resolvable>();
             unresolvedIDRefs.put(idref, todo);
         }
         // add Resolvable object to this HashSet

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/LineArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/LineArea.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/LineArea.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/LineArea.java Thu Feb 10 14:09:42 2011
@@ -24,7 +24,11 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.fop.area.inline.InlineArea;
-import org.apache.fop.fo.Constants;
+
+import static org.apache.fop.fo.Constants.EN_START;
+import static org.apache.fop.fo.Constants.EN_CENTER;
+import static org.apache.fop.fo.Constants.EN_END;
+import static org.apache.fop.fo.Constants.EN_JUSTIFY;
 
 /**
  * The line area.
@@ -75,7 +79,7 @@ public class LineArea extends Area {
     // this class can contain the dominant char styling info
     // this means that many renderers can optimise a bit
 
-    private List inlineAreas = new ArrayList();
+    private List<InlineArea> inlineAreas = new ArrayList<InlineArea>();
 
     /**
      * default constructor:
@@ -102,11 +106,12 @@ public class LineArea extends Area {
      *
      * @param childArea the inline child area to add
      */
+    @Override
     public void addChildArea(Area childArea) {
         if (childArea instanceof InlineArea) {
             addInlineArea((InlineArea)childArea);
             // set the parent area for the child area
-            ((InlineArea) childArea).setParentArea(this);
+            ((InlineArea)childArea).setParentArea(this);
         }
     }
 
@@ -150,8 +155,8 @@ public class LineArea extends Area {
         int ipd = 0;
         int bpd = 0;
         for (int i = 0, len = inlineAreas.size(); i < len; i++) {
-            ipd = Math.max(ipd, ((InlineArea)inlineAreas.get(i)).getAllocIPD());
-            bpd += ((InlineArea)inlineAreas.get(i)).getAllocBPD();
+            ipd = Math.max(ipd, inlineAreas.get(i).getAllocIPD());
+            bpd += inlineAreas.get(i).getAllocBPD();
         }
         setIPD(ipd);
         setBPD(bpd);
@@ -174,18 +179,18 @@ public class LineArea extends Area {
      */
     public void handleIPDVariation(int ipdVariation) {
         switch (adjustingInfo.lineAlignment) {
-            case Constants.EN_START:
+            case EN_START:
                 // nothing to do in this case
                 break;
-            case Constants.EN_CENTER:
+            case EN_CENTER:
                 // re-compute indent
-                addTrait(Trait.START_INDENT, new Integer(getStartIndent() - ipdVariation / 2));
+                addTrait(Trait.START_INDENT, getStartIndent() - ipdVariation / 2);
                 break;
-            case Constants.EN_END:
+            case EN_END:
                 // re-compute indent
-                addTrait(Trait.START_INDENT, new Integer(getStartIndent() - ipdVariation));
+                addTrait(Trait.START_INDENT, getStartIndent() - ipdVariation);
                 break;
-            case Constants.EN_JUSTIFY:
+            case EN_JUSTIFY:
                 // compute variation factor
                 adjustingInfo.variationFactor *= (float) (adjustingInfo.difference - ipdVariation)
                         / adjustingInfo.difference;
@@ -207,7 +212,7 @@ public class LineArea extends Area {
      * no UnresolvedAreas left
      */
     public void finalise() {
-        if (adjustingInfo.lineAlignment == Constants.EN_JUSTIFY) {
+        if (adjustingInfo.lineAlignment == EN_JUSTIFY) {
             if (log.isTraceEnabled()) {
                 log.trace("Applying variation factor to justified line: " + adjustingInfo);
             }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/LinkResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/LinkResolver.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/LinkResolver.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/LinkResolver.java Thu Feb 10 14:09:42 2011
@@ -23,12 +23,6 @@ package org.apache.fop.area;
 import java.util.List;
 import java.io.Serializable;
 
-// FOP
-import org.apache.fop.area.Trait;
-import org.apache.fop.area.Resolvable;
-import org.apache.fop.area.PageViewport;
-import org.apache.fop.area.Area;
-
 /**
  * Link resolving for resolving internal links.
  */
@@ -72,8 +66,8 @@ public class LinkResolver implements Res
      *
      * {@inheritDoc}
      */
-    public void resolveIDRef(String id, List pages) {
-        resolveIDRef(id, (PageViewport)pages.get(0));
+    public void resolveIDRef(String id, List<PageViewport> pages) {
+        resolveIDRef(id, pages.get(0));
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/MainReference.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/MainReference.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/MainReference.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/MainReference.java Thu Feb 10 14:09:42 2011
@@ -34,7 +34,7 @@ public class MainReference extends Area 
     private static final long serialVersionUID = 7635126485620012448L;
 
     private BodyRegion parent;
-    private List spanAreas = new java.util.ArrayList();
+    private List<Span> spanAreas = new java.util.ArrayList<Span>();
     private boolean isEmpty = true;
 
     /**
@@ -59,7 +59,7 @@ public class MainReference extends Area 
             spanAreas.remove(spanAreas.size() - 1);
         }
         RegionViewport rv = parent.getRegionViewport();
-        int ipdWidth = (int) parent.getIPD()
+        int ipdWidth = parent.getIPD()
             - rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd();
 
         Span newSpan = new Span(((spanAll) ? 1 : getColumnCount()),
@@ -84,8 +84,8 @@ public class MainReference extends Area 
      *
      * @param spans content already laid out
      */
-    public void setSpans(List spans) {
-        spanAreas = new ArrayList(spans);
+    public void setSpans(List<Span> spans) {
+        spanAreas = new ArrayList<Span>(spans);
     }
 
     /**
@@ -93,7 +93,7 @@ public class MainReference extends Area 
      * @return the active span.
      */
     public Span getCurrentSpan() {
-        return (Span) spanAreas.get(spanAreas.size() - 1);
+        return spanAreas.get(spanAreas.size() - 1);
     }
 
     /**
@@ -103,16 +103,13 @@ public class MainReference extends Area 
      * @return true if no child areas have been added yet.
      */
     public boolean isEmpty() {
-        if (isEmpty) {
-            boolean nonEmptyFound = false;
-            if (spanAreas != null) {
-                for (Iterator spaniter = spanAreas.iterator(); spaniter.hasNext();) {
-                    Span spanArea = (Span) spaniter.next();
-                    nonEmptyFound |= !spanArea.isEmpty();
+        if (isEmpty && spanAreas != null) {
+            for (Span spanArea : spanAreas) {
+                if (!spanArea.isEmpty()) {
+                    isEmpty = false;
+                    break;
                 }
             }
-
-            isEmpty = !nonEmptyFound;
         }
         return isEmpty;
     }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Page.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Page.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Page.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Page.java Thu Feb 10 14:09:42 2011
@@ -22,19 +22,26 @@ package org.apache.fop.area;
 import java.awt.Rectangle;
 import java.awt.geom.Rectangle2D;
 import java.io.Serializable;
-import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.fop.datatypes.FODimension;
 import org.apache.fop.datatypes.LengthBase;
 import org.apache.fop.datatypes.SimplePercentBaseContext;
-import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.pagination.Region;
 import org.apache.fop.fo.pagination.RegionBody;
 import org.apache.fop.fo.pagination.SimplePageMaster;
 import org.apache.fop.fo.properties.CommonMarginBlock;
 import org.apache.fop.layoutmgr.TraitSetter;
 
+import static org.apache.fop.fo.Constants.FO_REGION_AFTER;
+import static org.apache.fop.fo.Constants.FO_REGION_BEFORE;
+import static org.apache.fop.fo.Constants.FO_REGION_BODY;
+import static org.apache.fop.fo.Constants.FO_REGION_END;
+import static org.apache.fop.fo.Constants.FO_REGION_START;
+import static org.apache.fop.fo.Constants.EN_ERROR_IF_OVERFLOW;
+import static org.apache.fop.fo.Constants.EN_HIDDEN;
+
 /**
  * The page.
  * This holds the contents of the page. Each region is added.
@@ -58,7 +65,7 @@ public class Page extends AreaTreeObject
     private RegionViewport regionAfter = null;
 
     // temporary map of unresolved objects used when serializing the page
-    private Map unresolved = null;
+    private Map<String, List<Resolvable>> unresolved = null;
 
     /** Set to true to make this page behave as if it were not empty. */
     private boolean fakeNonEmpty = false;
@@ -119,12 +126,10 @@ public class Page extends AreaTreeObject
             spm.getWritingMode(), pageRefRect, reldims);
 
         // Create a RegionViewport/ reference area pair for each page region
-        RegionReference rr = null;
-        for (Iterator regenum = spm.getRegions().values().iterator();
-            regenum.hasNext();) {
-            Region r = (Region)regenum.next();
+        RegionReference rr;
+        for (Region r : spm.getRegions().values()) {
             RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM);
-            if (r.getNameId() == Constants.FO_REGION_BODY) {
+            if (r.getNameId() == FO_REGION_BODY) {
                 rr = new BodyRegion((RegionBody) r, rvp);
             } else {
                 rr = new RegionReference(r, rvp);
@@ -155,7 +160,7 @@ public class Page extends AreaTreeObject
      * @param pageCTM page coordinate transformation matrix
      * @return the new region viewport
      */
-    private RegionViewport makeRegionViewport(Region r, FODimension reldims, CTM pageCTM) {
+    private static RegionViewport makeRegionViewport(Region r, FODimension reldims, CTM pageCTM) {
         Rectangle2D relRegionRect = r.getViewportRectangle(reldims);
         Rectangle2D absRegionRect = pageCTM.transform(relRegionRect);
         // Get the region viewport rectangle in absolute coords by
@@ -164,8 +169,8 @@ public class Page extends AreaTreeObject
         rv.setBPD((int)relRegionRect.getHeight());
         rv.setIPD((int)relRegionRect.getWidth());
         TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground(), null);
-        rv.setClip(r.getOverflow() == Constants.EN_HIDDEN
-                || r.getOverflow() == Constants.EN_ERROR_IF_OVERFLOW);
+        rv.setClip(r.getOverflow() == EN_HIDDEN
+                || r.getOverflow() == EN_ERROR_IF_OVERFLOW);
         return rv;
     }
 
@@ -180,7 +185,7 @@ public class Page extends AreaTreeObject
      * where x=distance from left, y=distance from bottom, width=right-left
      * height=top-bottom
      */
-    private void setRegionReferencePosition(RegionReference rr, Region r,
+    private static void setRegionReferencePosition(RegionReference rr, Region r,
                                   Rectangle2D absRegVPRect) {
         FODimension reldims = new FODimension(0, 0);
         rr.setCTM(CTM.getCTMandRelDims(r.getReferenceOrientation(),
@@ -200,15 +205,15 @@ public class Page extends AreaTreeObject
      * @param port the region viewport to set
      */
     public void setRegionViewport(int areaclass, RegionViewport port) {
-        if (areaclass == Constants.FO_REGION_BEFORE) {
+        if (areaclass == FO_REGION_BEFORE) {
             regionBefore = port;
-        } else if (areaclass == Constants.FO_REGION_START) {
+        } else if (areaclass == FO_REGION_START) {
             regionStart = port;
-        } else if (areaclass == Constants.FO_REGION_BODY) {
+        } else if (areaclass == FO_REGION_BODY) {
             regionBody = port;
-        } else if (areaclass == Constants.FO_REGION_END) {
+        } else if (areaclass == FO_REGION_END) {
             regionEnd = port;
-        } else if (areaclass == Constants.FO_REGION_AFTER) {
+        } else if (areaclass == FO_REGION_AFTER) {
             regionAfter = port;
         }
     }
@@ -221,15 +226,15 @@ public class Page extends AreaTreeObject
      */
     public RegionViewport getRegionViewport(int areaClass) {
         switch (areaClass) {
-        case Constants.FO_REGION_BEFORE:
+        case FO_REGION_BEFORE:
             return regionBefore;
-        case Constants.FO_REGION_START:
+        case FO_REGION_START:
             return regionStart;
-        case Constants.FO_REGION_BODY:
+        case FO_REGION_BODY:
             return regionBody;
-        case Constants.FO_REGION_END:
+        case FO_REGION_END:
             return regionEnd;
-        case Constants.FO_REGION_AFTER:
+        case FO_REGION_AFTER:
             return regionAfter;
         default:
             throw new IllegalArgumentException("No such area class with ID = " + areaClass);
@@ -284,7 +289,7 @@ public class Page extends AreaTreeObject
      *
      * @param unres the Map of unresolved objects
      */
-    public void setUnresolvedReferences(Map unres) {
+    public void setUnresolvedReferences(Map<String, List<Resolvable>> unres) {
         unresolved = unres;
     }
 
@@ -295,7 +300,7 @@ public class Page extends AreaTreeObject
      *
      * @return the de-serialized HashMap of unresolved objects
      */
-    public Map getUnresolvedReferences() {
+    public Map<String, List<Resolvable>> getUnresolvedReferences() {
         return unresolved;
     }
 

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/PageSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/PageSequence.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/PageSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/PageSequence.java Thu Feb 10 14:09:42 2011
@@ -26,7 +26,7 @@ import java.util.List;
  */
 public class PageSequence extends AreaTreeObject {
 
-    private List pages = new java.util.ArrayList();
+    private List<PageViewport> pages = new java.util.ArrayList<PageViewport>();
     private LineArea title;
     private String language;
     private String country;
@@ -75,7 +75,7 @@ public class PageSequence extends AreaTr
      * @return the requested page or null if it was not found
      */
     public PageViewport getPage(int idx) {
-        return (PageViewport)this.pages.get(idx);
+        return this.pages.get(idx);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/PageViewport.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/PageViewport.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/PageViewport.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/PageViewport.java Thu Feb 10 14:09:42 2011
@@ -25,7 +25,6 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -33,9 +32,15 @@ import java.util.Set;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.flow.Marker;
 import org.apache.fop.fo.pagination.SimplePageMaster;
 
+import static org.apache.fop.fo.Constants.FO_REGION_BODY;
+import static org.apache.fop.fo.Constants.EN_FSWP;
+import static org.apache.fop.fo.Constants.EN_FIC;
+import static org.apache.fop.fo.Constants.EN_LSWP;
+import static org.apache.fop.fo.Constants.EN_LEWP;
+
 /**
  * Page viewport that specifies the viewport area and holds the page contents.
  * This is the top level object for a page and remains valid for the life
@@ -63,26 +68,24 @@ public class PageViewport extends AreaTr
 
     private transient PageSequence pageSequence;
 
-    // list of id references and the rectangle on the page
-    //private Map idReferences = null;
-
     // set of IDs that appear first (or exclusively) on this page:
-    private Set idFirsts = new java.util.HashSet();
+    private Set<String> idFirsts = new java.util.HashSet<String>();
 
     // this keeps a list of currently unresolved areas or extensions
     // once an idref is resolved it is removed
     // when this is empty the page can be rendered
-    private Map unresolvedIDRefs = new java.util.HashMap();
+    private Map<String, List<Resolvable>> unresolvedIDRefs
+            = new java.util.HashMap<String, List<Resolvable>>();
 
-    private Map pendingResolved = null;
+    private Map<String, List<PageViewport>> pendingResolved = null;
 
     // hashmap of markers for this page
     // start and end are added by the fo that contains the markers
-    private Map markerFirstStart = null;
-    private Map markerLastStart = null;
-    private Map markerFirstAny = null;
-    private Map markerLastEnd = null;
-    private Map markerLastAny = null;
+    private Map<String, Marker> markerFirstStart = null;
+    private Map<String, Marker> markerLastStart = null;
+    private Map<String, Marker> markerFirstAny = null;
+    private Map<String, Marker> markerLastEnd = null;
+    private Map<String, Marker> markerLastAny = null;
 
     /**
      * logging instance
@@ -254,8 +257,8 @@ public class PageViewport extends AreaTr
 
     /**
      * Add an "ID-first" to this page.
-     * This is typically called by the AreaTreeHandler when associating
-     * an ID with a PageViewport.
+     * This is typically called by the {@link AreaTreeHandler} when associating
+     * an ID with a {@link PageViewport}.
      *
      * @param id the id to be registered as first appearing on this page
      */
@@ -277,9 +280,9 @@ public class PageViewport extends AreaTr
 
     /**
      * Add an idref to this page.
-     * All idrefs found for child areas of this PageViewport are added
-     * to unresolvedIDRefs, for subsequent resolution by AreaTreeHandler
-     * calls to this object's resolveIDRef().
+     * All idrefs found for child areas of this {@link PageViewport} are added
+     * to unresolvedIDRefs, for subsequent resolution by {@link AreaTreeHandler}
+     * calls to this object's {@code resolveIDRef()}.
      *
      * @param idref the idref
      * @param res the child element of this page that needs this
@@ -287,14 +290,14 @@ public class PageViewport extends AreaTr
      */
     public void addUnresolvedIDRef(String idref, Resolvable res) {
         if (unresolvedIDRefs == null) {
-            unresolvedIDRefs = new HashMap();
+            unresolvedIDRefs = new HashMap<String, List<Resolvable>>();
         }
-        List list = (List)unresolvedIDRefs.get(idref);
-        if (list == null) {
-            list = new ArrayList();
-            unresolvedIDRefs.put(idref, list);
+        List<Resolvable> pageViewports = unresolvedIDRefs.get(idref);
+        if (pageViewports == null) {
+            pageViewports = new ArrayList<Resolvable>();
+            unresolvedIDRefs.put(idref, pageViewports);
         }
-        list.add(res);
+        pageViewports.add(res);
     }
 
     /**
@@ -312,24 +315,22 @@ public class PageViewport extends AreaTr
      */
     public String[] getIDRefs() {
         return (unresolvedIDRefs == null) ? null
-            : (String[]) unresolvedIDRefs.keySet().toArray(new String[] {});
+            : unresolvedIDRefs.keySet().toArray(
+                new String[unresolvedIDRefs.keySet().size()]);
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public void resolveIDRef(String id, List pages) {
+    /** {@inheritDoc} */
+    public void resolveIDRef(String id, List<PageViewport> pages) {
         if (page == null) {
             if (pendingResolved == null) {
-                pendingResolved = new HashMap();
+                pendingResolved = new HashMap<String, List<PageViewport>>();
             }
             pendingResolved.put(id, pages);
         } else {
             if (unresolvedIDRefs != null) {
-                List todo = (List)unresolvedIDRefs.get(id);
+                List<Resolvable> todo = unresolvedIDRefs.get(id);
                 if (todo != null) {
-                    for (int count = 0; count < todo.size(); count++) {
-                        Resolvable res = (Resolvable)todo.get(count);
+                    for (Resolvable res : todo) {
                         res.resolveIDRef(id, pages);
                     }
                 }
@@ -363,7 +364,7 @@ public class PageViewport extends AreaTr
      * @param isfirst if the area being added has is-first trait
      * @param islast if the area being added has is-last trait
      */
-    public void addMarkers(Map marks, boolean starting,
+    public void addMarkers(Map<String, Marker> marks, boolean starting,
             boolean isfirst, boolean islast) {
 
         if (marks == null) {
@@ -380,14 +381,13 @@ public class PageViewport extends AreaTr
         if (starting) {
             if (isfirst) {
                 if (markerFirstStart == null) {
-                    markerFirstStart = new HashMap();
+                    markerFirstStart = new HashMap<String, Marker>();
                 }
                 if (markerFirstAny == null) {
-                    markerFirstAny = new HashMap();
+                    markerFirstAny = new HashMap<String, Marker>();
                 }
                 // first on page: only put in new values, leave current
-                for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) {
-                    Object key = iter.next();
+                for (String key : marks.keySet()) {
                     if (!markerFirstStart.containsKey(key)) {
                         markerFirstStart.put(key, marks.get(key));
                         if (log.isTraceEnabled()) {
@@ -404,7 +404,7 @@ public class PageViewport extends AreaTr
                     }
                 }
                 if (markerLastStart == null) {
-                    markerLastStart = new HashMap();
+                    markerLastStart = new HashMap<String, Marker>();
                 }
                 // last on page: replace all
                 markerLastStart.putAll(marks);
@@ -414,11 +414,10 @@ public class PageViewport extends AreaTr
                 }
             } else {
                 if (markerFirstAny == null) {
-                    markerFirstAny = new HashMap();
+                    markerFirstAny = new HashMap<String, Marker>();
                 }
                 // first on page: only put in new values, leave current
-                for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) {
-                    Object key = iter.next();
+                for (String key : marks.keySet()) {
                     if (!markerFirstAny.containsKey(key)) {
                         markerFirstAny.put(key, marks.get(key));
                         if (log.isTraceEnabled()) {
@@ -432,7 +431,7 @@ public class PageViewport extends AreaTr
             // at the end of the area, register is-last and any areas
             if (islast) {
                 if (markerLastEnd == null) {
-                    markerLastEnd = new HashMap();
+                    markerLastEnd = new HashMap<String, Marker>();
                 }
                 // last on page: replace all
                 markerLastEnd.putAll(marks);
@@ -442,7 +441,7 @@ public class PageViewport extends AreaTr
                 }
             }
             if (markerLastAny == null) {
-                markerLastAny = new HashMap();
+                markerLastAny = new HashMap<String, Marker>();
             }
             // last on page: replace all
             markerLastAny.putAll(marks);
@@ -462,11 +461,11 @@ public class PageViewport extends AreaTr
      * @param pos the position to retrieve
      * @return Object the marker found or null
      */
-    public Object getMarker(String name, int pos) {
-        Object mark = null;
+    public Marker getMarker(String name, int pos) {
+        Marker mark = null;
         String posName = null;
         switch (pos) {
-            case Constants.EN_FSWP:
+            case EN_FSWP:
                 if (markerFirstStart != null) {
                     mark = markerFirstStart.get(name);
                     posName = "FSWP";
@@ -476,13 +475,13 @@ public class PageViewport extends AreaTr
                     posName = "FirstAny after " + posName;
                 }
             break;
-            case Constants.EN_FIC:
+            case EN_FIC:
                 if (markerFirstAny != null) {
                     mark = markerFirstAny.get(name);
                     posName = "FIC";
                 }
             break;
-            case Constants.EN_LSWP:
+            case EN_LSWP:
                 if (markerLastStart != null) {
                     mark = markerLastStart.get(name);
                     posName = "LSWP";
@@ -492,7 +491,7 @@ public class PageViewport extends AreaTr
                     posName = "LastAny after " + posName;
                 }
             break;
-            case Constants.EN_LEWP:
+            case EN_LEWP:
                 if (markerLastEnd != null) {
                     mark = markerLastEnd.get(name);
                     posName = "LEWP";
@@ -503,7 +502,7 @@ public class PageViewport extends AreaTr
                 }
             break;
             default:
-                throw new RuntimeException();
+                assert false;
         }
         if (log.isTraceEnabled()) {
             log.trace("page " + pageNumberString + ": " + "Retrieving marker " + name
@@ -550,10 +549,8 @@ public class PageViewport extends AreaTr
         page = (Page) in.readObject();
         unresolvedIDRefs = page.getUnresolvedReferences();
         if (unresolvedIDRefs != null && pendingResolved != null) {
-            for (Iterator iter = pendingResolved.keySet().iterator();
-                         iter.hasNext();) {
-                String id = (String) iter.next();
-                resolveIDRef(id, (List)pendingResolved.get(id));
+            for (String id : pendingResolved.keySet()) {
+                resolveIDRef(id, pendingResolved.get(id));
             }
             pendingResolved = null;
         }
@@ -577,9 +574,8 @@ public class PageViewport extends AreaTr
         page = null;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
+    @Override
     public String toString() {
         StringBuffer sb = new StringBuffer(64);
         sb.append("PageViewport: page=");
@@ -602,8 +598,7 @@ public class PageViewport extends AreaTr
      * @return BodyRegion object
      */
     public BodyRegion getBodyRegion() {
-        return (BodyRegion) getPage().getRegionViewport(
-                Constants.FO_REGION_BODY).getRegionReference();
+        return (BodyRegion) getPage().getRegionViewport(FO_REGION_BODY).getRegionReference();
     }
 
     /**
@@ -659,5 +654,4 @@ public class PageViewport extends AreaTr
     public RegionReference getRegionReference(int id) {
         return getPage().getRegionViewport(id).getRegionReference();
     }
-
 }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/RegionReference.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/RegionReference.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/RegionReference.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/RegionReference.java Thu Feb 10 14:09:42 2011
@@ -38,7 +38,7 @@ public class RegionReference extends Are
     private CTM ctm;
 
     // the list of block areas from the static flow
-    private ArrayList blocks = new ArrayList();
+    private ArrayList<Area> blocks = new ArrayList<Area>();
 
     /** the parent {@link RegionViewport} for this object */
     protected RegionViewport regionViewport;
@@ -68,6 +68,7 @@ public class RegionReference extends Are
     }
 
     /** {@inheritDoc} */
+    @Override
     public void addChildArea(Area child) {
         blocks.add(child);
     }
@@ -106,7 +107,7 @@ public class RegionReference extends Are
      *
      * @return the list of blocks in this region
      */
-    public List getBlocks() {
+    public List<Area> getBlocks() {
         return blocks;
     }
 
@@ -143,11 +144,12 @@ public class RegionReference extends Are
         RegionReference rr = new RegionReference(regionClass, regionName, regionViewport);
         rr.ctm = ctm;
         rr.setIPD(getIPD());
-        rr.blocks = (ArrayList)blocks.clone();
+        rr.blocks = (ArrayList<Area>)blocks.clone();
         return rr;
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         StringBuffer sb = new StringBuffer(super.toString());
         sb.append(" {regionName=").append(regionName);

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/RenderPagesModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/RenderPagesModel.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/RenderPagesModel.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/RenderPagesModel.java Thu Feb 10 14:09:42 2011
@@ -50,9 +50,10 @@ public class RenderPagesModel extends Ar
     /**
      * Pages that have been prepared but not rendered yet.
      */
-    protected List/*<PageViewport>*/ prepared = new java.util.ArrayList/*<PageViewport>*/();
-    private List/*<OffDocumentItem>*/ pendingODI = new java.util.ArrayList/*<OffDocumentItem>*/();
-    private List/*<OffDocumentItem>*/ endDocODI = new java.util.ArrayList/*<OffDocumentItem>*/();
+    protected List<PageViewport> prepared = new java.util.ArrayList<PageViewport>();
+
+    private List<OffDocumentItem> pendingODI = new java.util.ArrayList<OffDocumentItem>();
+    private List<OffDocumentItem> endDocODI = new java.util.ArrayList<OffDocumentItem>();
 
     /**
      * Create a new render pages model with the given renderer.
@@ -83,6 +84,7 @@ public class RenderPagesModel extends Ar
     }
 
     /** {@inheritDoc} */
+    @Override
     public void startPageSequence(PageSequence pageSequence) {
         super.startPageSequence(pageSequence);
         if (renderer.supportsOutOfOrder()) {
@@ -98,6 +100,7 @@ public class RenderPagesModel extends Ar
      * the page is added to a queue.
      * @param page the page to add to the model
      */
+    @Override
     public void addPage(PageViewport page) {
         super.addPage(page);
 
@@ -152,14 +155,15 @@ public class RenderPagesModel extends Ar
      *         false if the renderer doesn't support out of order
      *         rendering and there are pending pages
      */
-    protected boolean checkPreparedPages(PageViewport newPageViewport, boolean
-        renderUnresolved) {
+    protected boolean checkPreparedPages(PageViewport newPageViewport,
+                                         boolean renderUnresolved) {
+
         for (Iterator iter = prepared.iterator(); iter.hasNext();) {
             PageViewport pageViewport = (PageViewport)iter.next();
             if (pageViewport.isResolved() || renderUnresolved) {
                 if (!renderer.supportsOutOfOrder()
                         && pageViewport.getPageSequence().isFirstPage(pageViewport)) {
-                    renderer.startPageSequence(getCurrentPageSequence());
+                    renderer.startPageSequence(pageViewport.getPageSequence());
                 }
                 renderPage(pageViewport);
                 pageViewport.clear();
@@ -183,11 +187,11 @@ public class RenderPagesModel extends Ar
             renderer.renderPage(pageViewport);
             if (!pageViewport.isResolved()) {
                 String[] idrefs = pageViewport.getIDRefs();
-                for (int count = 0; count < idrefs.length; count++) {
+                for (String idref : idrefs) {
                     AreaEventProducer eventProducer = AreaEventProducer.Provider.get(
                             renderer.getUserAgent().getEventBroadcaster());
                     eventProducer.unresolvedIDReferenceOnPage(this,
-                            pageViewport.getPageNumberString(), idrefs[count]);
+                            pageViewport.getPageNumberString(), idref);
                 }
             }
         } catch (Exception e) {
@@ -214,9 +218,8 @@ public class RenderPagesModel extends Ar
         prepared.add(page);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
+    @Override
     public void handleOffDocumentItem(OffDocumentItem oDI) {
         switch(oDI.getWhenToProcess()) {
             case OffDocumentItem.IMMEDIATELY:
@@ -233,9 +236,8 @@ public class RenderPagesModel extends Ar
         }
     }
 
-    private void processOffDocumentItems(List list) {
-        for (int count = 0; count < list.size(); count++) {
-            OffDocumentItem oDI = (OffDocumentItem)list.get(count);
+    private void processOffDocumentItems(List<OffDocumentItem> list) {
+        for (OffDocumentItem oDI : list) {
             renderer.processOffDocumentItem(oDI);
         }
     }
@@ -244,6 +246,7 @@ public class RenderPagesModel extends Ar
      * End the document. Render any end document OffDocumentItems
      * {@inheritDoc}
      */
+    @Override
     public void endDocument() throws SAXException {
         // render any pages that had unresolved ids
         checkPreparedPages(null, true);

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Resolvable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Resolvable.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Resolvable.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Resolvable.java Thu Feb 10 14:09:42 2011
@@ -59,5 +59,5 @@ public interface Resolvable {
      * @param pages the list of PageViewports with the given ID
      *
      */
-    void resolveIDRef(String id, List pages);
+    void resolveIDRef(String id, List<PageViewport> pages);
 }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Span.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Span.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Span.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Span.java Thu Feb 10 14:09:42 2011
@@ -34,7 +34,7 @@ public class Span extends Area {
     private static final long serialVersionUID = -5551430053660081549L;
 
     // the list of flow reference areas in this span area
-    private List flowAreas;
+    private List<NormalFlow> flowAreas;
     private int colCount;
     private int colGap;
     private int colWidth; // width for each normal flow, calculated value
@@ -60,7 +60,7 @@ public class Span extends Area {
      * Create the normal flows for this Span
      */
     private void createNormalFlows() {
-        flowAreas = new java.util.ArrayList(colCount);
+        flowAreas = new java.util.ArrayList<NormalFlow>(colCount);
         colWidth = (ipd - ((colCount - 1) * colGap)) / colCount;
 
         for (int i = 0; i < colCount; i++) {
@@ -105,7 +105,7 @@ public class Span extends Area {
      */
     public NormalFlow getNormalFlow(int colRequested) {
         if (colRequested >= 0 && colRequested < colCount) {
-            return (NormalFlow) flowAreas.get(colRequested);
+            return flowAreas.get(colRequested);
         } else { // internal error
             throw new IllegalArgumentException("Invalid column number "
                     + colRequested + " requested; only 0-" + (colCount - 1)
@@ -184,6 +184,7 @@ public class Span extends Area {
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         StringBuffer sb = new StringBuffer(super.toString());
         if (colCount > 1) {

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Trait.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Trait.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Trait.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/Trait.java Thu Feb 10 14:09:42 2011
@@ -24,11 +24,15 @@ import java.io.Serializable;
 
 import org.apache.xmlgraphics.image.loader.ImageInfo;
 
-import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.FontTriplet;
 import org.apache.fop.traits.BorderProps;
 import org.apache.fop.util.ColorUtil;
 
+import static org.apache.fop.fo.Constants.EN_REPEAT;
+import static org.apache.fop.fo.Constants.EN_REPEATX;
+import static org.apache.fop.fo.Constants.EN_REPEATY;
+import static org.apache.fop.fo.Constants.EN_NOREPEAT;
+
 // properties should be serialized by the holder
 /**
  * Area traits used for rendering.
@@ -142,8 +146,10 @@ public final class Trait implements Seri
 
     /** Trait for color of underline decorations when rendering inline parent. */
     public static final Integer UNDERLINE_COLOR = 34;
+
     /** Trait for color of overline decorations when rendering inline parent. */
     public static final Integer OVERLINE_COLOR = 35;
+
     /** Trait for color of linethrough decorations when rendering inline parent. */
     public static final Integer LINETHROUGH_COLOR = 36;
 
@@ -367,6 +373,7 @@ public final class Trait implements Seri
          * Return the human-friendly string for debugging.
          * {@inheritDoc}
          */
+        @Override
         public String toString() {
             StringBuffer sb = new StringBuffer();
             sb.append("pvKey=").append(pvKey);
@@ -441,6 +448,7 @@ public final class Trait implements Seri
          * @return  a <code>String</code> of the form
          *          "org.apache.fop.area.Trait.ExternalLink[dest=someURL,newWindow=false]"
          */
+        @Override
         public String toString() {
             StringBuffer sb = new StringBuffer(64);
             sb.append("newWindow=").append(newWindow);
@@ -581,23 +589,23 @@ public final class Trait implements Seri
 
         private String getRepeatString() {
             switch (getRepeat()) {
-            case Constants.EN_REPEAT: return "repeat";
-            case Constants.EN_REPEATX: return "repeat-x";
-            case Constants.EN_REPEATY: return "repeat-y";
-            case Constants.EN_NOREPEAT: return "no-repeat";
+            case EN_REPEAT: return "repeat";
+            case EN_REPEATX: return "repeat-x";
+            case EN_REPEATY: return "repeat-y";
+            case EN_NOREPEAT: return "no-repeat";
             default: throw new IllegalStateException("Illegal repeat style: " + getRepeat());
             }
         }
 
         private static int getConstantForRepeat(String repeat) {
             if ("repeat".equalsIgnoreCase(repeat)) {
-                return Constants.EN_REPEAT;
+                return EN_REPEAT;
             } else if ("repeat-x".equalsIgnoreCase(repeat)) {
-                return Constants.EN_REPEATX;
+                return EN_REPEATX;
             } else if ("repeat-y".equalsIgnoreCase(repeat)) {
-                return Constants.EN_REPEATY;
+                return EN_REPEATY;
             } else if ("no-repeat".equalsIgnoreCase(repeat)) {
-                return Constants.EN_NOREPEAT;
+                return EN_NOREPEAT;
             } else {
                 throw new IllegalStateException("Illegal repeat style: " + repeat);
             }
@@ -607,6 +615,7 @@ public final class Trait implements Seri
          * Return the string for debugging.
          * {@inheritDoc}
          */
+        @Override
         public String toString() {
             StringBuffer sb = new StringBuffer();
             if (color != null) {

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/Container.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/Container.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/Container.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/Container.java Thu Feb 10 14:09:42 2011
@@ -38,7 +38,7 @@ public class Container extends Area {
     /**
      * The list of block areas stacked inside this container
      */
-    protected List blocks = new ArrayList();
+    protected List<Block> blocks = new ArrayList<Block>();
 
     /**
      * The width of this container

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/FilledArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/FilledArea.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/FilledArea.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/FilledArea.java Thu Feb 10 14:09:42 2011
@@ -39,9 +39,7 @@ public class FilledArea extends InlinePa
 
     private int unitWidth;
 
-    /**
-     * Create a new filled area.
-     */
+    /** Create a new filled area. */
     public FilledArea() {
     }
 
@@ -88,13 +86,11 @@ public class FilledArea extends InlinePa
         return this.unitWidth;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
+    @Override
     public int getBPD() {
         int bpd = 0;
-        for (Iterator childAreaIt = getChildAreas().iterator(); childAreaIt.hasNext();) {
-            InlineArea area = (InlineArea)childAreaIt.next();
+        for (InlineArea area : getChildAreas()) {
             if (bpd < area.getBPD()) {
                 bpd = area.getBPD();
             }
@@ -110,9 +106,10 @@ public class FilledArea extends InlinePa
      *
      * @return the list of child areas copied to fill the width
      */
-    public List getChildAreas() {
-        int units = (int)(getIPD() / unitWidth);
-        List newList = new ArrayList();
+    @Override
+    public List<InlineArea> getChildAreas() {
+        int units = getIPD() / unitWidth;
+        List<InlineArea> newList = new ArrayList<InlineArea>();
         for (int count = 0; count < units; count++) {
             newList.addAll(inlines);
         }
@@ -126,6 +123,7 @@ public class FilledArea extends InlinePa
      * @param lineShrink      the total shrink of the line
      * @return true if there is an UnresolvedArea descendant
      */
+    @Override
     public boolean applyVariationFactor(double variationFactor,
                                         int lineStretch, int lineShrink) {
         setIPD(getIPD() + adjustingInfo.applyVariationFactor(variationFactor));

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/InlineArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/InlineArea.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/InlineArea.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/InlineArea.java Thu Feb 10 14:09:42 2011
@@ -178,6 +178,7 @@ public class InlineArea extends Area {
      *
      * {@inheritDoc}
      */
+    @Override
     public void addChildArea(Area childArea) {
         super.addChildArea(childArea);
         if (childArea instanceof InlineArea) {
@@ -185,9 +186,7 @@ public class InlineArea extends Area {
         }
     }
 
-    /**
-     *@return true if the inline area is underlined.
-     */
+    /** @return true if the inline area is underlined. */
     public boolean hasUnderline() {
         return getTraitAsBoolean(Trait.UNDERLINE);
     }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/InlineBlockParent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/InlineBlockParent.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/InlineBlockParent.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/InlineBlockParent.java Thu Feb 10 14:09:42 2011
@@ -48,6 +48,7 @@ public class InlineBlockParent extends I
      *
      * @param childArea the child area to add
      */
+    @Override
     public void addChildArea(Area childArea) {
         if (child != null) {
             throw new IllegalStateException("InlineBlockParent may have only one child area.");

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/SpaceArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/SpaceArea.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/SpaceArea.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/SpaceArea.java Thu Feb 10 14:09:42 2011
@@ -48,9 +48,7 @@ public class SpaceArea extends InlineAre
         isAdjustable = a;
     }
 
-    /**
-     * @return Returns the space.
-     */
+    /** @return Returns the space. */
     public String getSpace() {
         return String.valueOf(space);
     }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/TextArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/TextArea.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/TextArea.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/TextArea.java Thu Feb 10 14:09:42 2011
@@ -99,20 +99,19 @@ public class TextArea extends AbstractTe
      */
     public String getText() {
         StringBuffer text = new StringBuffer();
-        InlineArea child;
         // assemble the text
-        for (int i = 0; i < inlines.size(); i++) {
-            child = (InlineArea) inlines.get(i);
-            if (child instanceof WordArea) {
-                text.append(((WordArea) child).getWord());
+        for (InlineArea inline : inlines) {
+            if (inline instanceof WordArea) {
+                text.append(((WordArea) inline).getWord());
             } else {
-                text.append(((SpaceArea) child).getSpace());
+                text.append(((SpaceArea) inline).getSpace());
             }
         }
         return text.toString();
     }
 
     /** {@inheritDoc} */
+    @Override
     public String toString() {
         return "TextArea{text=" + getText() + "}";
     }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java Thu Feb 10 14:09:42 2011
@@ -92,18 +92,14 @@ public class UnresolvedPageNumber extend
      * @param id an id whose PageViewports have been determined
      * @param pages the list of PageViewports associated with this ID
      */
-    public void resolveIDRef(String id, List pages) {
+    public void resolveIDRef(String id, List<PageViewport> pages) {
         if (!resolved && pageIDRef.equals(id) && pages != null) {
             if (log.isDebugEnabled()) {
                 log.debug("Resolving pageNumber: " + id);
             }
             resolved = true;
-            PageViewport page;
-            if (pageType == FIRST) {
-                page = (PageViewport)pages.get(0);
-            } else {
-                page = (PageViewport)pages.get(pages.size() - 1);
-            }
+            int pageIndex = pageType ? 0 : pages.size() - 1;
+            PageViewport page = pages.get(pageIndex);
             // replace the text
             removeText();
             text = page.getPageNumberString();
@@ -136,6 +132,7 @@ public class UnresolvedPageNumber extend
      * @param lineShrink      the total shrink of the line
      * @return true if there is an UnresolvedArea descendant
      */
+    @Override
     public boolean applyVariationFactor(double variationFactor,
                                         int lineStretch, int lineShrink) {
         return true;

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/WordArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/WordArea.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/WordArea.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/area/inline/WordArea.java Thu Feb 10 14:09:42 2011
@@ -47,22 +47,18 @@ public class WordArea extends InlineArea
         this.letterAdjust = la;
     }
 
-    /**
-     * @return Returns the word.
-     */
+    /** @return Returns the word. */
     public String getWord() {
         return word;
     }
 
-    /**
-     * @return Returns the offset.
-     */
+    /** @return Returns the offset. */
+    @Override
     public int getOffset() {
         return offset;
     }
-    /**
-     * @param o The offset to set.
-     */
+    /** @param o The offset to set. */
+    @Override
     public void setOffset(int o) {
         offset = o;
     }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/Constants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/Constants.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/Constants.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/Constants.java Thu Feb 10 14:09:42 2011
@@ -778,9 +778,11 @@ public interface Constants {
      * Used for accessibility.
      */
     int PR_X_ALT_TEXT = 275;
+    /** Property constant - FOP proprietary prototype (in XSL-FO 2.0 Requirements) */
+    int PR_X_XML_BASE = 276;
 
     /** Number of property constants defined */
-    int PROPERTY_COUNT = 275;
+    int PROPERTY_COUNT = 276;
 
     // compound property constants
 

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FOPropertyMapping.java Thu Feb 10 14:09:42 2011
@@ -62,8 +62,9 @@ import org.apache.fop.fo.properties.Spac
 import org.apache.fop.fo.properties.SpacingPropertyMaker;
 import org.apache.fop.fo.properties.StringProperty;
 import org.apache.fop.fo.properties.TableBorderPrecedence;
-import org.apache.fop.fo.properties.TextDecorationProperty;
+import org.apache.fop.fo.properties.TextDecorationMaker;
 import org.apache.fop.fo.properties.ToBeImplementedProperty;
+import org.apache.fop.fo.properties.URIProperty;
 import org.apache.fop.fo.properties.VerticalAlignShorthandParser;
 import org.apache.fop.fo.properties.WhiteSpaceShorthandParser;
 import org.apache.fop.fo.properties.XMLLangShorthandParser;
@@ -79,11 +80,11 @@ public final class FOPropertyMapping imp
     private FOPropertyMapping() {
     }
 
-    private static Map propNames = new HashMap();               // CSOK: VisibilityModifier
-    private static Map subPropNames = new HashMap();            // CSOK: VisibilityModifier
-    private static Map propIds = new HashMap();                 // CSOK: VisibilityModifier
+    private static Map<String, Integer> propNames = new HashMap<String, Integer>();
+    private static Map<String, Integer> subPropNames = new HashMap<String, Integer>();
+    private static Map<Integer, String> propIds = new HashMap<Integer, String>();
 
-    private static PropertyMaker[] generics = null;             // CSOK: VisibilityModifier
+    private static PropertyMaker[] generics = null;
 
     // The rest is only used during the building of the generics array.
     private Property[] enums = null;
@@ -246,8 +247,8 @@ public final class FOPropertyMapping imp
      */
     private static void addPropertyMaker(String name, PropertyMaker maker) {
         generics[maker.getPropId()] = maker;
-        propNames.put(name, new Integer(maker.getPropId()));
-        propIds.put(new Integer(maker.getPropId()), name);
+        propNames.put(name, maker.getPropId());
+        propIds.put(maker.getPropId(), name);
     }
 
     /**
@@ -256,8 +257,8 @@ public final class FOPropertyMapping imp
      * @param id   Id for the subproperty from CP_* in Constants.java.
      */
     private static void addSubpropMakerName(String name, int id) {
-        subPropNames.put(name, new Integer(id));
-        propIds.put(new Integer(id), name);
+        subPropNames.put(name, id);
+        propIds.put(id, name);
     }
 
     /**
@@ -342,9 +343,9 @@ public final class FOPropertyMapping imp
      */
     public static int getPropertyId(String name) {
         if (name != null) {
-            Integer i = (Integer) propNames.get(name);
+            Integer i = propNames.get(name);
             if (i != null) {
-                return i.intValue();
+                return i;
             }
         }
         return -1;
@@ -357,9 +358,9 @@ public final class FOPropertyMapping imp
      */
     public static int getSubPropertyId(String name) {
         if (name != null) {
-            Integer i = (Integer) subPropNames.get(name);
+            Integer i = subPropNames.get(name);
             if (i != null) {
-                return i.intValue();
+                return i;
             }
         }
         return -1;
@@ -373,10 +374,10 @@ public final class FOPropertyMapping imp
     public static String getPropertyName(int id) {
         if (((id & Constants.COMPOUND_MASK) == 0)
                 || ((id & Constants.PROPERTY_MASK) == 0)) {
-            return (String) propIds.get(new Integer(id));
+            return propIds.get(id);
         } else {
-            return propIds.get(new Integer(id & Constants.PROPERTY_MASK))
-                    + "." + propIds.get(new Integer(id & Constants.COMPOUND_MASK));
+            return propIds.get(id & Constants.PROPERTY_MASK)
+                    + "." + propIds.get(id & Constants.COMPOUND_MASK);
         }
     }
 
@@ -1694,7 +1695,7 @@ public final class FOPropertyMapping imp
 
         // text-decoration
         //m  = new EnumProperty.Maker(PR_TEXT_DECORATION);
-        m  = new TextDecorationProperty.Maker(PR_TEXT_DECORATION);
+        m  = new TextDecorationMaker(PR_TEXT_DECORATION);
         m.setInherited(false);
         m.addEnum("none", getEnumProperty(EN_NONE, "NONE"));
         m.addEnum("underline", getEnumProperty(EN_UNDERLINE, "UNDERLINE"));
@@ -2572,7 +2573,7 @@ public final class FOPropertyMapping imp
         addPropertyMaker("score-spaces", m);
 
         // src
-        m  = new StringProperty.Maker(PR_SRC);
+        m  = new URIProperty.Maker(PR_SRC);
         m.setInherited(false);
         m.setDefault("");
         addPropertyMaker("src", m);
@@ -2819,6 +2820,12 @@ public final class FOPropertyMapping imp
         m.setDatatypeParser(new XMLLangShorthandParser());
         addPropertyMaker("xml:lang", m);
 
+        // xml:base
+        m  = new URIProperty.Maker(PR_X_XML_BASE);
+        m.setInherited(true);
+        m.setDefault("");
+        addPropertyMaker("xml:base", m);
+
        }
 
 }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FOValidationEventProducer.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FOValidationEventProducer.xml?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FOValidationEventProducer.xml (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FOValidationEventProducer.xml Thu Feb 10 14:09:42 2011
@@ -9,6 +9,7 @@
   <message key="rule.childOfSPM">The element must be a child of fo:simple-page-master.</message>
   <message key="rule.childOfDeclarations">The element must be a child of fo:declarations.</message>
   <message key="rule.childOfSPMorDeclarations">The element must be a child of fo:declarations or fo:simple-page-master.</message>
+  <message key="rule.childOfSPMorPSorDeclarations">The element must be a child of fo:declarations, fo:simple-page-master or fo:page-sequence.</message>
   <message key="rule.childOfInstreamForeignObjectorExternalGraphic">The element must be a child of fo:instream-foreign-object or fo:external-graphic.</message>
   <message key="rule.childOfPageSequence">The element must be a child of fo:page-sequence.</message>
   <message key="rule.childOfPageSequenceOrSPM">The element must be a child of fo:page-sequence or fo:simple-page-master.</message>

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FObj.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/FObj.java Thu Feb 10 14:09:42 2011
@@ -47,16 +47,17 @@ public abstract class FObj extends FONod
     private static final PropertyMaker[] PROPERTY_LIST_TABLE
                             = FOPropertyMapping.getGenericMappings();
 
-    /**
-     * pointer to the descendant subtree
-     */
+    /** pointer to the descendant subtree */
     protected FONode firstChild;
 
+    /** pointer to the end of the descendant subtree */
+    protected FONode lastChild;
+
     /** The list of extension attachments, null if none */
-    private List/*<ExtensionAttachment>*/ extensionAttachments = null;
+    private List<ExtensionAttachment> extensionAttachments = null;
 
     /** The map of foreign attributes, null if none */
-    private Map/*<QName,String>*/ foreignAttributes = null;
+    private Map<QName, String> foreignAttributes = null;
 
     /** Used to indicate if this FO is either an Out Of Line FO (see rec)
      *  or a descendant of one. Used during FO validation.
@@ -197,13 +198,19 @@ public abstract class FObj extends FONod
             } else {
                 if (firstChild == null) {
                     firstChild = child;
+                    lastChild = child;
                 } else {
-                    FONode prevChild = firstChild;
-                    while (prevChild.siblings != null
-                            && prevChild.siblings[1] != null) {
-                        prevChild = prevChild.siblings[1];
+                    if (lastChild == null) {
+                        FONode prevChild = firstChild;
+                        while (prevChild.siblings != null
+                                && prevChild.siblings[1] != null) {
+                            prevChild = prevChild.siblings[1];
+                        }
+                        FONode.attachSiblings(prevChild, child);
+                    } else {
+                        FONode.attachSiblings(lastChild, child);
+                        lastChild = child;
                     }
-                    FONode.attachSiblings(prevChild, child);
                 }
             }
         }
@@ -238,6 +245,13 @@ public abstract class FObj extends FONod
                 nextChild.siblings[0] = prevChild;
             }
         }
+        if (child == lastChild) {
+            if (child.siblings != null) {
+                lastChild = siblings[0];
+            } else {
+                lastChild = null;
+            }
+        }
     }
 
     /**
@@ -421,6 +435,7 @@ public abstract class FObj extends FONod
      * Convenience method for validity checking.  Checks if the
      * incoming node is a member of the "%block;" parameter entity
      * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
+     *
      * @param nsURI namespace URI of incoming node
      * @param lName local name (i.e., no prefix) of incoming node
      * @return true if a member, false if not
@@ -440,6 +455,7 @@ public abstract class FObj extends FONod
      * Convenience method for validity checking.  Checks if the
      * incoming node is a member of the "%inline;" parameter entity
      * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations
+     *
      * @param nsURI namespace URI of incoming node
      * @param lName local name (i.e., no prefix) of incoming node
      * @return true if a member, false if not
@@ -529,7 +545,7 @@ public abstract class FObj extends FONod
 
     /** @return whether this object has an id set */
     public boolean hasId() {
-        return id != null && id.length() > 0;
+        return (id != null && id.length() > 0);
     }
 
     /** {@inheritDoc} */
@@ -554,7 +570,7 @@ public abstract class FObj extends FONod
                     "Parameter attachment must not be null");
         }
         if (extensionAttachments == null) {
-            extensionAttachments = new java.util.ArrayList/*<ExtensionAttachment>*/();
+            extensionAttachments = new java.util.ArrayList<ExtensionAttachment>();
         }
         if (log.isDebugEnabled()) {
             log.debug("ExtensionAttachment of category "
@@ -591,7 +607,7 @@ public abstract class FObj extends FONod
             throw new NullPointerException("Parameter attributeName must not be null");
         }
         if (foreignAttributes == null) {
-            foreignAttributes = new java.util.HashMap/*<QName,String>*/();
+            foreignAttributes = new java.util.HashMap<QName, String>();
         }
         foreignAttributes.put(attributeName, value);
     }
@@ -679,6 +695,9 @@ public abstract class FObj extends FONod
                         && currentNode.siblings[1] != null) {
                     FONode.attachSiblings(newNode, currentNode.siblings[1]);
                 }
+                if (currentNode == parentNode.lastChild) {
+                    parentNode.lastChild = newNode;
+                }
             } else {
                 throw new IllegalStateException();
             }
@@ -694,12 +713,18 @@ public abstract class FObj extends FONod
                 parentNode.firstChild = newNode;
                 currentIndex = 0;
                 currentNode = newNode;
+                if (parentNode.lastChild == null) {
+                    parentNode.lastChild = newNode;
+                }
             } else {
                 if (currentNode.siblings != null
                         && currentNode.siblings[1] != null) {
                     FONode.attachSiblings((FONode) o, currentNode.siblings[1]);
                 }
                 FONode.attachSiblings(currentNode, (FONode) o);
+                if (currentNode == parentNode.lastChild) {
+                    parentNode.lastChild = newNode;
+                }
             }
             flags &= F_NONE_ALLOWED;
         }

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/PropertyList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/PropertyList.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/PropertyList.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/PropertyList.java Thu Feb 10 14:09:42 2011
@@ -264,6 +264,13 @@ public abstract class PropertyList {
         return -1;
     }
 
+    private String addAttributeToList(Attributes attributes,
+                                    String attributeName) throws ValidationException {
+        String attributeValue = attributes.getValue(attributeName);
+        convertAttributeToProperty(attributes, attributeName, attributeValue);
+        return attributeValue;
+    }
+
     /**
      * Adds the attributes, passed in by the parser to the PropertyList
      *
@@ -278,44 +285,35 @@ public abstract class PropertyList {
          * need them before all others (possible from-table-column() on any
          * other property further in the list...
          */
-        String attributeName = "column-number";
-        String attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-            attributeValue);
-        attributeName = "number-columns-spanned";
-        attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-            attributeValue);
+        addAttributeToList(attributes, "column-number");
+        addAttributeToList(attributes, "number-columns-spanned");
 
         /*
          * If font-size is set on this FO, must set it first, since
          * other attributes specified in terms of "ems" depend on it.
          */
-        attributeName = "font";
-        attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName,
-                attributeValue);
-        if (attributeValue == null) {
+        String checkValue = addAttributeToList(attributes, "font");
+        if (checkValue == null || "".equals(checkValue)) {
             /*
              * font shorthand wasn't specified, so still need to process
              * explicit font-size
              */
-            attributeName = "font-size";
-            attributeValue = attributes.getValue(attributeName);
-            convertAttributeToProperty(attributes, attributeName,
-                    attributeValue);
+            addAttributeToList(attributes, "font-size");
         }
 
+        String attributeName;
+        String attributeValue;
         String attributeNS;
         FopFactory factory = getFObj().getUserAgent().getFactory();
         for (int i = 0; i < attributes.getLength(); i++) {
             /* convert all attributes with the same namespace as the fo element
-             * the "xml:lang" property is a special case */
+             * the "xml:lang" and "xml:base" properties are special cases */
             attributeNS = attributes.getURI(i);
             attributeName = attributes.getQName(i);
             attributeValue = attributes.getValue(i);
             if (attributeNS == null || attributeNS.length() == 0
-                    || "xml:lang".equals(attributeName)) {
+                    || "xml:lang".equals(attributeName)
+                    || "xml:base".equals(attributeName)) {
                 convertAttributeToProperty(attributes, attributeName, attributeValue);
             } else if (!factory.isNamespaceIgnored(attributeNS)) {
                 ElementMapping mapping = factory.getElementMappingRegistry().getElementMapping(
@@ -368,15 +366,14 @@ public abstract class PropertyList {
                                             String attributeValue)
                     throws ValidationException {
 
-        if (attributeValue != null) {
-
-            if (attributeName.startsWith("xmlns:")
-                    || "xmlns".equals(attributeName)) {
-                //Ignore namespace declarations if the XML parser/XSLT processor
-                //reports them as 'regular' attributes
-                return;
-            }
+        if (attributeName.startsWith("xmlns:")
+                || "xmlns".equals(attributeName)) {
+            /* Ignore namespace declarations if the XML parser/XSLT processor
+             * reports them as 'regular' attributes */
+            return;
+        }
 
+        if (attributeValue != null) {
             /* Handle "compound" properties, ex. space-before.minimum */
             String basePropertyName = findBasePropertyName(attributeName);
             String subPropertyName = findSubPropertyName(attributeName);

Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ListProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ListProperty.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ListProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ListProperty.java Thu Feb 10 14:09:42 2011
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
 
 /**
  * Superclass for properties that are lists of other properties
@@ -30,22 +31,23 @@ import org.apache.fop.fo.PropertyList;
 public class ListProperty extends Property {
 
     /**
-     * Inner class for creating instances of ListProperty
+     * Inner class for creating instances of {@code ListProperty}
      */
     public static class Maker extends PropertyMaker {
 
         /**
+         * Create a maker for the given property id.
          * @param propId ID of the property for which Maker should be created
          */
         public Maker(int propId) {
             super(propId);
         }
 
-        /**
-         * {@inheritDoc}
-         */
+        /** {@inheritDoc} */
+        @Override
         public Property convertProperty(Property p,
-                                        PropertyList propertyList, FObj fo) {
+                                        PropertyList propertyList, FObj fo)
+                        throws PropertyException {
             if (p instanceof ListProperty) {
                 return p;
             } else {
@@ -56,7 +58,7 @@ public class ListProperty extends Proper
     }
 
     /** Vector containing the list of sub-properties */
-    protected List list = new java.util.Vector();
+    protected final List<Property> list = new java.util.Vector<Property>();
 
     /**
      * Simple constructor used by subclasses to do some special processing.
@@ -66,7 +68,9 @@ public class ListProperty extends Proper
     }
 
     /**
-     * @param prop the first Property to be added to the list
+     * Create a new instance, using the given {@link Property} as the first
+     * element in the list.
+     * @param prop the first property to be added to the list
      */
     public ListProperty(Property prop) {
         this();
@@ -82,15 +86,21 @@ public class ListProperty extends Proper
     }
 
     /**
-     * @return this.list
+     * Return the {@code java.util.List} of {@link Property} instances
+     * contained in this property.
+     * @return the list of properties contained in this instance
      */
-    public List getList() {
+    @Override
+    public List<Property> getList() {
         return list;
     }
 
     /**
+     * Return the {@code java.util.List} of {@link Property} instances,
+     * cast as a {@code java.lang.Object}.
      * @return this.list cast as an Object
      */
+    @Override
     public Object getObject() {
         return list;
     }



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