keiron 2003/01/23 10:59:08 Modified: src/org/apache/fop/area AreaTreeModel.java BodyRegion.java CTM.java CachedRenderPagesModel.java MinOptMax.java RegionViewport.java RenderPagesModel.java Span.java StorePagesModel.java Trait.java src/org/apache/fop/area/inline Container.java InlineArea.java Word.java Log: cleaned up some style errors Revision Changes Path 1.2 +5 -5 xml-fop/src/org/apache/fop/area/AreaTreeModel.java Index: AreaTreeModel.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/AreaTreeModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AreaTreeModel.java 22 Dec 2002 22:40:31 -0000 1.1 +++ AreaTreeModel.java 23 Jan 2003 18:59:07 -0000 1.2 @@ -1,9 +1,9 @@ /* -* $Id$ -* Copyright (C) 2002 The Apache Software Foundation. All rights reserved. -* For details on use and redistribution please refer to the -* LICENSE file included with these sources. -*/ + * $Id$ + * Copyright (C) 2002 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ package org.apache.fop.area; 1.8 +55 -6 xml-fop/src/org/apache/fop/area/BodyRegion.java Index: BodyRegion.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/BodyRegion.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- BodyRegion.java 18 Sep 2002 13:50:13 -0000 1.7 +++ BodyRegion.java 23 Jan 2003 18:59:07 -0000 1.8 @@ -19,7 +19,7 @@ private int columnGap; private int columnCount; - /** Referenc inline progression dimension for the body. */ + /** Reference inline progression dimension for the body. */ private int refIPD; /** @@ -30,46 +30,95 @@ super(BODY); } - // Number of columns when not spanning + /** + * Set the number of columns for blocks when not spanning + * + * @param colCount the number of columns + */ public void setColumnCount(int colCount) { this.columnCount = colCount; } - // Number of columns when not spanning + /** + * Get the number of columns when not spanning + * + * @return the number of columns + */ public int getColumnCount() { return this.columnCount; } - // A length (mpoints) + /** + * Set the column gap between columns + * The length is in millipoints. + * + * @param colGap the column gap in millipoints + */ public void setColumnGap(int colGap) { this.columnGap = colGap; } + /** + * Set the before float area. + * + * @param bf the before float area + */ public void setBeforeFloat(BeforeFloat bf) { beforeFloat = bf; } + /** + * Set the main reference area. + * + * @param mr the main reference area + */ public void setMainReference(MainReference mr) { mainReference = mr; } + /** + * Set the footnote area. + * + * @param foot the footnote area + */ public void setFootnote(Footnote foot) { footnote = foot; } - + /** + * Get the before float area. + * + * @return the before float area + */ public BeforeFloat getBeforeFloat() { return beforeFloat; } + /** + * Get the main reference area. + * + * @return the main reference area + */ public MainReference getMainReference() { return mainReference; } + /** + * Get the footnote area. + * + * @return the footnote area + */ public Footnote getFootnote() { return footnote; } + /** + * Clone this object. + * This is only used to clone the current object, the child areas + * are assumed to be null and are not cloned. + * + * @return a shallow copy of this object + */ public Object clone() { BodyRegion br = new BodyRegion(); br.setCTM(getCTM()); 1.7 +36 -8 xml-fop/src/org/apache/fop/area/CTM.java Index: CTM.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/CTM.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- CTM.java 25 Oct 2002 09:29:39 -0000 1.6 +++ CTM.java 23 Jan 2003 18:59:07 -0000 1.7 @@ -23,6 +23,7 @@ private static CTM s_CTM_lrtb = new CTM(1, 0, 0, 1, 0, 0); private static CTM s_CTM_rltb = new CTM(-1, 0, 0, 1, 0, 0); private static CTM s_CTM_tbrl = new CTM(0, 1, -1, 0, 0, 0); + /** * Create the identity matrix */ @@ -37,6 +38,13 @@ /** * Initialize a CTM from the passed arguments. + * + * @param a the x scale + * @param b the x shear + * @param c the y shear + * @param d the y scale + * @param e the x shift + * @param f the y shift */ public CTM(double a, double b, double c, double d, double e, double f) { this.a = a; @@ -49,7 +57,10 @@ /** * Initialize a CTM to the identity matrix with a translation - * specified by x and y. + * specified by x and y + * + * @param x the x shift + * @param y the y shift. */ public CTM(double x, double y) { this.a = 1; @@ -60,6 +71,11 @@ this.f = y; } + /** + * Initialize a CTM with the values of another CTM. + * + * @param ctm another CTM + */ protected CTM(CTM ctm) { this.a = ctm.a; this.b = ctm.b; @@ -78,6 +94,7 @@ * CTM is being set.. * @param bpd The block-progression dimension of the reference area whose * CTM is being set. + * @return a new CTM with the required transform */ public static CTM getWMctm(int wm, int ipd, int bpd) { CTM wmctm; @@ -179,10 +196,10 @@ // recalculate the width and height int x1t = (int)(inRect.getX() * a + inRect.getY() * c + e); int y1t = (int)(inRect.getX() * b + inRect.getY() * d + f); - int x2t = (int)((inRect.getX() + inRect.getWidth()) * a + - (inRect.getY() + inRect.getHeight()) * c + e); - int y2t = (int)((inRect.getX() + inRect.getWidth()) * b + - (inRect.getY() + inRect.getHeight()) * d + f); + int x2t = (int)((inRect.getX() + inRect.getWidth()) * a + + (inRect.getY() + inRect.getHeight()) * c + e); + int y2t = (int)((inRect.getX() + inRect.getWidth()) * b + + (inRect.getY() + inRect.getHeight()) * d + f); // Normalize with x1 < x2 if (x1t > x2t) { int tmp = x2t; @@ -197,11 +214,22 @@ return new Rectangle(x1t, y1t, x2t - x1t, y2t - y1t); } + /** + * Get string for this transform. + * + * @return a string with the transform values + */ public String toString() { - return "[" + a + " " + b + " " + c + " " + d + " " + e + " " + - f + "]"; + return "[" + a + " " + b + " " + c + " " + d + " " + e + " " + + f + "]"; } + /** + * Get an array containing the values of this transform. + * This creates and returns a new transform with the values in it. + * + * @return an array containing the transform values + */ public double[] toArray() { return new double[]{a, b, c, d, e, f}; } 1.6 +5 -3 xml-fop/src/org/apache/fop/area/CachedRenderPagesModel.java Index: CachedRenderPagesModel.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/CachedRenderPagesModel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- CachedRenderPagesModel.java 22 Dec 2002 22:40:31 -0000 1.5 +++ CachedRenderPagesModel.java 23 Jan 2003 18:59:07 -0000 1.6 @@ -42,6 +42,8 @@ * Check prepared pages * If a page is resolved it loads the page contents from * the file. + * + * @param newpage the new page being added * @return true if the current page should be rendered * false if the renderer doesn't support out of order * rendering and there are pending pages @@ -50,7 +52,7 @@ for (Iterator iter = prepared.iterator(); iter.hasNext();) { PageViewport p = (PageViewport)iter.next(); if (p.isResolved()) { - if(p != newpage) { + if (p != newpage) { try { // load page from cache String name = (String)pageMap.get(p); @@ -82,7 +84,7 @@ } } } - if(newpage != null && newpage.getPage() != null) { + if (newpage != null && newpage.getPage() != null) { savePage(newpage); } return renderer.supportsOutOfOrder() || prepared.isEmpty(); 1.5 +2 -2 xml-fop/src/org/apache/fop/area/MinOptMax.java Index: MinOptMax.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/MinOptMax.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MinOptMax.java 18 Sep 2002 13:50:13 -0000 1.4 +++ MinOptMax.java 23 Jan 2003 18:59:07 -0000 1.5 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ 1.8 +2 -2 xml-fop/src/org/apache/fop/area/RegionViewport.java Index: RegionViewport.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/RegionViewport.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- RegionViewport.java 14 Nov 2002 11:13:32 -0000 1.7 +++ RegionViewport.java 23 Jan 2003 18:59:07 -0000 1.8 @@ -95,7 +95,7 @@ public Object clone() { RegionViewport rv = new RegionViewport((Rectangle2D)viewArea.clone()); rv.region = (RegionReference)region.clone(); - if(props != null) { + if (props != null) { rv.props = (HashMap)props.clone(); } return rv; 1.2 +7 -5 xml-fop/src/org/apache/fop/area/RenderPagesModel.java Index: RenderPagesModel.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/RenderPagesModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RenderPagesModel.java 22 Dec 2002 22:40:31 -0000 1.1 +++ RenderPagesModel.java 23 Jan 2003 18:59:07 -0000 1.2 @@ -1,9 +1,9 @@ /* -* $Id$ -* Copyright (C) 2002 The Apache Software Foundation. All rights reserved. -* For details on use and redistribution please refer to the -* LICENSE file included with these sources. -*/ + * $Id$ + * Copyright (C) 2002 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ package org.apache.fop.area; @@ -94,6 +94,8 @@ /** * Check prepared pages + * + * @param newpage the new page being added * @return true if the current page should be rendered * false if the renderer doesn't support out of order * rendering and there are pending pages 1.7 +33 -3 xml-fop/src/org/apache/fop/area/Span.java Index: Span.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Span.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Span.java 14 Nov 2002 11:13:32 -0000 1.6 +++ Span.java 23 Jan 2003 18:59:07 -0000 1.7 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ @@ -10,28 +10,58 @@ import java.util.List; import java.util.ArrayList; -// this is a reference area block area with 0 border and padding +/** + * The span reference area. + * This is a reference area block area with 0 border and padding + * The span reference areas are stacked inside the main reference area. + */ public class Span extends Area { // the list of flow reference areas in this span area private List flowAreas; private int height; + /** + * Create a span area with the number of columns for this span area. + * + * @param cols the number of columns in the span + */ public Span(int cols) { flowAreas = new ArrayList(cols); } + /** + * Add the flow area to this span area. + * + * @param flow the flow area to add + */ public void addFlow(Flow flow) { flowAreas.add(flow); } + /** + * Get the column count for this span area. + * + * @return the number of columns in this span area + */ public int getColumnCount() { return flowAreas.size(); } + /** + * Get the height of this span area. + * + * @return the height of this span area + */ public int getHeight() { return height; } + /** + * Get the flow area for a particular column. + * + * @param count the column number for the flow + * @return the flow area for the requested column + */ public Flow getFlow(int count) { return (Flow) flowAreas.get(count); } 1.2 +6 -6 xml-fop/src/org/apache/fop/area/StorePagesModel.java Index: StorePagesModel.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/StorePagesModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StorePagesModel.java 22 Dec 2002 22:40:31 -0000 1.1 +++ StorePagesModel.java 23 Jan 2003 18:59:07 -0000 1.2 @@ -1,9 +1,9 @@ /* -* $Id$ -* Copyright (C) 2002 The Apache Software Foundation. All rights reserved. -* For details on use and redistribution please refer to the -* LICENSE file included with these sources. -*/ + * $Id$ + * Copyright (C) 2002 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ package org.apache.fop.area; @@ -134,4 +134,4 @@ */ public void endDocument() { } -} \ No newline at end of file +} 1.12 +29 -28 xml-fop/src/org/apache/fop/area/Trait.java Index: Trait.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Trait.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Trait.java 19 Dec 2002 00:35:31 -0000 1.11 +++ Trait.java 23 Jan 2003 18:59:07 -0000 1.12 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ @@ -128,7 +128,7 @@ */ public static final Integer PADDING_AFTER = new Integer(22); - private static final Map shmTraitInfo = new HashMap(); + private static final Map TRAIT_INFO = new HashMap(); private static class TraitInfo { String sName; @@ -141,42 +141,42 @@ static { // Create a hashmap mapping trait code to name for external representation - shmTraitInfo.put(ID_LINK, new TraitInfo("id-link", String.class)); - shmTraitInfo.put(INTERNAL_LINK, + TRAIT_INFO.put(ID_LINK, new TraitInfo("id-link", String.class)); + TRAIT_INFO.put(INTERNAL_LINK, new TraitInfo("internal-link", String.class)); - shmTraitInfo.put(EXTERNAL_LINK, + TRAIT_INFO.put(EXTERNAL_LINK, new TraitInfo("external-link", String.class)); - shmTraitInfo.put(FONT_NAME, + TRAIT_INFO.put(FONT_NAME, new TraitInfo("font-family", String.class)); - shmTraitInfo.put(FONT_SIZE, + TRAIT_INFO.put(FONT_SIZE, new TraitInfo("font-size", Integer.class)); - shmTraitInfo.put(COLOR, new TraitInfo("color", String.class)); - shmTraitInfo.put(ID_AREA, new TraitInfo("id-area", String.class)); - shmTraitInfo.put(BACKGROUND, + TRAIT_INFO.put(COLOR, new TraitInfo("color", String.class)); + TRAIT_INFO.put(ID_AREA, new TraitInfo("id-area", String.class)); + TRAIT_INFO.put(BACKGROUND, new TraitInfo("background", Background.class)); - shmTraitInfo.put(UNDERLINE, + TRAIT_INFO.put(UNDERLINE, new TraitInfo("underline", Boolean.class)); - shmTraitInfo.put(OVERLINE, + TRAIT_INFO.put(OVERLINE, new TraitInfo("overline", Boolean.class)); - shmTraitInfo.put(LINETHROUGH, + TRAIT_INFO.put(LINETHROUGH, new TraitInfo("linethrough", Boolean.class)); - shmTraitInfo.put(OFFSET, new TraitInfo("offset", Integer.class)); - shmTraitInfo.put(SHADOW, new TraitInfo("shadow", Integer.class)); - shmTraitInfo.put(BORDER_START, + TRAIT_INFO.put(OFFSET, new TraitInfo("offset", Integer.class)); + TRAIT_INFO.put(SHADOW, new TraitInfo("shadow", Integer.class)); + TRAIT_INFO.put(BORDER_START, new TraitInfo("border-start", BorderProps.class)); - shmTraitInfo.put(BORDER_END, + TRAIT_INFO.put(BORDER_END, new TraitInfo("border-end", BorderProps.class)); - shmTraitInfo.put(BORDER_BEFORE, + TRAIT_INFO.put(BORDER_BEFORE, new TraitInfo("border-before", BorderProps.class)); - shmTraitInfo.put(BORDER_AFTER, + TRAIT_INFO.put(BORDER_AFTER, new TraitInfo("border-after", BorderProps.class)); - shmTraitInfo.put(PADDING_START, + TRAIT_INFO.put(PADDING_START, new TraitInfo("padding-start", Integer.class)); - shmTraitInfo.put(PADDING_END, + TRAIT_INFO.put(PADDING_END, new TraitInfo("padding-end", Integer.class)); - shmTraitInfo.put(PADDING_BEFORE, + TRAIT_INFO.put(PADDING_BEFORE, new TraitInfo("padding-before", Integer.class)); - shmTraitInfo.put(PADDING_AFTER, + TRAIT_INFO.put(PADDING_AFTER, new TraitInfo("padding-after", Integer.class)); } @@ -187,7 +187,7 @@ * @return the trait name */ public static String getTraitName(Object traitCode) { - Object obj = shmTraitInfo.get(traitCode); + Object obj = TRAIT_INFO.get(traitCode); if (obj != null) { return ((TraitInfo) obj).sName; } else { @@ -202,7 +202,7 @@ * @return the trait code object */ public static Object getTraitCode(String sTraitName) { - Iterator iter = shmTraitInfo.entrySet().iterator(); + Iterator iter = TRAIT_INFO.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); TraitInfo ti = (TraitInfo) entry.getValue(); @@ -220,7 +220,7 @@ * @return the class type for the trait */ private static Class getTraitClass(Object oTraitCode) { - TraitInfo ti = (TraitInfo) shmTraitInfo.get(oTraitCode); + TraitInfo ti = (TraitInfo) TRAIT_INFO.get(oTraitCode); return (ti != null ? ti.sClass : null); } @@ -270,8 +270,9 @@ // See what type of object it is // Convert string value to an object of that type Class tclass = getTraitClass(oCode); - if (tclass == null) + if (tclass == null) { return null; + } if (tclass.equals(String.class)) { return sTraitValue; } 1.6 +2 -2 xml-fop/src/org/apache/fop/area/inline/Container.java Index: Container.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Container.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Container.java 19 Dec 2002 00:35:31 -0000 1.5 +++ Container.java 23 Jan 2003 18:59:08 -0000 1.6 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ 1.14 +42 -4 xml-fop/src/org/apache/fop/area/inline/InlineArea.java Index: InlineArea.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/InlineArea.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- InlineArea.java 14 Nov 2002 11:13:33 -0000 1.13 +++ InlineArea.java 23 Jan 2003 18:59:08 -0000 1.14 @@ -1,6 +1,6 @@ /* * $Id$ - * Copyright (C) 2002 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ @@ -22,10 +22,15 @@ public class InlineArea extends Area { // int width; private int height; + /** + * The content ipd of this inline area + */ protected int contentIPD = 0; - // offset position from top of parent area - int verticalPosition = 0; + /** + * offset position from top of parent area + */ + protected int verticalPosition = 0; /** * Render this inline area. @@ -58,26 +63,59 @@ return contentIPD; } + /** + * Set the inline progression dimension of this inline area. + * + * @param ipd the inline progression dimension + */ public void setIPD(int ipd) { this.contentIPD = ipd; } + /** + * Get the inline progression dimension + * + * @return the inline progression dimension of this area + */ public int getIPD() { return this.contentIPD; } + /** + * Increase the inline progression dimensions of this area. + * This is used for inline parent areas that contain mulitple child areas. + * + * @param ipd the inline progression to increase by + */ public void increaseIPD(int ipd) { this.contentIPD += ipd; } + /** + * Set the height of this inline area. + * + * @param h the height value to set + */ public void setHeight(int h) { height = h; } + /** + * Get the height of this inline area. + * + * @return the height of the inline area + */ public int getHeight() { return height; } + /** + * Get the allocation inline progression dimension of this area. + * This adds the content, borders and the padding to find the + * total allocated IPD. + * + * @return the total IPD allocation for this area + */ public int getAllocIPD() { // If start or end border or padding is non-zero, add to content IPD int iBP = contentIPD; 1.9 +6 -1 xml-fop/src/org/apache/fop/area/inline/Word.java Index: Word.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/inline/Word.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Word.java 14 Nov 2002 11:13:33 -0000 1.8 +++ Word.java 23 Jan 2003 18:59:08 -0000 1.9 @@ -9,6 +9,11 @@ import org.apache.fop.render.Renderer; +/** + * A word inline area. + * This is really a collection character inline areas collected together + * into a single word. + */ public class Word extends InlineArea { /** * The word for this word area.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]