diff options
Diffstat (limited to 'src/java/org/apache/fop/area')
-rw-r--r-- | src/java/org/apache/fop/area/Area.java | 20 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeHandler.java | 32 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeModel.java | 10 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeObject.java | 21 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/IDTracker.java | 14 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/PageViewport.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/RegionReference.java | 9 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/RenderPagesModel.java | 8 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/inline/FilledArea.java | 10 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/inline/Image.java | 10 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/inline/InlineArea.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/inline/TextArea.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/inline/Viewport.java | 18 |
13 files changed, 101 insertions, 67 deletions
diff --git a/src/java/org/apache/fop/area/Area.java b/src/java/org/apache/fop/area/Area.java index 1379e566d..87ba2146a 100644 --- a/src/java/org/apache/fop/area/Area.java +++ b/src/java/org/apache/fop/area/Area.java @@ -119,8 +119,10 @@ public class Area extends AreaTreeObject implements Serializable { public static final int CLASS_MAX = CLASS_SIDE_FLOAT + 1; private int areaClass = CLASS_NORMAL; + /** the area's inline-progression-dimension */ protected int ipd; + /** the area's block-progression-dimension */ protected int bpd; @@ -141,7 +143,7 @@ public class Area extends AreaTreeObject implements Serializable { * @return the area class */ public int getAreaClass() { - return areaClass; + return this.areaClass; } /** @@ -157,11 +159,11 @@ public class Area extends AreaTreeObject implements Serializable { * Set the inline progression dimension of content rectangle * for this area. * - * @param i the new inline progression dimension - * @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">ipd</a> + * @param ipd the new inline progression dimension + * @see <a href="http://www.w3.org/TR/xsl/#inline-progression-dimension">ipd</a> */ - public void setIPD(int i) { - ipd = i; + public void setIPD(int ipd) { + this.ipd = ipd; } /** @@ -169,10 +171,10 @@ public class Area extends AreaTreeObject implements Serializable { * for this area. * * @return the inline progression dimension - * @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">ipd</a> + * @see <a href="http://www.w3.org/TR/xsl/#inline-progression-dimension">ipd</a> */ public int getIPD() { - return ipd; + return this.ipd; } /** @@ -180,7 +182,7 @@ public class Area extends AreaTreeObject implements Serializable { * for this area. * * @param b the new block progression dimension - * @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">bpd</a> + * @see <a href="http://www.w3.org/TR/xsl/#block-progression-dimension">bpd</a> */ public void setBPD(int b) { bpd = b; @@ -191,7 +193,7 @@ public class Area extends AreaTreeObject implements Serializable { * for this area. * * @return the block progression dimension - * @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">bpd</a> + * @see <a href="http://www.w3.org/TR/xsl/#block-progression-dimension">bpd</a> */ public int getBPD() { return bpd; diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index 59995741b..128fc8ce9 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -101,12 +101,12 @@ public class AreaTreeHandler extends FOEventHandler { setupModel(userAgent, outputFormat, stream); - lmMaker = userAgent.getFactory().getLayoutManagerMakerOverride(); + this.lmMaker = userAgent.getFactory().getLayoutManagerMakerOverride(); if (lmMaker == null) { lmMaker = new LayoutManagerMapping(); } - idTracker = new IDTracker(); + this.idTracker = new IDTracker(); if (log.isDebugEnabled()) { statistics = new Statistics(); @@ -124,7 +124,7 @@ public class AreaTreeHandler extends FOEventHandler { */ protected void setupModel(FOUserAgent userAgent, String outputFormat, OutputStream stream) throws FOPException { - model = new RenderPagesModel(userAgent, outputFormat, fontInfo, stream); + this.model = new RenderPagesModel(userAgent, outputFormat, fontInfo, stream); } /** @@ -133,7 +133,7 @@ public class AreaTreeHandler extends FOEventHandler { * @return AreaTreeModel the model being used for this area tree */ public AreaTreeModel getAreaTreeModel() { - return model; + return this.model; } /** @@ -143,7 +143,7 @@ public class AreaTreeHandler extends FOEventHandler { * area tree */ public LayoutManagerMaker getLayoutManagerMaker() { - return lmMaker; + return this.lmMaker; } /** @@ -152,7 +152,7 @@ public class AreaTreeHandler extends FOEventHandler { * @return IDTracker used to track reference ids for items in this area tree */ public IDTracker getIDTracker() { - return idTracker; + return this.idTracker; } /** @@ -207,9 +207,9 @@ public class AreaTreeHandler extends FOEventHandler { } private void wrapAndAddExtensionAttachments(List list) { - Iterator i = list.iterator(); - while (i.hasNext()) { - ExtensionAttachment attachment = (ExtensionAttachment) i.next(); + Iterator it = list.iterator(); + while (it.hasNext()) { + ExtensionAttachment attachment = (ExtensionAttachment) it.next(); addOffDocumentItem(new OffDocumentExtensionAttachment(attachment)); } } @@ -357,7 +357,7 @@ public class AreaTreeHandler extends FOEventHandler { * * @param id the property ID of the area * @param pv a page viewport that contains the area with this ID - * @deprecated use getIdTracker().associateIDWithPageViewport(id, pv) instead + * @deprecated use getIDTracker().associateIDWithPageViewport(id, pv) instead */ public void associateIDWithPageViewport(String id, PageViewport pv) { idTracker.associateIDWithPageViewport(id, pv); @@ -369,7 +369,7 @@ public class AreaTreeHandler extends FOEventHandler { * know when an id can be resolved. * * @param id the id of the object being processed - * @deprecated use getIdTracker().signalPendingID(id) instead + * @deprecated use getIDTracker().signalPendingID(id) instead */ public void signalPendingID(String id) { idTracker.signalPendingID(id); @@ -381,7 +381,7 @@ public class AreaTreeHandler extends FOEventHandler { * ref-ids can be resolved. * * @param id the id of the formatting object which was just finished - * @deprecated use getIdTracker().signalIDProcessed(id) instead + * @deprecated use getIDTracker().signalIDProcessed(id) instead */ public void signalIDProcessed(String id) { idTracker.signalIDProcessed(id); @@ -392,7 +392,7 @@ public class AreaTreeHandler extends FOEventHandler { * * @param id the id to check * @return true if the ID has been resolved - * @deprecated use getIdTracker().alreadyResolvedID(id) instead + * @deprecated use getIDTracker().alreadyResolvedID(id) instead */ public boolean alreadyResolvedID(String id) { return idTracker.alreadyResolvedID(id); @@ -402,7 +402,7 @@ public class AreaTreeHandler extends FOEventHandler { * Tries to resolve all unresolved ID references on the given page. * * @param pv page viewport whose ID refs to resolve - * @deprecated use getIdTracker().tryIDResolution(pv) instead + * @deprecated use getIDTracker().tryIDResolution(pv) instead */ public void tryIDResolution(PageViewport pv) { idTracker.tryIDResolution(pv); @@ -413,7 +413,7 @@ public class AreaTreeHandler extends FOEventHandler { * * @param id the id to lookup * @return the list of PageViewports - * @deprecated use getIdTracker().getPageViewportsContainingID(id) instead + * @deprecated use getIDTracker().getPageViewportsContainingID(id) instead */ public List getPageViewportsContainingID(String id) { return idTracker.getPageViewportsContainingID(id); @@ -424,7 +424,7 @@ public class AreaTreeHandler extends FOEventHandler { * * @param idref the idref whose target id has not yet been located * @param res the Resolvable object needing the idref to be resolved - * @deprecated use getIdTracker().addUnresolvedIDRef(idref, res) instead + * @deprecated use getIDTracker().addUnresolvedIDRef(idref, res) instead */ public void addUnresolvedIDRef(String idref, Resolvable res) { idTracker.addUnresolvedIDRef(idref, res); diff --git a/src/java/org/apache/fop/area/AreaTreeModel.java b/src/java/org/apache/fop/area/AreaTreeModel.java index acf51b913..e5f6db17b 100644 --- a/src/java/org/apache/fop/area/AreaTreeModel.java +++ b/src/java/org/apache/fop/area/AreaTreeModel.java @@ -36,11 +36,11 @@ import org.apache.commons.logging.LogFactory; * the life of the area tree model. */ public class AreaTreeModel { - private List pageSequenceList = null; + private List/*<PageSequence>*/ pageSequenceList = null; private int currentPageSequenceIndex = -1; /** the current page sequence */ protected PageSequence currentPageSequence; - private List offDocumentItems = new java.util.ArrayList(); +// private List offDocumentItems = new java.util.ArrayList(); /** logger instance */ protected static Log log = LogFactory.getLog(AreaTreeModel.class); @@ -48,7 +48,7 @@ public class AreaTreeModel { * Create a new store pages model */ public AreaTreeModel() { - pageSequenceList = new java.util.ArrayList(); + pageSequenceList = new java.util.ArrayList/*<PageSequence>*/(); } /** @@ -83,13 +83,13 @@ public class AreaTreeModel { * Handle an OffDocumentItem * @param ext the extension to handle */ - public void handleOffDocumentItem(OffDocumentItem ext) {}; + public void handleOffDocumentItem(OffDocumentItem ext) { }; /** * Signal the end of the document for any processing. * @throws SAXException if a problem was encountered. */ - public void endDocument() throws SAXException {}; + public void endDocument() throws SAXException { }; /** * Returns the currently active page-sequence. diff --git a/src/java/org/apache/fop/area/AreaTreeObject.java b/src/java/org/apache/fop/area/AreaTreeObject.java index 83e7727db..5929e7c4e 100644 --- a/src/java/org/apache/fop/area/AreaTreeObject.java +++ b/src/java/org/apache/fop/area/AreaTreeObject.java @@ -21,6 +21,7 @@ package org.apache.fop.area; import java.util.Collections; import java.util.Iterator; +import java.util.List; import java.util.Map; import org.apache.xmlgraphics.util.QName; @@ -33,6 +34,9 @@ public abstract class AreaTreeObject { /** Foreign attributes */ protected Map foreignAttributes = null; + /** Extension attachments */ + protected List/*<ExtensionAttachment>*/ extensionAttachments = null; + /** * Sets a foreign attribute. * @param name the qualified name of the attribute @@ -83,6 +87,21 @@ public abstract class AreaTreeObject { return Collections.EMPTY_MAP; } } + + /** + * Set extension attachments from a List + * @param extensionAttachments a List with extension attachments + */ + public void setExtensionAttachments(List extensionAttachments) { + this.extensionAttachments = extensionAttachments; + } - + /** @return the extension attachments associated with this area */ + public List getExtensionAttachments() { + if (this.foreignAttributes != null) { + return Collections.unmodifiableList(this.extensionAttachments); + } else { + return Collections.EMPTY_LIST; + } + } } diff --git a/src/java/org/apache/fop/area/IDTracker.java b/src/java/org/apache/fop/area/IDTracker.java index 9f9023717..b55ed7983 100644 --- a/src/java/org/apache/fop/area/IDTracker.java +++ b/src/java/org/apache/fop/area/IDTracker.java @@ -20,8 +20,6 @@ package org.apache.fop.area; import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -36,20 +34,20 @@ import org.apache.commons.logging.LogFactory; */ public class IDTracker { - private static Log log = LogFactory.getLog(IDTracker.class); + 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 // form the defined area of this ID - private Map idLocations = new HashMap(); + private Map idLocations = new java.util.HashMap(); // 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 HashMap(); + private Map unresolvedIDRefs = new java.util.HashMap(); - private Set unfinishedIDs = new HashSet(); + private Set unfinishedIDs = new java.util.HashSet(); - private Set alreadyResolvedIDs = new HashSet(); + private Set alreadyResolvedIDs = new java.util.HashSet(); /** * Tie a PageViewport with an ID found on a child area of the PV. Note that @@ -198,7 +196,7 @@ public class IDTracker { public void addUnresolvedIDRef(String idref, Resolvable res) { Set todo = (Set) unresolvedIDRefs.get(idref); if (todo == null) { - todo = new HashSet(); + todo = new java.util.HashSet(); unresolvedIDRefs.put(idref, todo); } // add Resolvable object to this HashSet diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/java/org/apache/fop/area/PageViewport.java index 23d066099..a7523530b 100644 --- a/src/java/org/apache/fop/area/PageViewport.java +++ b/src/java/org/apache/fop/area/PageViewport.java @@ -89,7 +89,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl //Arbitrary attachments to the page from extensions that need to pass information //down to the renderers. - private List extensionAttachments = null; + private List/*<ExtensionAttachment>*/ extensionAttachments = null; /** * logging instance @@ -122,7 +122,8 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl */ public PageViewport(PageViewport original) { if (original.extensionAttachments != null) { - this.extensionAttachments = new java.util.ArrayList(original.extensionAttachments); + this.extensionAttachments + = new java.util.ArrayList/*<ExtensionAttachment>*/(original.extensionAttachments); } this.pageIndex = original.pageIndex; this.pageNumber = original.pageNumber; @@ -588,7 +589,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl */ public void addExtensionAttachment(ExtensionAttachment attachment) { if (this.extensionAttachments == null) { - this.extensionAttachments = new java.util.ArrayList(); + this.extensionAttachments = new java.util.ArrayList/*<ExtensionAttachment>*/(); } extensionAttachments.add(attachment); } diff --git a/src/java/org/apache/fop/area/RegionReference.java b/src/java/org/apache/fop/area/RegionReference.java index eac90ce41..bee597673 100644 --- a/src/java/org/apache/fop/area/RegionReference.java +++ b/src/java/org/apache/fop/area/RegionReference.java @@ -160,4 +160,13 @@ public class RegionReference extends Area implements Cloneable { return rr; } + /** {@inheritDoc} */ + public String toString() { + StringBuffer sb = new StringBuffer(super.toString()); + sb.append(" {regionName=").append(regionName); + sb.append(", regionClass=").append(regionClass); + sb.append(", ctm=").append(ctm); + sb.append("}"); + return sb.toString(); + } } diff --git a/src/java/org/apache/fop/area/RenderPagesModel.java b/src/java/org/apache/fop/area/RenderPagesModel.java index e75fd4e79..13995b099 100644 --- a/src/java/org/apache/fop/area/RenderPagesModel.java +++ b/src/java/org/apache/fop/area/RenderPagesModel.java @@ -50,9 +50,9 @@ public class RenderPagesModel extends AreaTreeModel { /** * Pages that have been prepared but not rendered yet. */ - protected List prepared = new java.util.ArrayList(); - private List pendingODI = new java.util.ArrayList(); - private List endDocODI = new java.util.ArrayList(); + 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. @@ -66,7 +66,7 @@ public class RenderPagesModel extends AreaTreeModel { FontInfo fontInfo, OutputStream stream) throws FOPException { super(); - renderer = userAgent.getRendererFactory().createRenderer( + this.renderer = userAgent.getRendererFactory().createRenderer( userAgent, outputFormat); try { diff --git a/src/java/org/apache/fop/area/inline/FilledArea.java b/src/java/org/apache/fop/area/inline/FilledArea.java index 3e108db19..7df62e79b 100644 --- a/src/java/org/apache/fop/area/inline/FilledArea.java +++ b/src/java/org/apache/fop/area/inline/FilledArea.java @@ -70,10 +70,10 @@ public class FilledArea extends InlineParent { /** * Set the unit width for the areas to fill the full width. * - * @param w the unit width + * @param width the unit width */ - public void setUnitWidth(int w) { - unitWidth = w; + public void setUnitWidth(int width) { + this.unitWidth = width; } /** @@ -82,7 +82,7 @@ public class FilledArea extends InlineParent { * @return the unit width */ public int getUnitWidth() { - return unitWidth; + return this.unitWidth; } /** @@ -117,7 +117,7 @@ public class FilledArea extends InlineParent { } /** - * recursively apply the variation factor to all descendant areas + * Recursively apply the variation factor to all descendant areas * @param variationFactor the variation factor that must be applied to adjustments * @param lineStretch the total stretch of the line * @param lineShrink the total shrink of the line diff --git a/src/java/org/apache/fop/area/inline/Image.java b/src/java/org/apache/fop/area/inline/Image.java index 1fc3375e5..7d802db49 100644 --- a/src/java/org/apache/fop/area/inline/Image.java +++ b/src/java/org/apache/fop/area/inline/Image.java @@ -28,14 +28,14 @@ import org.apache.fop.area.Area; */ public class Image extends Area { private String url; - + /** * Create a new image with the given url. * - * @param u the url of the image + * @param url the url of the image */ - public Image(String u) { - url = u; + public Image(String url) { + this.url = url; } /** @@ -45,7 +45,7 @@ public class Image extends Area { * @return the url of this image */ public String getURL() { - return url; + return this.url; } } diff --git a/src/java/org/apache/fop/area/inline/InlineArea.java b/src/java/org/apache/fop/area/inline/InlineArea.java index d8936dd42..6d5d9ca98 100644 --- a/src/java/org/apache/fop/area/inline/InlineArea.java +++ b/src/java/org/apache/fop/area/inline/InlineArea.java @@ -221,7 +221,7 @@ public class InlineArea extends Area { notifyIPDVariation(ipdVariation); } - /** + /** * notify the parent area about the ipd variation of this area * or of a descendant area * @param ipdVariation the difference between new and old ipd diff --git a/src/java/org/apache/fop/area/inline/TextArea.java b/src/java/org/apache/fop/area/inline/TextArea.java index 102b0a330..f736b894c 100644 --- a/src/java/org/apache/fop/area/inline/TextArea.java +++ b/src/java/org/apache/fop/area/inline/TextArea.java @@ -63,6 +63,7 @@ public class TextArea extends AbstractTextArea { * * @param word the word string * @param offset the offset for the next area + * @param letterAdjust the letter adjustment array (may be null) */ public void addWord(String word, int offset, int[] letterAdjust) { WordArea wordArea = new WordArea(word, offset, letterAdjust); @@ -98,7 +99,7 @@ public class TextArea extends AbstractTextArea { StringBuffer text = new StringBuffer(); InlineArea child; // assemble the text - for (int i = 0; i < inlines.size(); i ++) { + for (int i = 0; i < inlines.size(); i++) { child = (InlineArea) inlines.get(i); if (child instanceof WordArea) { text.append(((WordArea) child).getWord()); @@ -109,5 +110,9 @@ public class TextArea extends AbstractTextArea { return text.toString(); } + /** {@inheritDoc} */ + public String toString() { + return "TextArea{text=" + getText() + "}"; + } } diff --git a/src/java/org/apache/fop/area/inline/Viewport.java b/src/java/org/apache/fop/area/inline/Viewport.java index fadc1ec2a..489f5afda 100644 --- a/src/java/org/apache/fop/area/inline/Viewport.java +++ b/src/java/org/apache/fop/area/inline/Viewport.java @@ -45,7 +45,7 @@ public class Viewport extends InlineArea { * @param child the child content area of this viewport */ public Viewport(Area child) { - content = child; + this.content = child; } /** @@ -54,7 +54,7 @@ public class Viewport extends InlineArea { * @param c true if this viewport should clip */ public void setClip(boolean c) { - clip = c; + this.clip = c; } /** @@ -63,7 +63,7 @@ public class Viewport extends InlineArea { * @return true if this viewport should clip */ public boolean getClip() { - return clip; + return this.clip; } /** @@ -72,7 +72,7 @@ public class Viewport extends InlineArea { * @param cp the position and size to place the content */ public void setContentPosition(Rectangle2D cp) { - contentPosition = cp; + this.contentPosition = cp; } /** @@ -81,7 +81,7 @@ public class Viewport extends InlineArea { * @return the position and size to place the content */ public Rectangle2D getContentPosition() { - return contentPosition; + return this.contentPosition; } /** @@ -98,7 +98,7 @@ public class Viewport extends InlineArea { * @return the content area */ public Area getContent() { - return content; + return this.content; } private void writeObject(java.io.ObjectOutputStream out) @@ -123,9 +123,9 @@ public class Viewport extends InlineArea { in.readFloat(), in.readFloat()); } - clip = in.readBoolean(); - props = (HashMap) in.readObject(); - content = (Area) in.readObject(); + this.clip = in.readBoolean(); + this.props = (HashMap) in.readObject(); + this.content = (Area) in.readObject(); } } |