]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Renamed Viewport into InlineViewport
authorVincent Hennebert <vhennebert@apache.org>
Tue, 15 Mar 2011 15:56:01 +0000 (15:56 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Tue, 15 Mar 2011 15:56:01 +0000 (15:56 +0000)
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

13 files changed:
src/java/org/apache/fop/area/AreaTreeParser.java
src/java/org/apache/fop/area/BlockViewport.java
src/java/org/apache/fop/area/RegionViewport.java
src/java/org/apache/fop/area/inline/FilledArea.java
src/java/org/apache/fop/area/inline/InlineViewport.java [new file with mode: 0644]
src/java/org/apache/fop/area/inline/Viewport.java [deleted file]
src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java
src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
src/java/org/apache/fop/render/AbstractRenderer.java
src/java/org/apache/fop/render/intermediate/IFRenderer.java
src/java/org/apache/fop/render/xml/XMLRenderer.java
test/java/org/apache/fop/area/inline/InlineViewportTestCase.java

index 6c82257f35f4d705540714efe22c19e84dd5b50d..d2f52f991c3a746d301d8efa515aacfef65d5b93 100644 (file)
@@ -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);
             }
         }
 
index 770ff31fbbae705888a3abbaf525c62e42606c64..066f2f9e8a20c436583a0b8adeb6f80fffcca3d1 100644 (file)
@@ -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());
index 305dc5c10d18ec9107bc19f6cfe0186856e4ee6b..6cc700a7bea04507a479d6094034056f3cc4c5e2 100644 (file)
@@ -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());
index 858951f759df9d93e84072e82649297dfb1150f8..e0207ada630876e18804466cb4fec7300e8eec39 100644 (file)
 
 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/InlineViewport.java b/src/java/org/apache/fop/area/inline/InlineViewport.java
