Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/PageViewport.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/PageViewport.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/PageViewport.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/PageViewport.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/RegionReference.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/RegionReference.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/RegionReference.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/RegionReference.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/RenderPagesModel.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/RenderPagesModel.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/RenderPagesModel.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/RenderPagesModel.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/Resolvable.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Resolvable.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Resolvable.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Resolvable.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/Span.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Span.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Span.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Span.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/Trait.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Trait.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Trait.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/Trait.java Thu Jan 27 15:23:10 2011 @@ -24,13 +24,17 @@ 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.traits.Direction; import org.apache.fop.traits.WritingMode; 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. @@ -144,8 +148,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; @@ -386,6 +392,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); @@ -460,6 +467,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); @@ -600,23 +608,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); } @@ -626,6 +634,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_ComplexScripts/src/java/org/apache/fop/area/inline/Container.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/Container.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/Container.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/Container.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/inline/FilledArea.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/FilledArea.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/FilledArea.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/FilledArea.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/inline/InlineArea.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/InlineArea.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/InlineArea.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/InlineArea.java Thu Jan 27 15:23:10 2011 @@ -195,6 +195,7 @@ public class InlineArea extends Area { * * {@inheritDoc} */ + @Override public void addChildArea(Area childArea) { super.addChildArea(childArea); if (childArea instanceof InlineArea) { @@ -202,9 +203,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_ComplexScripts/src/java/org/apache/fop/area/inline/InlineBlockParent.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/InlineBlockParent.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/InlineBlockParent.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/InlineBlockParent.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/inline/SpaceArea.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/SpaceArea.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/SpaceArea.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/SpaceArea.java Thu Jan 27 15:23:10 2011 @@ -49,9 +49,7 @@ public class SpaceArea extends InlineAre this.isAdjustable = adjustable; } - /** - * @return Returns the space. - */ + /** @return Returns the space. */ public String getSpace() { return String.valueOf(space); } Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/TextArea.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/TextArea.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/TextArea.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/TextArea.java Thu Jan 27 15:23:10 2011 @@ -116,20 +116,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() { StringBuffer sb = new StringBuffer(super.toString()); sb.append(" {text=\""); Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java Thu Jan 27 15:23:10 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_ComplexScripts/src/java/org/apache/fop/area/inline/WordArea.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/WordArea.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/WordArea.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/area/inline/WordArea.java Thu Jan 27 15:23:10 2011 @@ -75,9 +75,7 @@ public class WordArea extends InlineArea this.reversed = false; } - /** - * @return Returns the word. - */ + /** @return Returns the word. */ public String getWord() { return word; } Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/FOPropertyMapping.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/FOPropertyMapping.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/FOPropertyMapping.java Thu Jan 27 15:23:10 2011 @@ -79,11 +79,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 +246,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 +256,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 +342,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 +357,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 +373,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); } } Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/FObj.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/FObj.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/FObj.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/FObj.java Thu Jan 27 15:23:10 2011 @@ -51,12 +51,13 @@ public abstract class FObj extends FONod * pointer to the descendant subtree */ protected FONode firstChild; + 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. @@ -195,13 +196,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); } } } @@ -236,6 +243,13 @@ public abstract class FObj extends FONod nextChild.siblings[0] = prevChild; } } + if (child == lastChild) { + if (child.siblings != null) { + lastChild = siblings[0]; + } else { + lastChild = null; + } + } } /** @@ -419,6 +433,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 @@ -438,6 +453,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 @@ -527,7 +543,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} */ @@ -552,7 +568,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 " @@ -589,7 +605,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); } @@ -677,6 +693,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(); } @@ -692,12 +711,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_ComplexScripts/src/java/org/apache/fop/fo/PropertyList.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/PropertyList.java?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/PropertyList.java (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/fo/PropertyList.java Thu Jan 27 15:23:10 2011 @@ -252,6 +252,15 @@ public abstract class PropertyList { return propID; } + private String addAttributeToList(Attributes attributes, + String attributeName) throws ValidationException { + String attributeValue = attributes.getValue(attributeName); + if ( attributeValue != null ) { + convertAttributeToProperty(attributes, attributeName, attributeValue); + } + return attributeValue; + } + /** * <p>Adds the attributes, passed in by the parser to the PropertyList.</p> * <p>Note that certain attributes are given priority in terms of order of @@ -274,50 +283,36 @@ public abstract class PropertyList { /* * Give writing-mode highest conversion priority. */ - String attributeName = "writing-mode"; - String attributeValue = attributes.getValue(attributeName); - if ( attributeValue != null ) { - convertAttributeToProperty(attributes, attributeName, attributeValue); - } + addAttributeToList(attributes, "writing-mode"); /* * If column-number/number-columns-spanned are specified, then we * need them before all others (possible from-table-column() on any * other property further in the list... */ - attributeName = "column-number"; - 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); @@ -375,15 +370,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); Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/ColorExt.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Jan 27 15:23:10 2011 @@ -2,4 +2,4 @@ /xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/util/ColorExt.java:745924-830281 /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/ColorExt.java:603620-746655 /xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/util/ColorExt.java:684572,688085,688696 -/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:981451-1061681 +/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:981451-1064076 Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml?rev=1064156&r1=1064155&r2=1064156&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml (original) +++ xmlgraphics/fop/branches/Temp_ComplexScripts/status.xml Thu Jan 27 15:23:10 2011 @@ -59,6 +59,18 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Code" dev="AD" type="fix" fixes-bug="50635" due-to="mkoegler.AT.auto.tuwien.ac.at"> + Bugfix: fix issue in RenderPagesModel.checkPreparedPages() where the same page-sequence + is potentially started multiple times. + </action> + <action context="Code" dev="AD" type="fix" fixes-bug="50636" due-to="mkoegler.AT.auto.tuwien.ac.at"> + Bugfix: fix performance issue when adding pages, if the total number of pages + is significantly large. + </action> + <action context="Code" dev="AD" type="fix" fixes-bug="50626" due-to="mkoegler.AT.auto.tuwien.ac.at"> + Bugfix: fix performance issue when adding nodes, if the number of children + is significantly large. + </action> <action context="Config" dev="SP" type="fix"> Bugfix: relative URIs in the configuration file (base, font-base, hyphenation-base) are evaluated relative to the base URI of the configuration file. </action> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
