[FOray-commit] SF.net SVN: foray: [7822] trunk/foray/foray-pdf
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-07-23 20:07:14
|
Revision: 7822 Author: victormote Date: 2006-07-23 13:07:00 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7822&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-pdf/.project trunk/foray/foray-pdf/src/java/org/foray/pdf/PDFGraphicsState.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFAElementBridge.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFANode.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsConfiguration.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsDevice.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java Modified: trunk/foray/foray-pdf/.project =================================================================== --- trunk/foray/foray-pdf/.project 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/.project 2006-07-23 20:07:00 UTC (rev 7822) @@ -10,12 +10,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/PDFGraphicsState.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/PDFGraphicsState.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/PDFGraphicsState.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -79,7 +79,7 @@ * @param newStrokeColor The color that stroke operations should now use. * @return True if the Graphics State was changed by this operation. */ - public boolean setStrokeColor(PDFColor newStrokeColor) { + public boolean setStrokeColor(final PDFColor newStrokeColor) { boolean anyChange = false; if (! newStrokeColor.equals(this.strokeColor)) { this.strokeColor = newStrokeColor; @@ -96,7 +96,7 @@ * @param newFillColor The color that non-stroke operations should now use. * @return True if the Graphics State was changed by this operation. */ - public boolean setFillColor(PDFColor newFillColor) { + public boolean setFillColor(final PDFColor newFillColor) { boolean anyChange = false; if (! newFillColor.equals(this.fillColor)) { this.fillColor = newFillColor; @@ -105,7 +105,7 @@ return anyChange; } - public boolean setCharacterSpacing(float newCharacterSpacing) { + public boolean setCharacterSpacing(final float newCharacterSpacing) { boolean anyChange = false; if (newCharacterSpacing != this.characterSpacing) { this.characterSpacing = newCharacterSpacing; @@ -114,7 +114,7 @@ return anyChange; } - public boolean setWordSpacing(float newWordSpacing) { + public boolean setWordSpacing(final float newWordSpacing) { boolean anyChange = false; if (newWordSpacing != this.wordSpacing) { this.wordSpacing = newWordSpacing; @@ -123,7 +123,7 @@ return anyChange; } - public boolean setFont(PDFFont newFont) { + public boolean setFont(final PDFFont newFont) { boolean anyChange = false; if (! newFont.equals(this.font)) { this.font = newFont; @@ -136,7 +136,7 @@ return this.font; } - public boolean setFontSize(float newFontSize) { + public boolean setFontSize(final float newFontSize) { boolean anyChange = false; if (newFontSize != this.fontSize) { this.fontSize = newFontSize; @@ -155,8 +155,8 @@ * @param newDashPhase The new dash phase. * @return True if the Graphics State was changed by this operation. */ - public boolean setLineDashPattern(float[] newDashArray, - float newDashPhase) { + public boolean setLineDashPattern(final float[] newDashArray, + final float newDashPhase) { boolean anyChange = false; anyChange |= setLineDashArray(newDashArray); anyChange |= setLineDashPhase(newDashPhase); @@ -168,7 +168,7 @@ * @param newDashArray The new dash array. * @return True if the Graphics State was changed by this operation. */ - private boolean setLineDashArray(float[] newDashArray) { + private boolean setLineDashArray(final float[] newDashArray) { /* Null is a valid value for a dash array. If either the new or old * value is null, or both, we need to handle those cases before trying * to test equality between the two values. */ @@ -200,7 +200,7 @@ * @param newDashPhase The new dash phase. * @return True if the Graphics State was changed by this operation. */ - private boolean setLineDashPhase(float newDashPhase) { + private boolean setLineDashPhase(final float newDashPhase) { boolean anyChange = false; if (newDashPhase != this.dashPhase) { this.dashPhase = newDashPhase; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFAElementBridge.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFAElementBridge.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFAElementBridge.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -46,7 +46,7 @@ */ public PDFAElementBridge() {} - public void setCurrentTransform(AffineTransform tf) { + public void setCurrentTransform(final AffineTransform tf) { transform = tf; } @@ -71,8 +71,9 @@ * @param ctx the bridge context to use * @param e the element that describes the graphics node to build */ - public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { - PDFANode aNode = (PDFANode)super.createGraphicsNode(ctx, e); + public GraphicsNode createGraphicsNode(final BridgeContext ctx, + final Element e) { + final PDFANode aNode = (PDFANode)super.createGraphicsNode(ctx, e); aNode.setDestination(((SVGAElement)e).getHref().getBaseVal()); aNode.setTransform(transform); return aNode; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFANode.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFANode.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFANode.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -50,11 +50,11 @@ /** * Set the destination String. */ - public void setDestination(String dest) { + public void setDestination(final String dest) { destination = dest; } - public void setTransform(AffineTransform tf) { + public void setTransform(final AffineTransform tf) { transform = tf; } @@ -63,7 +63,7 @@ * * @param g2d the Graphics2D to use */ - public void paint(PDFPage pdfPage, Graphics2D g2d) { + public void paint(final PDFPage pdfPage, final Graphics2D g2d) { if (! isVisible) { return; } @@ -71,21 +71,21 @@ if (! (g2d instanceof PDFGraphics2D)) { return; } - PDFGraphics2D pdfg = (PDFGraphics2D)g2d; + final PDFGraphics2D pdfg = (PDFGraphics2D)g2d; boolean externalLink = true; - Shape outline = getOutline(); + final Shape outline = getOutline(); if(destination.startsWith("#svgView(viewBox(")) { externalLink = false; - String nums = destination.substring(18, + final String nums = destination.substring(18, destination.length() - 2); float x = 0; float y = 0; float width = 0; int count = 0; try { - StringTokenizer st = new StringTokenizer(nums, ","); + final StringTokenizer st = new StringTokenizer(nums, ","); while(st.hasMoreTokens()) { - String tok = st.nextToken(); + final String tok = st.nextToken(); count++; switch(count) { case 1: @@ -103,7 +103,7 @@ break; } } - } catch(Exception e) { + } catch(final Exception e) { } // these numbers need conversion to current // svg position and scaled for the page Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -71,8 +71,9 @@ * @param width the width of the document * @param height the height of the document */ - public PDFDocumentGraphics2D(boolean textAsShapes, OutputStream stream, - int width, int height, String appName, FontConsumer fontConsumer) + public PDFDocumentGraphics2D(final boolean textAsShapes, + final OutputStream stream, final int width, final int height, + final String appName, final FontConsumer fontConsumer) throws PDFException { super(textAsShapes); @@ -101,7 +102,7 @@ * The result is scaled so that the svg fits correctly inside the pdf * document. */ - public void setSVGDimension(float w, float h) { + public void setSVGDimension(final float w, final float h) { currentStream.write("" + PSReal.doubleOut(width / w) + " 0 0 " + PSReal.doubleOut(height / h) + " 0 0 cm\n"); } @@ -111,7 +112,7 @@ * This is used to set the background for the pdf document * Rather than leaving it as the default white. */ - public void setBackgroundColor(Color col) { + public void setBackgroundColor(final Color col) { currentColour = new PDFColor(col); currentStream.write("q\n"); currentStream.write(currentColour.getColorSpaceOut(true)); @@ -129,10 +130,10 @@ * This will then write the results to the output stream. */ public void finish() throws IOException { - PDFResources pdfResources = this.pdfDoc.getResources(); - PDFPage currentPage = new PDFPage(this.pdfDoc, pdfResources, width, - height); - PDFContentStream contentStream = (PDFContentStream) + final PDFResources pdfResources = this.pdfDoc.getResources(); + final PDFPage currentPage = new PDFPage(this.pdfDoc, pdfResources, + width, height); + final PDFContentStream contentStream = (PDFContentStream) currentPage.getContentStream(); contentStream.add(getString()); if(currentAnnotList != null) { @@ -143,14 +144,14 @@ pdfDoc.close(stream); } - public void setGraphicContext(GraphicContext c) { + public void setGraphicContext(final GraphicContext c) { gc = c; } /** * This constructor supports the create method */ - public PDFDocumentGraphics2D(PDFDocumentGraphics2D g) { + public PDFDocumentGraphics2D(final PDFDocumentGraphics2D g) { super(g); } @@ -164,12 +165,12 @@ return new PDFDocumentGraphics2D(this); } - public void drawString(String s, float x, float y) { + public void drawString(final String s, final float x, final float y) { if (super.textAsShapes) { - Font font = super.getFont(); - FontRenderContext frc = super.getFontRenderContext(); - GlyphVector gv = font.createGlyphVector(frc, s); - Shape glyphOutline = gv.getOutline(x, y); + final Font font = super.getFont(); + final FontRenderContext frc = super.getFontRenderContext(); + final GlyphVector gv = font.createGlyphVector(frc, s); + final Shape glyphOutline = gv.getOutline(x, y); super.fill(glyphOutline); } else { super.drawString(s, x, y); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -142,13 +142,14 @@ * This is used to create a Graphics object for use inside an already * existing document. */ - public PDFGraphics2D(boolean textAsShapes, PDFDocument doc, - Rectangle2D.Float contentRectangle, - SVGDocument svgDocument, FontConsumer fontConsumer) { + public PDFGraphics2D(final boolean textAsShapes, final PDFDocument doc, + final Rectangle2D.Float contentRectangle, + final SVGDocument svgDocument, final FontConsumer fontConsumer) { super(textAsShapes); pdfDoc = doc; this.fontConsumer = fontConsumer; - org.axsl.pdfW.PDFFont pdfFont = doc.getCurrentGraphicsState().getFont(); + final org.axsl.pdfW.PDFFont pdfFont = + doc.getCurrentGraphicsState().getFont(); if (pdfFont == null) { this.currentFont = null; } else { @@ -162,19 +163,19 @@ /** * @param svgDocument */ - private void transformCoordinates(Rectangle2D.Float contentRectangle, - SVGDocument svgDocument) { + private void transformCoordinates(final Rectangle2D.Float contentRectangle, + final SVGDocument svgDocument) { // transform so that the coordinates (0,0) is from the top left // and positive is down and to the right. (0,0) is where the // viewBox puts it. currentStream.write("1 0 0 -1 " + contentRectangle.x + " " + contentRectangle.y + " cm\n"); - SVGSVGElement svg = svgDocument.getRootElement(); - AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, + final SVGSVGElement svg = svgDocument.getRootElement(); + final AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, contentRectangle.width, contentRectangle.height); if (!at.isIdentity()) { - double[] vals = new double[6]; + final double[] vals = new double[6]; at.getMatrix(vals); currentStream.write(PSReal.doubleOut(vals[0], 8) + " " + PSReal.doubleOut(vals[1], 8) + " " @@ -185,7 +186,7 @@ } } - public PDFGraphics2D(boolean textAsShapes) { + public PDFGraphics2D(final boolean textAsShapes) { super(textAsShapes); } @@ -193,12 +194,12 @@ return currentStream.toString(); } - public void setGraphicContext(GraphicContext c) { + public void setGraphicContext(final GraphicContext c) { gc = c; } - public void setOverrideFontState(org.axsl.fontR.FontUse infont, - float size) { + public void setOverrideFontState(final org.axsl.fontR.FontUse infont, + final float size) { this.overrideFont = infont; this.overrideFontSize = size; } @@ -206,7 +207,7 @@ /** * This constructor supports the create method */ - public PDFGraphics2D(PDFGraphics2D g) { + public PDFGraphics2D(final PDFGraphics2D g) { super(g); } @@ -224,19 +225,21 @@ * This is a pdf specific method used to add a link to the * pdf document. */ - public void addLink(PDFPage pdfPage, Shape bounds, AffineTransform trans, - String dest, boolean externalLink) { + public void addLink(final PDFPage pdfPage, final Shape bounds, + final AffineTransform trans, final String dest, + final boolean externalLink) { if(currentAnnotList == null) { currentAnnotList = new PDFAnnotList(pdfDoc); } - AffineTransform at = getTransform(); + final AffineTransform at = getTransform(); Shape b = at.createTransformedShape(bounds); b = trans.createTransformedShape(b); - Rectangle2D.Float linkRectangle = (Rectangle2D.Float) b.getBounds2D(); + final Rectangle2D.Float linkRectangle = + (Rectangle2D.Float) b.getBounds2D(); linkRectangle.height *= -1; PDFLink link = null; if (externalLink) { - String pdfdest = "/XYZ " + dest; + final String pdfdest = "/XYZ " + dest; link = new PDFLink(pdfDoc, pdfPage, linkRectangle, pdfdest); } else { link = (PDFLink) pdfPage.makeLink(linkRectangle, dest, false); @@ -248,18 +251,18 @@ return currentAnnotList; } - public void addJpegImage(Graphic jpeg, float x, float y, float width, - float height) throws GraphicException { - Rectangle2D.Float contentRectangle = new Rectangle2D.Float(x, y, width, - height); - PDFXObject xObject = PDFXObject.makeXObject(this.pdfDoc, jpeg, + public void addJpegImage(final Graphic jpeg, final float x, final float y, + final float width, final float height) throws GraphicException { + final Rectangle2D.Float contentRectangle = new Rectangle2D.Float(x, y, + width, height); + final PDFXObject xObject = PDFXObject.makeXObject(this.pdfDoc, jpeg, contentRectangle, null); - AffineTransform at = getTransform(); - double[] matrix = new double[6]; + final AffineTransform at = getTransform(); + final double[] matrix = new double[6]; at.getMatrix(matrix); currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); currentStream.write("" + matrix[0] + " " + matrix[1] + " " + matrix[2] + " " + matrix[3] + " " @@ -297,19 +300,19 @@ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, * int, int, int) */ - public boolean drawImage(Image img, int x, int y, - ImageObserver observer) { - int width = img.getWidth(observer); - int height = img.getHeight(observer); + public boolean drawImage(final Image img, final int x, final int y, + final ImageObserver observer) { + final int width = img.getWidth(observer); + final int height = img.getHeight(observer); if (width == -1 || height == -1) { return false; } - Dimension size = new Dimension(width * 3, height * 3); - BufferedImage buf = buildBufferedImage(size); + final Dimension size = new Dimension(width * 3, height * 3); + final BufferedImage buf = buildBufferedImage(size); - Graphics2D g = buf.createGraphics(); + final Graphics2D g = buf.createGraphics(); g.setComposite(AlphaComposite.SrcOver); g.setBackground(new Color(1, 1, 1, 0)); g.setPaint(new Color(1, 1, 1, 0)); @@ -324,15 +327,15 @@ final byte[] result = new byte[buf.getWidth() * buf.getHeight() * 3]; - Raster raster = buf.getData(); - DataBuffer bd = raster.getDataBuffer(); + final Raster raster = buf.getData(); + final DataBuffer bd = raster.getDataBuffer(); int count = 0; int[] iarray; int i, j, val, alpha, add, mult; switch (bd.getDataType()) { case DataBuffer.TYPE_INT: - int[][] idata = ((DataBufferInt)bd).getBankData(); + final int[][] idata = ((DataBufferInt)bd).getBankData(); for (i = 0; i < idata.length; i++) { iarray = idata[i]; for (j = 0; j < iarray.length; j++) { @@ -367,11 +370,11 @@ // now do any transformation required and add the actual image // placement instance - AffineTransform at = getTransform(); - double[] matrix = new double[6]; + final AffineTransform at = getTransform(); + final double[] matrix = new double[6]; at.getMatrix(matrix); currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); currentStream.write("" + matrix[0] + " " + matrix[1] + " " + matrix[2] + " " + matrix[3] + " " @@ -383,7 +386,7 @@ return true; } - public BufferedImage buildBufferedImage(Dimension size) { + public BufferedImage buildBufferedImage(final Dimension size) { return new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB); } @@ -422,8 +425,8 @@ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, * int, int, int) */ - public boolean drawImage(Image img, int x, int y, int width, int height, - ImageObserver observer) { + public boolean drawImage(final Image img, final int x, final int y, + final int width, final int height, final ImageObserver observer) { return true; } @@ -475,7 +478,7 @@ * @see AbstractGraphics2D#clip * @see AbstractGraphics2D#setComposite */ - public void draw(Shape s) { + public void draw(final Shape s) { Color c; c = getColor(); if(c.getAlpha() == 0) { @@ -483,15 +486,15 @@ } currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); applyColor(c, false); applyPaint(getPaint(), false); applyStroke(getStroke()); - AffineTransform trans = getTransform(); - double[] tranvals = new double[6]; + final AffineTransform trans = getTransform(); + final double[] tranvals = new double[6]; trans.getMatrix(tranvals); currentStream.write(PSReal.doubleOut(tranvals[0], 8) + " " + PSReal.doubleOut(tranvals[1], 8) + " " @@ -500,10 +503,10 @@ + PSReal.doubleOut(tranvals[4], 8) + " " + PSReal.doubleOut(tranvals[5], 8) + " cm\n"); - PathIterator iter = s.getPathIterator(new AffineTransform()); + final PathIterator iter = s.getPathIterator(new AffineTransform()); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: currentStream.write(PSReal.doubleOut(vals[0]) + " " @@ -539,14 +542,14 @@ currentStream.write("Q\n"); } - protected void writeClip(Shape s) { + protected void writeClip(final Shape s) { if (s == null) { return; } - PathIterator iter = s.getPathIterator(getTransform()); + final PathIterator iter = s.getPathIterator(getTransform()); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: currentStream.write(PSReal.doubleOut(vals[0]) + " " @@ -583,29 +586,29 @@ currentStream.write("n\n"); } - protected void applyColor(Color col, boolean fill) { - Color c = col; + protected void applyColor(final Color col, final boolean fill) { + final Color c = col; if (c.getColorSpace().getType() == java.awt.color.ColorSpace.TYPE_RGB) { currentColour = new PDFColor(c); currentStream.write(currentColour.getColorSpaceOut(fill)); } else if (c.getColorSpace().getType() == java.awt.color.ColorSpace.TYPE_CMYK) { - float[] cComps = c.getColorComponents(new float[3]); - float[] cmyk = new float[3]; + final float[] cComps = c.getColorComponents(new float[3]); + final float[] cmyk = new float[3]; for (int i = 0; i < 3; i++) { // convert the float elements to doubles for pdf cmyk[i] = cComps[i]; } - Color cmykColor = ColorSpaceCMYK.makeColor(cmyk[0], cmyk[1], + final Color cmykColor = ColorSpaceCMYK.makeColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]); currentColour = new PDFColor(cmykColor); currentStream.write(currentColour.getColorSpaceOut(fill)); } else if (c.getColorSpace().getType() == java.awt.color.ColorSpace.TYPE_2CLR) { // used for black/magenta - float[] cComps = c.getColorComponents(new float[1]); - double[] blackMagenta = new double[1]; + final float[] cComps = c.getColorComponents(new float[1]); + final double[] blackMagenta = new double[1]; for (int i = 0; i < 1; i++) { blackMagenta[i] = cComps[i]; } @@ -617,57 +620,59 @@ } } - protected void applyPaint(Paint paint, boolean fill) { + protected void applyPaint(final Paint paint, final boolean fill) { if (paint instanceof GradientPaint) { - GradientPaint gp = (GradientPaint)paint; - Color c1 = gp.getColor1(); - Color c2 = gp.getColor2(); - Point2D p1 = gp.getPoint1(); - Point2D p2 = gp.getPoint2(); + final GradientPaint gp = (GradientPaint)paint; + final Color c1 = gp.getColor1(); + final Color c2 = gp.getColor2(); + final Point2D p1 = gp.getPoint1(); + final Point2D p2 = gp.getPoint2(); - List theCoords = new ArrayList(); + final List theCoords = new ArrayList(); theCoords.add(new Double(p1.getX())); theCoords.add(new Double(p1.getY())); theCoords.add(new Double(p2.getX())); theCoords.add(new Double(p2.getY())); - List theExtend = new ArrayList(); + final List theExtend = new ArrayList(); theExtend.add(new Boolean(true)); theExtend.add(new Boolean(true)); - List theDomain = new ArrayList(); + final List theDomain = new ArrayList(); theDomain.add(new Double(0)); theDomain.add(new Double(1)); - List theEncode = new ArrayList(); + final List theEncode = new ArrayList(); theEncode.add(new Double(0)); theEncode.add(new Double(1)); theEncode.add(new Double(0)); theEncode.add(new Double(1)); - List theBounds = new ArrayList(); + final List theBounds = new ArrayList(); theBounds.add(new Double(0)); theBounds.add(new Double(1)); - List someColors = new ArrayList(); + final List someColors = new ArrayList(); - PDFColor color1 = new PDFColor(c1); + final PDFColor color1 = new PDFColor(c1); someColors.add(color1); - PDFColor color2 = new PDFColor(c2); + final PDFColor color2 = new PDFColor(c2); someColors.add(color2); - ColorSpace aColorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); - PDFPattern myPat = PDFPattern.createGradient(false, aColorSpace, + final ColorSpace aColorSpace = ColorSpace.getInstance( + ColorSpace.CS_sRGB); + final PDFPattern myPat = PDFPattern.createGradient(false, + aColorSpace, someColors, null, theCoords, pdfDoc); currentStream.write(myPat.getColorSpaceOut(fill)); } else if (paint instanceof TexturePaint) {} } - protected void applyStroke(Stroke stroke) { + protected void applyStroke(final Stroke stroke) { if (stroke instanceof BasicStroke) { - BasicStroke bs = (BasicStroke)stroke; + final BasicStroke bs = (BasicStroke)stroke; - float[] da = bs.getDashArray(); + final float[] da = bs.getDashArray(); if (da != null) { currentStream.write("["); for (int count = 0; count < da.length; count++) { @@ -683,10 +688,10 @@ } } currentStream.write("] "); - float offset = bs.getDashPhase(); + final float offset = bs.getDashPhase(); currentStream.write(((int)offset) + " d\n"); } - int ec = bs.getEndCap(); + final int ec = bs.getEndCap(); switch (ec) { case BasicStroke.CAP_BUTT: currentStream.write(0 + " J\n"); @@ -699,7 +704,7 @@ break; } - int lj = bs.getLineJoin(); + final int lj = bs.getLineJoin(); switch (lj) { case BasicStroke.JOIN_MITER: currentStream.write(0 + " j\n"); @@ -711,10 +716,10 @@ currentStream.write(2 + " j\n"); break; } - float lw = bs.getLineWidth(); + final float lw = bs.getLineWidth(); currentStream.write(PSReal.doubleOut(lw) + " w\n"); - float ml = bs.getMiterLimit(); + final float ml = bs.getMiterLimit(); currentStream.write(PSReal.doubleOut(ml) + " M\n"); } } @@ -738,7 +743,8 @@ * @see AbstractGraphics2D#setComposite * @see AbstractGraphics2D#clip */ - public void drawRenderedImage(RenderedImage img, AffineTransform xform) { + public void drawRenderedImage(final RenderedImage img, + final AffineTransform xform) { this.pdfDoc.getLogger().info("drawRenderedImage"); } @@ -773,8 +779,8 @@ * @see AbstractGraphics2D#clip * @see #drawRenderedImage */ - public void drawRenderableImage(RenderableImage img, - AffineTransform xform) { + public void drawRenderableImage(final RenderableImage img, + final AffineTransform xform) { this.pdfDoc.getLogger().info("drawRenderableImage"); } @@ -799,7 +805,7 @@ * @see AbstractGraphics2D#setTransform * @see AbstractGraphics2D#setComposite */ - public void drawString(String s, float x, float y) { + public void drawString(final String s, final float x, final float y) { org.axsl.fontR.FontUse font; float size; if (overrideFont == null) { @@ -814,7 +820,7 @@ if (font != this.currentFont || (size != this.currentFontSize)) { this.currentFont = font; this.currentFontSize = size; - PDFFont pdfFont = new PDFFont(pdfDoc, font); + final PDFFont pdfFont = new PDFFont(pdfDoc, font); currentStream.write("/" + pdfFont.getName() + size + " Tf\n"); @@ -822,7 +828,7 @@ currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); Color c = getColor(); applyColor(c, true); @@ -831,9 +837,9 @@ currentStream.write("BT\n"); - AffineTransform trans = getTransform(); + final AffineTransform trans = getTransform(); trans.translate(x, y); - double[] vals = new double[6]; + final double[] vals = new double[6]; trans.getMatrix(vals); currentStream.write(PSReal.doubleOut(vals[0], 8) + " " @@ -844,9 +850,9 @@ + PSReal.doubleOut(vals[5], 8) + " cm\n"); currentStream.write("1 0 0 -1 0 0 Tm "); - PDFFont pdfFont = new PDFFont(this.pdfDoc, font); - PDFString pdfString = new PDFString(this.pdfDoc, s, pdfFont); - String outputString = pdfString.toPDF(); + final PDFFont pdfFont = new PDFFont(this.pdfDoc, font); + final PDFString pdfString = new PDFString(this.pdfDoc, s, pdfFont); + final String outputString = pdfString.toPDF(); currentStream.write(outputString); currentStream.write("ET\n"); @@ -858,12 +864,12 @@ * java.awt.Font that comes from the Batik environment. */ private org.axsl.fontR.FontUse getImplicitFont() { - Font gFont = getFont(); + final Font gFont = getFont(); String fontFamily = gFont.getFamily(); if (fontFamily.equals("sanserif")) { fontFamily = "sans-serif"; } - float fontSize = gFont.getSize(); + final float fontSize = gFont.getSize(); int fontStyle = org.axsl.fontR.Font.FONT_STYLE_NORMAL; if (gFont.isItalic()) { fontStyle = org.axsl.fontR.Font.FONT_STYLE_ITALIC; @@ -873,7 +879,8 @@ fontWeight = org.axsl.fontR.Font.FONT_WEIGHT_BOLD; } try { - FontConsumer fontConsumer = this.currentFont.getFontConsumer(); + final FontConsumer fontConsumer = + this.currentFont.getFontConsumer(); return fontConsumer.selectFontXSL( org.axsl.fontR.Font.FONT_SELECTION_AUTO, FontUtility.foFontFamily(fontFamily), @@ -882,7 +889,7 @@ org.axsl.fontR.Font.FONT_STRETCH_NORMAL, (int) (fontSize * 1000), ' '); - } catch (FontException exception) { + } catch (final FontException exception) { exception.printStackTrace(); return null; } @@ -910,12 +917,12 @@ * @see AbstractGraphics2D#setTransform * @see AbstractGraphics2D#setComposite */ - public void drawString(AttributedCharacterIterator iterator, float x, - float y) { + public void drawString(final AttributedCharacterIterator iterator, + final float x, final float y) { this.pdfDoc.getLogger().error( "drawString(AttributedCharacterIterator)"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); Color c = getColor(); applyColor(c, true); @@ -924,34 +931,34 @@ currentStream.write("BT\n"); - AffineTransform trans = getTransform(); + final AffineTransform trans = getTransform(); trans.translate(x, y); - double[] vals = new double[6]; + final double[] vals = new double[6]; trans.getMatrix(vals); for (char ch = iterator.first(); ch != CharacterIterator.DONE; ch = iterator.next()) { /* TODO: All of this should be integrated with the regular methods * in PDFContentStream. */ - String[] fontFamily = new String[1]; + final String[] fontFamily = new String[1]; fontFamily[0] = (String) iterator.getAttribute( TextAttribute.FAMILY); - Float fontSize = (Float) iterator.getAttribute( + final Float fontSize = (Float) iterator.getAttribute( TextAttribute.FAMILY); org.axsl.fontR.FontUse font; try { font = this.fontConsumer.selectFontCSS( fontFamily, 0, 0, 0, 0, 0, ch); - } catch (FontException e) { + } catch (final FontException e) { /* We can't find a font for this character, so skip it. */ continue; } - float size = fontSize.floatValue(); + final float size = fontSize.floatValue(); if ((font != this.currentFont) || (size != this.currentFontSize)) { this.currentFont = font; this.currentFontSize = size; - PDFFont pdfFont = new PDFFont(pdfDoc, font); + final PDFFont pdfFont = new PDFFont(pdfDoc, font); currentStream.write("/" + pdfFont.getName() + " " + size + " Tf\n"); @@ -983,7 +990,7 @@ * @see AbstractGraphics2D#setComposite * @see AbstractGraphics2D#clip */ - public void fill(Shape s) { + public void fill(final Shape s) { // this.area.getLogger().error("fill"); Color c; c = getBackground(); @@ -994,7 +1001,7 @@ } } currentStream.write("q\n"); - Shape imclip = getClip(); + final Shape imclip = getClip(); writeClip(imclip); c = getColor(); applyColor(c, true); @@ -1003,10 +1010,10 @@ applyPaint(getPaint(), true); - PathIterator iter = s.getPathIterator(getTransform()); + final PathIterator iter = s.getPathIterator(getTransform()); while (!iter.isDone()) { - double vals[] = new double[6]; - int type = iter.currentSegment(vals); + final double vals[] = new double[6]; + final int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: currentStream.write(PSReal.doubleOut(vals[0]) + " " @@ -1043,7 +1050,8 @@ currentStream.write("Q\n"); } - protected void doDrawing(boolean fill, boolean stroke, boolean nonzero) { + protected void doDrawing(final boolean fill, final boolean stroke, + final boolean nonzero) { if (fill) { if (stroke) { if (nonzero) { @@ -1079,10 +1087,10 @@ private void initGraphicalEnvironment() { try { - BufferedImage bi = new BufferedImage(1, 1, + final BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); this.fmg = bi.createGraphics(); - } catch (LinkageError e) { + } catch (final LinkageError e) { pdfDoc.getLogger().error("Unable to create graphical " + "environment required to process SVG. Aborting."); e.printStackTrace(); @@ -1098,7 +1106,7 @@ * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ - public FontMetrics getFontMetrics(Font f) { + public FontMetrics getFontMetrics(final Font f) { return fmg.getFontMetrics(f); } @@ -1117,7 +1125,7 @@ * drawn twice, then all pixels are restored to their original values. * @param c1 the XOR alternation color */ - public void setXORMode(Color c1) { + public void setXORMode(final Color c1) { this.pdfDoc.getLogger().info("setXORMode"); } @@ -1141,8 +1149,8 @@ * @param dx the horizontal distance to copy the pixels. * @param dy the vertical distance to copy the pixels. */ - public void copyArea(int x, int y, int width, int height, int dx, - int dy) { + public void copyArea(final int x, final int y, final int width, + final int height, final int dx, final int dy) { this.pdfDoc.getLogger().info("copyArea"); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsConfiguration.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsConfiguration.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsConfiguration.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -48,8 +48,8 @@ * @param transparency the alpha value of the image * @return the new buffered image */ - public BufferedImage createCompatibleImage(int width, int height, - int transparency) { + public BufferedImage createCompatibleImage(final int width, + final int height, final int transparency) { if (transparency == Transparency.OPAQUE) { return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); @@ -65,7 +65,8 @@ * @param height the height of the image * @return the new buffered image */ - public BufferedImage createCompatibleImage(int width, int height) { + public BufferedImage createCompatibleImage(final int width, + final int height) { return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); } @@ -74,7 +75,8 @@ * Stub implementation to get Java 5 to compile. * TODO: This needs to be implemented properly. */ - public VolatileImage createCompatibleVolatileImage(int width, int height) { + public VolatileImage createCompatibleVolatileImage(final int width, + final int height) { return null; } @@ -82,8 +84,8 @@ * Stub implementation to get Java 5 to compile. * TODO: This needs to be implemented properly. */ - public VolatileImage createCompatibleVolatileImage(int width, int height, - int transparency) { + public VolatileImage createCompatibleVolatileImage(final int width, + final int height, final int transparency) { return null; } @@ -113,7 +115,7 @@ * @param transparency the alpha value for the colour model * @return the colour model for the configuration */ - public ColorModel getColorModel(int transparency) { + public ColorModel getColorModel(final int transparency) { if (transparency == Transparency.OPAQUE) { return BI_WITHOUT_ALPHA.getColorModel(); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsDevice.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsDevice.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphicsDevice.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -40,7 +40,7 @@ * * @param gc The gc we should reference */ - PDFGraphicsDevice(PDFGraphicsConfiguration gc) { + PDFGraphicsDevice(final PDFGraphicsConfiguration gc) { this.gc = gc; } @@ -51,7 +51,7 @@ * @return the best configuration which is the only one */ public GraphicsConfiguration getBestConfiguration( - GraphicsConfigTemplate gct) { + final GraphicsConfigTemplate gct) { return gc; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -73,7 +73,7 @@ */ public static class PDFJpegNode extends AbstractGraphicsNode { Graphic jpeg; - public PDFJpegNode(Graphic j) { + public PDFJpegNode(final Graphic j) { jpeg = j; } @@ -81,17 +81,17 @@ return getPrimitiveBounds(); } - public void primitivePaint(Graphics2D g2d) { + public void primitivePaint(final Graphics2D g2d) { if (g2d instanceof PDFGraphics2D) { - PDFGraphics2D pdfg = (PDFGraphics2D) g2d; + final PDFGraphics2D pdfg = (PDFGraphics2D) g2d; pdfg.setTransform(getTransform()); - float x = 0; - float y = 0; + final float x = 0; + final float y = 0; try { - float width = jpeg.pixelWidth(); - float height = jpeg.pixelHeight(); + final float width = jpeg.pixelWidth(); + final float height = jpeg.pixelHeight(); pdfg.addJpegImage(jpeg, x, y, width, height); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -105,7 +105,7 @@ try { return new Rectangle2D.Double(0, 0, jpeg.pixelWidth(), jpeg.pixelHeight()); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return null; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTextPainter.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -84,7 +84,7 @@ * @param logger A Log instance for logging user messages. * @param consumer The FontConsumer that should be used for font resolution. */ - public PDFTextPainter(Log logger, FontConsumer consumer) { + public PDFTextPainter(final Log logger, final FontConsumer consumer) { this.logger = logger; } @@ -94,8 +94,8 @@ * @param node the TextNode to paint * @param g2d the Graphics2D to use */ - public void paint(TextNode node, Graphics2D g2d) { - Point2D loc = node.getLocation(); + public void paint(final TextNode node, final Graphics2D g2d) { + final Point2D loc = node.getLocation(); /* AttributedCharacterIterator aci = @@ -109,7 +109,7 @@ return; } */ - TextNode.Anchor anchor = (TextNode.Anchor)node + final TextNode.Anchor anchor = (TextNode.Anchor)node .getAttributedCharacterIterator() .getAttribute(GVTAttributedCharacterIterator .TextAttribute.ANCHOR_TYPE); @@ -123,26 +123,27 @@ } - protected void paintTextRuns(List textRuns, Graphics2D g2d, Point2D loc) { + protected void paintTextRuns(final List textRuns, final Graphics2D g2d, + final Point2D loc) { Point2D currentloc = loc; - Iterator i = textRuns.iterator(); + final Iterator i = textRuns.iterator(); while (i.hasNext()) { - StrokingTextPainter.TextRun run = + final StrokingTextPainter.TextRun run = (StrokingTextPainter.TextRun)i.next(); currentloc = paintTextRun(run, g2d, currentloc); } } - protected Point2D paintTextRun(StrokingTextPainter.TextRun run, - Graphics2D g2d, Point2D loc) { - AttributedCharacterIterator aci = run.getACI(); + protected Point2D paintTextRun(final StrokingTextPainter.TextRun run, + final Graphics2D g2d, final Point2D loc) { + final AttributedCharacterIterator aci = run.getACI(); return paintACI(aci, g2d, loc); } - protected String getText(AttributedCharacterIterator aci) { - StringBuffer sb = new StringBuffer(aci.getEndIndex() + protected String getText(final AttributedCharacterIterator aci) { + final StringBuffer sb = new StringBuffer(aci.getEndIndex() - aci.getBeginIndex()); for (char c = aci.first(); c != CharacterIterator.DONE; c = aci.next()) { @@ -152,22 +153,22 @@ } - protected Point2D paintACI(AttributedCharacterIterator aci, Graphics2D g2d, - Point2D loc) { + protected Point2D paintACI(final AttributedCharacterIterator aci, + final Graphics2D g2d, final Point2D loc) { aci.first(); - TextNode.Anchor anchor = (TextNode.Anchor)aci.getAttribute + final TextNode.Anchor anchor = (TextNode.Anchor)aci.getAttribute (GVTAttributedCharacterIterator.TextAttribute.ANCHOR_TYPE); //Adjust position of span - Float xpos = (Float)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.X); - Float ypos = (Float)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.Y); - Float dxpos = (Float)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.DX); - Float dypos = (Float)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.DY); + final Float xpos = (Float)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.X); + final Float ypos = (Float)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.Y); + final Float dxpos = (Float)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.DX); + final Float dypos = (Float)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.DY); if (xpos != null) { loc.setLocation(xpos.doubleValue(), loc.getY()); } @@ -183,20 +184,20 @@ //Set up font - Float taFontSize = (Float)aci.getAttribute(TextAttribute.SIZE); + final Float taFontSize = (Float)aci.getAttribute(TextAttribute.SIZE); if (taFontSize == null) { return loc; } - TextPaintInfo tpi = (TextPaintInfo) aci.getAttribute( + final TextPaintInfo tpi = (TextPaintInfo) aci.getAttribute( GVTAttributedCharacterIterator.TextAttribute.PAINT_INFO); if (tpi == null) { return loc; } - Stroke stroke = tpi.strokeStroke; + final Stroke stroke = tpi.strokeStroke; g2d.setStroke(stroke); - Paint forg = (Paint)aci.getAttribute(TextAttribute.FOREGROUND); + final Paint forg = (Paint)aci.getAttribute(TextAttribute.FOREGROUND); if (forg instanceof Color) { g2d.setColor((Color)forg); } @@ -211,8 +212,8 @@ * To try to distinguish them, "awt", "fo", and "ta" prefixes are added * to local variable names. */ - Float taPosture = (Float)aci.getAttribute(TextAttribute.POSTURE); - Float taWeight = (Float)aci.getAttribute(TextAttribute.WEIGHT); + final Float taPosture = (Float)aci.getAttribute(TextAttribute.POSTURE); + final Float taWeight = (Float)aci.getAttribute(TextAttribute.WEIGHT); boolean isItalic = false; boolean isBold = false; @@ -236,22 +237,22 @@ try { this.fontToUse = getFontToUse(aci, g2d, taFontSize, isItalic, isBold); - } catch (FontException e) { + } catch (final FontException e) { e.printStackTrace(); } - String awtFontFamily = this.fontFamily; - int awtFontSize = Math.round(taFontSize.floatValue()); - java.awt.Font awtFont = new java.awt.Font(awtFontFamily, awtFontStyle, - awtFontSize); + final String awtFontFamily = this.fontFamily; + final int awtFontSize = Math.round(taFontSize.floatValue()); + final java.awt.Font awtFont = new java.awt.Font(awtFontFamily, + awtFontStyle, awtFontSize); g2d.setFont(awtFont); //Get text and paint - String txt = getText(aci); + final String txt = getText(aci); fontToUse.registerCharsUsed(txt); /* TODO: If letter-spacing is used, it needs to come from the SVG. */ - int letterSpacing = 0; - float advance = fontToUse.getFont().width(txt, awtFontSize * 1000, + final int letterSpacing = 0; + final float advance = fontToUse.getFont().width(txt, awtFontSize * 1000, letterSpacing, 0) / 1000f; float tx = 0; if (anchor != null) { @@ -274,8 +275,9 @@ * @param g2d * @param size */ - private org.axsl.fontR.FontUse getFontToUse(AttributedCharacterIterator aci, - Graphics2D g2d, Float size, boolean italic, boolean bold) + private org.axsl.fontR.FontUse getFontToUse( + final AttributedCharacterIterator aci, final Graphics2D g2d, + final Float size, final boolean italic, final boolean bold) throws FontException { org.axsl.fontR.FontUse font = null; int style = Font.FONT_STYLE_NORMAL; @@ -286,13 +288,13 @@ if (bold) { weight = org.axsl.fontR.Font.FONT_WEIGHT_BOLD; } - List gvtFonts = (List)aci.getAttribute(GVTAttributedCharacterIterator - .TextAttribute.GVT_FONT_FAMILIES); + final List gvtFonts = (List)aci.getAttribute( + GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES); - int fsize = (int)size.floatValue(); + final int fsize = (int)size.floatValue(); if (gvtFonts != null) { - for (Iterator i = gvtFonts.iterator(); i.hasNext(); ) { - GVTFontFamily fam = (GVTFontFamily)i.next(); + for (final Iterator i = gvtFonts.iterator(); i.hasNext(); ) { + final GVTFontFamily fam = (GVTFontFamily)i.next(); this.fontFamily = fam.getFamilyName(); font = this.fontConsumer.selectFontCSS( FontUtility.foFontFamily(this.fontFamily), @@ -319,56 +321,55 @@ return font; } - public Mark getMark(TextNode node, int pos, boolean all) { + public Mark getMark(final TextNode node, final int pos, final boolean all) { logger.info("PDFText getMark"); return null; } - public Mark selectAt(double x, double y, - TextNode node) { + public Mark selectAt(final double x, final double y, final TextNode node) { logger.info("PDFText selectAt"); return null; } - public Mark selectTo(double x, double y, Mark beginMark) { + public Mark selectTo(final double x, final double y, final Mark beginMark) { logger.info("PDFText selectTo"); return null; } - public Mark selectAll(double x, double y, TextNode node) { + public Mark selectAll(final double x, final double y, final TextNode node) { logger.info("PDFText selectAll"); return null; } - public Mark selectFirst(TextNode node) { + public Mark selectFirst(final TextNode node) { logger.info("PDFText selectFirst"); return null; } - public Mark selectLast(TextNode node) { + public Mark selectLast(final TextNode node) { logger.info("PDFText selectLast"); return null; } - public int[] getSelected(Mark start, Mark finish) { + public int[] getSelected(final Mark start, final Mark finish) { logger.info("PDFText getSelected"); return null; } - public Shape getHighlightShape(Mark beginMark, Mark endMark) { + public Shape getHighlightShape(final Mark beginMark, final Mark endMark) { logger.info("PDFText getHighlightShape"); return null; } - public Rectangle2D getBounds2D(TextNode node) { + public Rectangle2D getBounds2D(final TextNode node) { return PROXY_PAINTER.getBounds2D(node); } - public Rectangle2D getGeometryBounds(TextNode node) { + public Rectangle2D getGeometryBounds(final TextNode node) { return PROXY_PAINTER.getGeometryBounds(node); } - public Shape getOutline(TextNode node) { + public Shape getOutline(final TextNode node) { return PROXY_PAINTER.getOutline(node); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java 2006-07-23 19:48:10 UTC (rev 7821) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java 2006-07-23 20:07:00 UTC (rev 7822) @@ -114,7 +114,8 @@ * application using the Transcoder is "XYZ System", the appName might be * "XYZ". */ - public PDFTranscoder(String appName, FontUse font, int fontSize) { + public PDFTranscoder(final String appName, final FontUse font, + final int fontSize) { hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, SVGConstants.SVG_NAMESPACE_URI); hints.put(KEY_DOCUMENT_ELEMENT, SVGConstants.SVG_SVG_TAG); @@ -133,15 +134,15 @@ * @param output the ouput where to transcode * @exception TranscoderException if an error occured while transcoding */ - protected void transcode(Document document, String uri, - TranscoderOutput output) throws TranscoderException { + protected void transcode(final Document document, final String uri, + final TranscoderOutput output) throws TranscoderException { if (!(document instanceof SVGOMDocument)) { throw new TranscoderException(Messages.formatMessage("notsvg", null)); } - SVGDocument svgDoc = (SVGDocument)document; - SVGSVGElement root = svgDoc.getRootElement(); + final SVGDocument svgDoc = (SVGDocument)document; + final SVGSVGElement root = svgDoc.getRootElement(); // initialize the SVG document with the appropriate context boolean stroke = true; @@ -156,21 +157,21 @@ textPainter = new StrokingTextPainter(); ctx.setTextPainter(textPainter); - PDFAElementBridge pdfAElementBridge = new PDFAElementBridge(); - AffineTransform currentTransform = new AffineTransform(1, 0, 0, 1, 0, - 0); + final PDFAElementBridge pdfAElementBridge = new PDFAElementBridge(); + final AffineTransform currentTransform = new AffineTransform(1, 0, 0, + 1, 0, 0); pdfAElementBridge.setCurrentTransform(currentTransform); ctx.putBridge(pdfAElementBridge); ctx.putBridge(new PDFImageElementBridge()); GraphicsNode gvtRoot; try { gvtRoot = builder.build(ctx, svgDoc); - } catch (BridgeException ex) { + } catch (final BridgeException ex) { throw new TranscoderException(ex); } // get the 'width' and 'height' attributes of the SVG document - float docWidth = (float)ctx.getDocumentSize().getWidth(); - float docHeight = (float)ctx.getDocumentSize().getHeight(); + final float docWidth = (float)ctx.getDocumentSize().getWidth(); + final float docHeight = (float)ctx.getDocumentSize().getHeight(); ctx = null; builder = null; @@ -204,22 +205,22 @@ String ref = null; try { ref = URLFactory.createURL(uri).getRef(); - } catch (MalformedURLException ex) { + } catch (final MalformedURLException ex) { // nothing to do, catched previously } try { Px = ViewBox.getViewTransform(ref, root, width, height); - } catch (BridgeException ex) { + } catch (final BridgeException ex) { throw new TranscoderException(ex); } if (Px.isIdentity() && (width != docWidth || height != docHeight)) { // The document has no viewBox, we need to resize it by hand. // we want to keep the document size ratio - float d = Math.max(docWidth, docHeight); - f... [truncated message content] |