From b8ac4207fe239a3433870691c79018b0137a30f6 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Tue, 15 Mar 2011 15:56:01 +0000 Subject: [PATCH] Renamed Viewport into InlineViewport Added {@inheritDoc} comments to make Checkstyle happy git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1081822 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/AreaTreeParser.java | 14 +++++++------- src/java/org/apache/fop/area/BlockViewport.java | 2 ++ src/java/org/apache/fop/area/RegionViewport.java | 2 ++ .../org/apache/fop/area/inline/FilledArea.java | 6 +++--- .../inline/{Viewport.java => InlineViewport.java} | 7 +++++-- .../layoutmgr/ExternalDocumentLayoutManager.java | 4 ++-- .../inline/AbstractGraphicsLayoutManager.java | 8 ++++---- .../fop/render/AbstractPathOrientedRenderer.java | 6 +++--- .../org/apache/fop/render/AbstractRenderer.java | 8 ++++---- .../apache/fop/render/intermediate/IFRenderer.java | 6 +++--- .../org/apache/fop/render/xml/XMLRenderer.java | 6 +++--- .../fop/area/inline/InlineViewportTestCase.java | 6 +++--- 12 files changed, 41 insertions(+), 34 deletions(-) rename src/java/org/apache/fop/area/inline/{Viewport.java => InlineViewport.java} (95%) diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/java/org/apache/fop/area/AreaTreeParser.java index 6c82257f3..d2f52f991 100644 --- a/src/java/org/apache/fop/area/AreaTreeParser.java +++ b/src/java/org/apache/fop/area/AreaTreeParser.java @@ -73,7 +73,7 @@ import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.Space; import org.apache.fop.area.inline.SpaceArea; import org.apache.fop.area.inline.TextArea; -import org.apache.fop.area.inline.Viewport; +import org.apache.fop.area.inline.InlineViewport; import org.apache.fop.area.inline.WordArea; import org.apache.fop.fo.ElementMappingRegistry; import org.apache.fop.fo.expr.PropertyException; @@ -217,7 +217,7 @@ public class AreaTreeParser { makers.put("word", new WordMaker()); makers.put("space", new SpaceMaker()); makers.put("leader", new LeaderMaker()); - makers.put("viewport", new ViewportMaker()); + makers.put("viewport", new InlineViewportMaker()); makers.put("image", new ImageMaker()); makers.put("foreignObject", new ForeignObjectMaker()); makers.put("bookmarkTree", new BookmarkTreeMaker()); @@ -265,8 +265,8 @@ public class AreaTreeParser { return (AbstractTextArea)findAreaType(AbstractTextArea.class); } - private Viewport getCurrentViewport() { - return (Viewport)findAreaType(Viewport.class); + private InlineViewport getCurrentViewport() { + return (InlineViewport)findAreaType(InlineViewport.class); } /** {@inheritDoc} */ @@ -902,10 +902,10 @@ public class AreaTreeParser { } } - private class ViewportMaker extends AbstractMaker { + private class InlineViewportMaker extends AbstractMaker { public void startElement(Attributes attributes) { - Viewport viewport = new Viewport(null); + InlineViewport viewport = new InlineViewport(null); transferForeignObjects(attributes, viewport); setAreaAttributes(attributes, viewport); setTraits(attributes, viewport, SUBSET_COMMON); @@ -921,7 +921,7 @@ public class AreaTreeParser { } public void endElement() { - assertObjectOfClass(areaStack.pop(), Viewport.class); + assertObjectOfClass(areaStack.pop(), InlineViewport.class); } } diff --git a/src/java/org/apache/fop/area/BlockViewport.java b/src/java/org/apache/fop/area/BlockViewport.java index 770ff31fb..066f2f9e8 100644 --- a/src/java/org/apache/fop/area/BlockViewport.java +++ b/src/java/org/apache/fop/area/BlockViewport.java @@ -80,10 +80,12 @@ public class BlockViewport extends Block implements Viewport { clip = cl; } + /** {@inheritDoc} */ public boolean hasClip() { return clip; } + /** {@inheritDoc} */ public Rectangle getClipRectangle() { if (clip) { return new Rectangle(getIPD(), getBPD()); diff --git a/src/java/org/apache/fop/area/RegionViewport.java b/src/java/org/apache/fop/area/RegionViewport.java index 305dc5c10..6cc700a7b 100644 --- a/src/java/org/apache/fop/area/RegionViewport.java +++ b/src/java/org/apache/fop/area/RegionViewport.java @@ -76,10 +76,12 @@ public class RegionViewport extends Area implements Cloneable, Viewport { clip = c; } + /** {@inheritDoc} */ public boolean hasClip() { return this.clip; } + /** {@inheritDoc} */ public Rectangle getClipRectangle() { if (clip) { return new Rectangle(getIPD(), getBPD()); diff --git a/src/java/org/apache/fop/area/inline/FilledArea.java b/src/java/org/apache/fop/area/inline/FilledArea.java index 858951f75..e0207ada6 100644 --- a/src/java/org/apache/fop/area/inline/FilledArea.java +++ b/src/java/org/apache/fop/area/inline/FilledArea.java @@ -19,10 +19,10 @@ package org.apache.fop.area.inline; -import java.util.List; -import java.util.ListIterator; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; /** * Filled area. @@ -60,7 +60,7 @@ public class FilledArea extends InlineParent { InlineArea child = (InlineArea) childrenIterator.next(); if (child instanceof InlineParent) { setChildOffset(((InlineParent) child).getChildAreas().listIterator(), v); - } else if (child instanceof org.apache.fop.area.inline.Viewport) { + } else if (child instanceof InlineViewport) { // nothing } else { child.setOffset(v); diff --git a/src/java/org/apache/fop/area/inline/Viewport.java b/src/java/org/apache/fop/area/inline/InlineViewport.java similarity index 95% rename from src/java/org/apache/fop/area/inline/Viewport.java rename to src/java/org/apache/fop/area/inline/InlineViewport.java index 610697c36..68cc9a797 100644 --- a/src/java/org/apache/fop/area/inline/Viewport.java +++ b/src/java/org/apache/fop/area/inline/InlineViewport.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.util.HashMap; import org.apache.fop.area.Area; +import org.apache.fop.area.Viewport; /** * Inline viewport area. @@ -32,7 +33,7 @@ import org.apache.fop.area.Area; * external graphic and instream foreign object. This viewport * holds the area and positions it. */ -public class Viewport extends InlineArea implements org.apache.fop.area.Viewport { +public class InlineViewport extends InlineArea implements Viewport { private static final long serialVersionUID = 813338534627918689L; @@ -48,7 +49,7 @@ public class Viewport extends InlineArea implements org.apache.fop.area.Viewport * * @param child the child content area of this viewport */ - public Viewport(Area child) { + public InlineViewport(Area child) { this.content = child; } @@ -61,10 +62,12 @@ public class Viewport extends InlineArea implements org.apache.fop.area.Viewport this.clip = c; } + /** {@inheritDoc} */ public boolean hasClip() { return this.clip; } + /** {@inheritDoc} */ public Rectangle getClipRectangle() { if (clip) { return new Rectangle(getIPD(), getBPD()); diff --git a/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java index d807aee2d..9fb832da3 100644 --- a/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java @@ -45,7 +45,7 @@ import org.apache.fop.area.PageSequence; import org.apache.fop.area.PageViewport; import org.apache.fop.area.RegionViewport; import org.apache.fop.area.inline.Image; -import org.apache.fop.area.inline.Viewport; +import org.apache.fop.area.inline.InlineViewport; import org.apache.fop.datatypes.FODimension; import org.apache.fop.datatypes.URISpecification; import org.apache.fop.fo.Constants; @@ -184,7 +184,7 @@ public class ExternalDocumentLayoutManager extends AbstractPageSequenceLayoutMan TraitSetter.setProducerID(imageArea, fobj.getId()); transferForeignAttributes(imageArea); - Viewport vp = new Viewport(imageArea); + InlineViewport vp = new InlineViewport(imageArea); TraitSetter.setProducerID(vp, fobj.getId()); vp.setIPD(imageSize.width); vp.setBPD(imageSize.height); diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java index fd4d803af..218497a53 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java @@ -24,7 +24,7 @@ import java.awt.Rectangle; import java.util.List; import org.apache.fop.area.Area; -import org.apache.fop.area.inline.Viewport; +import org.apache.fop.area.inline.InlineViewport; import org.apache.fop.datatypes.LengthBase; import org.apache.fop.fo.FObj; import org.apache.fop.fo.flow.AbstractGraphics; @@ -54,7 +54,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage * * @return the viewport inline area */ - private Viewport getInlineArea() { + private InlineViewport getInlineArea() { final AbstractGraphics fobj = (AbstractGraphics)this.fobj; Dimension intrinsicSize = new Dimension( fobj.getIntrinsicWidth(), @@ -84,7 +84,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage TraitSetter.setProducerID(viewportArea, fobj.getId()); transferForeignAttributes(viewportArea); - Viewport vp = new Viewport(viewportArea); + InlineViewport vp = new InlineViewport(viewportArea); TraitSetter.addPtr(vp, fobj.getPtr()); // used for accessibility TraitSetter.setProducerID(vp, fobj.getId()); vp.setIPD(imageLayout.getViewportSize().width); @@ -106,7 +106,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage /** {@inheritDoc} */ public List getNextKnuthElements(LayoutContext context, int alignment) { - Viewport areaCurrent = getInlineArea(); + InlineViewport areaCurrent = getInlineArea(); setCurrentArea(areaCurrent); return super.getNextKnuthElements(context, alignment); } diff --git a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java b/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java index 50a95b09a..45a02a977 100644 --- a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java +++ b/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java @@ -44,7 +44,7 @@ import org.apache.fop.area.RegionViewport; import org.apache.fop.area.Trait; import org.apache.fop.area.inline.ForeignObject; import org.apache.fop.area.inline.InlineArea; -import org.apache.fop.area.inline.Viewport; +import org.apache.fop.area.inline.InlineViewport; import org.apache.fop.fo.Constants; import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.fonts.FontMetrics; @@ -685,7 +685,7 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer { * This renders an inline viewport by clipping if necessary. * @param viewport the viewport to handle */ - public void renderViewport(Viewport viewport) { + public void renderInlineViewport(InlineViewport viewport) { float x = currentIPPosition / 1000f; float y = (currentBPPosition + viewport.getOffset()) / 1000f; @@ -706,7 +706,7 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer { clipRect(x + borderPaddingStart, y + borderPaddingBefore, width, height); } - super.renderViewport(viewport); + super.renderInlineViewport(viewport); if (viewport.hasClip()) { restoreGraphicsState(); diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 4e0b13c56..7ff236d16 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -65,7 +65,7 @@ import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.Space; import org.apache.fop.area.inline.SpaceArea; import org.apache.fop.area.inline.TextArea; -import org.apache.fop.area.inline.Viewport; +import org.apache.fop.area.inline.InlineViewport; import org.apache.fop.area.inline.WordArea; import org.apache.fop.fo.Constants; import org.apache.fop.fonts.FontInfo; @@ -632,8 +632,8 @@ public abstract class AbstractRenderer renderInlineBlockParent((InlineBlockParent) inlineArea); } else if (inlineArea instanceof Space) { renderInlineSpace((Space) inlineArea); - } else if (inlineArea instanceof Viewport) { - renderViewport((Viewport) inlineArea); + } else if (inlineArea instanceof InlineViewport) { + renderInlineViewport((InlineViewport) inlineArea); } else if (inlineArea instanceof Leader) { renderLeader((Leader) inlineArea); } @@ -734,7 +734,7 @@ public abstract class AbstractRenderer * Render the given Viewport. * @param viewport the viewport to render */ - protected void renderViewport(Viewport viewport) { + protected void renderInlineViewport(InlineViewport viewport) { Area content = viewport.getContent(); int saveBP = currentBPPosition; currentBPPosition += viewport.getOffset(); diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/java/org/apache/fop/render/intermediate/IFRenderer.java index dfa2477b6..c81a5cae9 100644 --- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java +++ b/src/java/org/apache/fop/render/intermediate/IFRenderer.java @@ -73,7 +73,7 @@ import org.apache.fop.area.inline.InlineParent; import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.SpaceArea; import org.apache.fop.area.inline.TextArea; -import org.apache.fop.area.inline.Viewport; +import org.apache.fop.area.inline.InlineViewport; import org.apache.fop.area.inline.WordArea; import org.apache.fop.datatypes.URISpecification; import org.apache.fop.fo.extensions.ExtensionAttachment; @@ -838,12 +838,12 @@ public class IFRenderer extends AbstractPathOrientedRenderer { } /** {@inheritDoc} */ - public void renderViewport(Viewport viewport) { + public void renderInlineViewport(InlineViewport viewport) { String ptr = (String) viewport.getTrait(Trait.PTR); establishStructurePointer(ptr); Dimension dim = new Dimension(viewport.getIPD(), viewport.getBPD()); viewportDimensionStack.push(dim); - super.renderViewport(viewport); + super.renderInlineViewport(viewport); viewportDimensionStack.pop(); resetStructurePointer(); } diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index a7f085d7f..21d28042d 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -79,7 +79,7 @@ import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.Space; import org.apache.fop.area.inline.SpaceArea; import org.apache.fop.area.inline.TextArea; -import org.apache.fop.area.inline.Viewport; +import org.apache.fop.area.inline.InlineViewport; import org.apache.fop.area.inline.WordArea; import org.apache.fop.fo.Constants; import org.apache.fop.fo.extensions.ExtensionAttachment; @@ -743,7 +743,7 @@ public class XMLRenderer extends AbstractXMLRenderer { * {@inheritDoc} */ @Override - protected void renderViewport(Viewport viewport) { + protected void renderInlineViewport(InlineViewport viewport) { atts.clear(); addAreaAttributes(viewport); addTraitAttributes(viewport); @@ -753,7 +753,7 @@ public class XMLRenderer extends AbstractXMLRenderer { addAttribute("clip", "true"); } startElement("viewport", atts); - super.renderViewport(viewport); + super.renderInlineViewport(viewport); endElement("viewport"); } diff --git a/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java b/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java index ccd866d64..811158273 100644 --- a/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java +++ b/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java @@ -22,19 +22,19 @@ package org.apache.fop.area.inline; import org.apache.fop.area.ViewportTestCase; /** - * Tests the {@linkplain Viewport} class. + * Tests the {@linkplain InlineViewport} class. */ public class InlineViewportTestCase extends ViewportTestCase { public void testNonClip() throws Exception { - Viewport v = new Viewport(null); + InlineViewport v = new InlineViewport(null); v.setIPD(50); v.setBPD(25); checkNonClip(v); } public void testClip() throws Exception { - Viewport v = new Viewport(null); + InlineViewport v = new InlineViewport(null); int ipd = 50; int bpd = 25; v.setIPD(ipd); -- 2.39.5