new file mode 100644 (file)
index 0000000..68cc9a7
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.area.inline;
+
+import java.awt.Rectangle;
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.apache.fop.area.Area;
+import org.apache.fop.area.Viewport;
+
+/**
+ * Inline viewport area.
+ * This is an inline-level viewport area for inline container,
+ * external graphic and instream foreign object. This viewport
+ * holds the area and positions it.
+ */
+public class InlineViewport extends InlineArea implements Viewport {
+
+    private static final long serialVersionUID = 813338534627918689L;
+
+    // contents could be container, foreign object or image
+    private Area content;
+    // clipping for the viewport
+    private boolean clip = false;
+    // position of the child area relative to this area
+    private Rectangle2D contentPosition;
+
+    /**
+     * Create a new viewport area with the content area.
+     *
+     * @param child the child content area of this viewport
+     */
+    public InlineViewport(Area child) {
+        this.content = child;
+    }
+
+    /**
+     * Set the clip of this viewport.
+     *
+     * @param c true if this viewport should clip
+     */
+    public void setClip(boolean c) {
+        this.clip = c;
+    }
+
+    /** {@inheritDoc} */
+    public boolean hasClip() {
+        return this.clip;
+    }
+
+    /** {@inheritDoc} */
+    public Rectangle getClipRectangle() {
+        if (clip) {
+            return new Rectangle(getIPD(), getBPD());
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Set the position and size of the content of this viewport.
+     *
+     * @param cp the position and size to place the content
+     */
+    public void setContentPosition(Rectangle2D cp) {
+        this.contentPosition = cp;
+    }
+
+    /**
+     * Get the position and size of the content of this viewport.
+     *
+     * @return the position and size to place the content
+     */
+    public Rectangle2D getContentPosition() {
+        return this.contentPosition;
+    }
+
+    /**
+     * Sets the content area.
+     * @param content the content area
+     */
+    public void setContent(Area content) {
+        this.content = content;
+    }
+
+    /**
+     * Get the content area for this viewport.
+     *
+     * @return the content area
+     */
+    public Area getContent() {
+        return this.content;
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out)
+    throws IOException {
+        out.writeBoolean(contentPosition != null);
+        if (contentPosition != null) {
+            out.writeFloat((float) contentPosition.getX());
+            out.writeFloat((float) contentPosition.getY());
+            out.writeFloat((float) contentPosition.getWidth());
+            out.writeFloat((float) contentPosition.getHeight());
+        }
+        out.writeBoolean(clip);
+        out.writeObject(props);
+        out.writeObject(content);
+    }
+
+    private void readObject(java.io.ObjectInputStream in)
+    throws IOException, ClassNotFoundException {
+        if (in.readBoolean()) {
+            contentPosition = new Rectangle2D.Float(in.readFloat(),
+                                                    in.readFloat(),
+                                                    in.readFloat(),
+                                                    in.readFloat());
+        }
+        this.clip = in.readBoolean();
+        this.props = (HashMap) in.readObject();
+        this.content = (Area) in.readObject();
+    }
+
+}
diff --git a/src/java/org/apache/fop/area/inline/Viewport.java b/src/java/org/apache/fop/area/inline/Viewport.java
deleted file mode 100644 (file)
index 610697c..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.area.inline;
-
-import java.awt.Rectangle;
-import java.awt.geom.Rectangle2D;
-import java.io.IOException;
-import java.util.HashMap;
-
-import org.apache.fop.area.Area;
-
-/**
- * Inline viewport area.
- * This is an inline-level viewport area for inline container,
- * 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 {
-
-    private static final long serialVersionUID = 813338534627918689L;
-
-    // contents could be container, foreign object or image
-    private Area content;
-    // clipping for the viewport
-    private boolean clip = false;
-    // position of the child area relative to this area
-    private Rectangle2D contentPosition;
-
-    /**
-     * Create a new viewport area with the content area.
-     *
-     * @param child the child content area of this viewport
-     */
-    public Viewport(Area child) {
-        this.content = child;
-    }
-
-    /**
-     * Set the clip of this viewport.
-     *
-     * @param c true if this viewport should clip
-     */
-    public void setClip(boolean c) {
-        this.clip = c;
-    }
-
-    public boolean hasClip() {
-        return this.clip;
-    }
-
-    public Rectangle getClipRectangle() {
-        if (clip) {
-            return new Rectangle(getIPD(), getBPD());
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Set the position and size of the content of this viewport.
-     *
-     * @param cp the position and size to place the content
-     */
-    public void setContentPosition(Rectangle2D cp) {
-        this.contentPosition = cp;
-    }
-
-    /**
-     * Get the position and size of the content of this viewport.
-     *
-     * @return the position and size to place the content
-     */
-    public Rectangle2D getContentPosition() {
-        return this.contentPosition;
-    }
-
-    /**
-     * Sets the content area.
-     * @param content the content area
-     */
-    public void setContent(Area content) {
-        this.content = content;
-    }
-
-    /**
-     * Get the content area for this viewport.
-     *
-     * @return the content area
-     */
-    public Area getContent() {
-        return this.content;
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out)
-    throws IOException {
-        out.writeBoolean(contentPosition != null);
-        if (contentPosition != null) {
-            out.writeFloat((float) contentPosition.getX());
-            out.writeFloat((float) contentPosition.getY());
-            out.writeFloat((float) contentPosition.getWidth());
-            out.writeFloat((float) contentPosition.getHeight());
-        }
-        out.writeBoolean(clip);
-        out.writeObject(props);
-        out.writeObject(content);
-    }
-
-    private void readObject(java.io.ObjectInputStream in)
-    throws IOException, ClassNotFoundException {
-        if (in.readBoolean()) {
-            contentPosition = new Rectangle2D.Float(in.readFloat(),
-                                                    in.readFloat(),
-                                                    in.readFloat(),
-                                                    in.readFloat());
-        }
-        this.clip = in.readBoolean();
-        this.props = (HashMap) in.readObject();
-        this.content = (Area) in.readObject();
-    }
-
-}
index d807aee2da818dd7ef889545ec298bd5a30becaa..9fb832da3e3be414cacab039375ec47892e0b503 100644 (file)
@@ -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);
index fd4d803af29e36a93e513b4c9f21535cf6f4af6a..218497a53787e76cf446aa4071600eb474bd3c25 100644 (file)
@@ -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);
     }
index 50a95b09ad832e0c7053c46d6d82f00586fe0e70..45a02a9772eaad4fa1a881e36c2af60d5184847f 100644 (file)
@@ -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();
index 4e0b13c56e72e3d10dc2f5cf60dc3bbecaaccf5f..7ff236d160867eefd8491a1919645e9de5b60715 100644 (file)
@@ -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();
index dfa2477b6f8f43550405367306341373ed85604d..c81a5cae917dc18e95524fe403bbde6fb387c669 100644 (file)
@@ -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();
     }
index a7f085d7fefad68e1c1b14abf076e082b917ae62..21d28042dfce20708331bdbc4876b25a9ff7d2ca 100644 (file)
@@ -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");
     }
 
index ccd866d6405ec9173c3e53d84f5d0a5d8bad21a7..81115827315d123668bf268a3e5938d9087f53cc 100644 (file)
@@ -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);