From 89ab3a2a903d89ca70ddcc950495305c7309846f Mon Sep 17 00:00:00 2001 From: Joerg Pietschmann Date: Fri, 19 Sep 2003 14:33:16 +0000 Subject: [PATCH] Organize imports. A bit of JavaDoc cosmetics. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196923 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/CTM.java | 5 ++- src/java/org/apache/fop/fo/FOTreeBuilder.java | 35 ++++++------------- src/java/org/apache/fop/fo/FObj.java | 15 ++++---- .../svg/BatikExtensionElementMapping.java | 8 ++--- src/java/org/apache/fop/fo/flow/Footnote.java | 6 +--- .../fop/fo/flow/InstreamForeignObject.java | 3 +- src/java/org/apache/fop/fo/flow/Leader.java | 9 ++--- src/java/org/apache/fop/fo/flow/ListItem.java | 6 +--- .../org/apache/fop/fo/flow/PageNumber.java | 12 +++---- .../fop/fo/flow/PageNumberCitation.java | 7 ++-- .../org/apache/fop/fo/pagination/Region.java | 9 ++--- .../apache/fop/fo/pagination/RegionBody.java | 13 +++---- .../fop/layoutmgr/BidiLayoutManager.java | 12 ++----- .../apache/fop/layoutmgr/LayoutManagerLS.java | 7 ++-- src/java/org/apache/fop/mif/MIFHandler.java | 20 +++++------ src/java/org/apache/fop/pdf/PDFInfo.java | 22 ++++++++++-- .../apache/fop/render/awt/AWTRenderer.java | 10 ++---- .../apache/fop/servlet/FopPrintServlet.java | 10 +----- 18 files changed, 77 insertions(+), 132 deletions(-) diff --git a/src/java/org/apache/fop/area/CTM.java b/src/java/org/apache/fop/area/CTM.java index bb6acd808..d8e68db36 100644 --- a/src/java/org/apache/fop/area/CTM.java +++ b/src/java/org/apache/fop/area/CTM.java @@ -50,12 +50,11 @@ */ package org.apache.fop.area; -import org.apache.fop.datatypes.FODimension; -import org.apache.fop.fo.PropertyManager; -import java.awt.geom.Rectangle2D; import java.awt.Rectangle; +import java.awt.geom.Rectangle2D; import java.io.Serializable; +import org.apache.fop.datatypes.FODimension; import org.apache.fop.fo.properties.WritingMode; /** diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index 5eaad192c..1152ac416 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -50,46 +50,31 @@ */ package org.apache.fop.fo; -// FOP -import java.util.HashMap; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.fop.fo.pagination.Root; -// SAX import org.apache.avalon.framework.logger.Logger; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.ElementMapping.Maker; +import org.apache.fop.fo.pagination.Root; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; -// Java -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.Reader; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import org.apache.fop.apps.FOUserAgent; - /** * SAX Handler that passes parsed data to the various * FO objects, where they can be used either to build * an FO Tree, or used by Structure Renderers to build * other data structures. - * Now uses - * StreamRenderer to automagically render the document as - * soon as it receives a page-sequence end-tag. Also, - * calls methods to set up and shut down the renderer at - * the beginning and end of the FO document. Finally, - * supresses adding the PageSequence object to the Root, - * since it is parsed immediately. - * - * @author unascribed - * @author Mark Lillywhite mark-fop@inomial.com */ public class FOTreeBuilder extends DefaultHandler { diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index ecf5b60fc..2c2d29bd2 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -50,23 +50,20 @@ */ package org.apache.fop.fo; -// Java -import java.util.Iterator; -import java.util.ListIterator; import java.util.ArrayList; -import java.util.List; import java.util.HashMap; -import java.util.Set; +import java.util.Iterator; +import java.util.ListIterator; import java.util.Map; -import org.xml.sax.Attributes; +import java.util.Set; -// FOP import org.apache.fop.apps.FOPException; -import org.apache.fop.fo.properties.FOPropertyMapping; import org.apache.fop.fo.flow.Marker; +import org.apache.fop.fo.properties.FOPropertyMapping; +import org.xml.sax.Attributes; /** - * base class for representation of formatting objects and their processing + * Base class for representation of formatting objects and their processing. */ public class FObj extends FONode { private static final String FO_URI = "http://www.w3.org/1999/XSL/Format"; diff --git a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java index c5afab347..e611713be 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java @@ -52,12 +52,10 @@ package org.apache.fop.fo.extensions.svg; import java.util.HashMap; -import org.apache.fop.fo.FONode; -import org.apache.fop.fo.ElementMapping; -import org.apache.fop.apps.FOFileHandler; - import org.apache.batik.util.XMLResourceDescriptor; -import org.apache.batik.dom.svg.ExtensibleSVGDOMImplementation; +import org.apache.fop.apps.FOFileHandler; +import org.apache.fop.fo.ElementMapping; +import org.apache.fop.fo.FONode; /** * This Element Mapping is for Batik SVG Extension elements diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index 8eefecdac..8c5dd6932 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -50,13 +50,9 @@ */ package org.apache.fop.fo.flow; -// Java -import java.util.List; - -// FOP import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOTreeVisitor; +import org.apache.fop.fo.FObj; /** * Class modelling the fo:footnote object. See Sec. 6.10.3 of the XSL-FO diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java index 325d95985..6693b4225 100644 --- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -51,11 +51,10 @@ package org.apache.fop.fo.flow; import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOTreeVisitor; +import org.apache.fop.fo.FObj; import org.apache.fop.fo.properties.DisplayAlign; import org.apache.fop.fo.properties.TextAlign; -import org.w3c.dom.Document; /** * The instream-foreign-object flow formatting object. diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index 7f02f9aca..e4fc70ba0 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -50,23 +50,20 @@ */ package org.apache.fop.fo.flow; -// FOP import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PercentLength; import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObjMixed; -import org.apache.fop.fo.FOInputHandler; import org.apache.fop.fo.FOTreeVisitor; -import org.apache.fop.fo.properties.LeaderPattern; +import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; -import org.apache.fop.fo.FOTreeControl; -import org.apache.fop.fonts.Font; import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.LeaderPattern; +import org.apache.fop.fonts.Font; /** * Class modelling fo:leader object. See Sec. 6.6.9 of the XSL-FO Standard. diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index 049518566..8b1d58719 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -50,13 +50,9 @@ */ package org.apache.fop.fo.flow; -// Java -import java.util.List; - -// FOP import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOTreeVisitor; +import org.apache.fop.fo.FObj; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 8f34ae9fd..e936e35d8 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -50,21 +50,17 @@ */ package org.apache.fop.fo.flow; -// FOP +import org.apache.fop.datatypes.ColorType; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOTreeVisitor; +import org.apache.fop.fo.FObj; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; -import org.apache.fop.fo.FOTreeControl; -import org.apache.fop.fonts.Font; import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; - -import org.apache.fop.datatypes.ColorType; -import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; -import org.apache.fop.fo.FOInputHandler; +import org.apache.fop.fonts.Font; /** * Class modelling the fo:page-number object. See Sec. 6.6.10 of the XSL-FO diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 5c13e15f6..005bfa620 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -50,20 +50,17 @@ */ package org.apache.fop.fo.flow; -// FOP import org.apache.fop.datatypes.ColorType; -import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.FObj; -import org.apache.fop.fo.FOInputHandler; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; -import org.apache.fop.fo.FOTreeControl; -import org.apache.fop.fonts.Font; import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fonts.Font; import org.apache.fop.util.CharUtilities; /** diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index cc8e3578d..ab7c49e66 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -50,18 +50,13 @@ */ package org.apache.fop.fo.pagination; -// Java import java.awt.Rectangle; -import java.awt.geom.Rectangle2D; -// FOP +import org.apache.fop.apps.FOPException; import org.apache.fop.datatypes.FODimension; -import org.apache.fop.fo.FObj; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOTreeVisitor; -import org.apache.fop.apps.FOPException; - -// SAX +import org.apache.fop.fo.FObj; import org.xml.sax.Attributes; /** diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java index e11301685..2e9880ec5 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java @@ -50,20 +50,17 @@ */ package org.apache.fop.fo.pagination; -// Java import java.awt.Rectangle; -import java.awt.geom.Rectangle2D; -// FOP +import org.apache.fop.datatypes.ColorType; +import org.apache.fop.datatypes.FODimension; import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOTreeVisitor; -import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.FObj; import org.apache.fop.fo.Property; -import org.apache.fop.fo.properties.WritingMode; -import org.apache.fop.datatypes.ColorType; -import org.apache.fop.datatypes.FODimension; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.properties.CommonMarginBlock; +import org.apache.fop.fo.properties.WritingMode; /** * The fo:region-body element. diff --git a/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java index 13b7613c0..d8bbe2b77 100644 --- a/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java @@ -50,19 +50,11 @@ */ package org.apache.fop.layoutmgr; -// FOP -import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObjMixed; -import org.apache.fop.fo.properties.CommonAural; -import org.apache.fop.fo.properties.CommonRelativePosition; +import java.util.ArrayList; +import java.util.List; -import org.apache.fop.layoutmgr.LeafNodeLayoutManager; -import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.area.inline.InlineArea; -import java.util.List; -import java.util.ArrayList; - /** * If this bidi has a different writing mode direction diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java index fc78984a1..f95fe253f 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java @@ -50,15 +50,14 @@ */ package org.apache.fop.layoutmgr; -import org.apache.fop.area.extensions.BookmarkData; -import org.apache.fop.fo.extensions.Outline; import org.apache.fop.apps.Document; import org.apache.fop.apps.FOPException; -import org.apache.fop.layout.LayoutStrategy; import org.apache.fop.area.AreaTree; import org.apache.fop.area.Title; +import org.apache.fop.area.extensions.BookmarkData; +import org.apache.fop.fo.extensions.Outline; import org.apache.fop.fo.pagination.PageSequence; -import org.apache.fop.fo.FOTreeHandler; +import org.apache.fop.layout.LayoutStrategy; /** * The implementation of LayoutStrategy for the "redesign" or second generation diff --git a/src/java/org/apache/fop/mif/MIFHandler.java b/src/java/org/apache/fop/mif/MIFHandler.java index fbb714e63..9d6be6156 100644 --- a/src/java/org/apache/fop/mif/MIFHandler.java +++ b/src/java/org/apache/fop/mif/MIFHandler.java @@ -54,29 +54,25 @@ package org.apache.fop.mif; import java.io.IOException; import java.io.OutputStream; -// XML -import org.xml.sax.SAXException; - -// FOP -import org.apache.fop.apps.Driver; -import org.apache.fop.fo.FOInputHandler; -import org.apache.fop.fo.flow.Block; -import org.apache.fop.fo.pagination.Flow; -import org.apache.fop.fo.pagination.PageSequence; -import org.apache.fop.fo.pagination.PageSequenceMaster; -import org.apache.fop.fo.pagination.SimplePageMaster; import org.apache.fop.apps.Document; import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.FOInputHandler; +import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.flow.ExternalGraphic; import org.apache.fop.fo.flow.InstreamForeignObject; import org.apache.fop.fo.flow.Leader; import org.apache.fop.fo.flow.ListBlock; import org.apache.fop.fo.flow.ListItem; import org.apache.fop.fo.flow.Table; -import org.apache.fop.fo.flow.TableColumn; import org.apache.fop.fo.flow.TableBody; import org.apache.fop.fo.flow.TableCell; +import org.apache.fop.fo.flow.TableColumn; import org.apache.fop.fo.flow.TableRow; +import org.apache.fop.fo.pagination.Flow; +import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.fo.pagination.PageSequenceMaster; +import org.apache.fop.fo.pagination.SimplePageMaster; +import org.xml.sax.SAXException; // TODO: do we really want every method throwing a SAXException diff --git a/src/java/org/apache/fop/pdf/PDFInfo.java b/src/java/org/apache/fop/pdf/PDFInfo.java index 01b443370..3894b1bcf 100644 --- a/src/java/org/apache/fop/pdf/PDFInfo.java +++ b/src/java/org/apache/fop/pdf/PDFInfo.java @@ -69,6 +69,7 @@ public class PDFInfo extends PDFObject { private String author = null; private String subject = null; private String keywords = null; + private Date creationDate = null; /** * the name of the application that created the @@ -130,6 +131,20 @@ public class PDFInfo extends PDFObject { this.keywords = k; } + /** + * @return last set creation date + */ + public Date getCreationDate() { + return creationDate; + } + + /** + * @param date Date to store in the PDF as creation date. Use null to force current system date. + */ + public void setCreationDate(Date date) { + creationDate = date; + } + /** * @see org.apache.fop.pdf.PDFObject#toPDF() */ @@ -170,9 +185,11 @@ public class PDFInfo extends PDFObject { bout.write(encode("\n")); // creation date in form (D:YYYYMMDDHHmmSSOHH'mm') - final Date date = new Date(); + if(creationDate==null) { + creationDate = new Date(); + } final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); - final String str = sdf.format(date) + "+00'00'"; + final String str = sdf.format(creationDate) + "+00'00'"; bout.write(encode("/CreationDate ")); bout.write(encodeString("D:" + str)); bout.write(encode("\n>>\nendobj\n")); @@ -181,5 +198,6 @@ public class PDFInfo extends PDFObject { } return bout.toByteArray(); } + } diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index b2670639f..7c3ecd116 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -59,38 +59,34 @@ package org.apache.fop.render.awt; // Java import java.awt.Color; -import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.geom.Rectangle2D; +import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.awt.print.PageFormat; import java.awt.print.Pageable; import java.awt.print.Printable; -import java.awt.RenderingHints; import java.io.IOException; import java.io.OutputStream; import java.util.Map; import java.util.Vector; -// FOP import org.apache.fop.apps.Document; -import org.apache.fop.apps.InputHandler; import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.InputHandler; import org.apache.fop.area.Area; import org.apache.fop.area.Page; import org.apache.fop.area.PageViewport; import org.apache.fop.area.RegionViewport; import org.apache.fop.area.Trait; -import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FOTreeControl; import org.apache.fop.fo.properties.BackgroundRepeat; -import org.apache.fop.fonts.Font; import org.apache.fop.image.FopImage; import org.apache.fop.image.ImageFactory; import org.apache.fop.render.AbstractRenderer; diff --git a/src/java/org/apache/fop/servlet/FopPrintServlet.java b/src/java/org/apache/fop/servlet/FopPrintServlet.java index fc4f3c3c8..4db2e4b45 100644 --- a/src/java/org/apache/fop/servlet/FopPrintServlet.java +++ b/src/java/org/apache/fop/servlet/FopPrintServlet.java @@ -51,10 +51,8 @@ package org.apache.fop.servlet; import java.io.File; -import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; -import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -62,18 +60,12 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.transform.TransformerFactory; -import org.xml.sax.InputSource; - -// Avalon import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.avalon.framework.logger.Logger; - -// FOP import org.apache.fop.apps.Driver; -import org.apache.fop.apps.FOPException; -import org.apache.fop.area.PageViewport; import org.apache.fop.apps.XSLTInputHandler; import org.apache.fop.render.awt.AWTPrintRenderer; +import org.xml.sax.InputSource; /** * Example servlet to generate a fop printout from a servlet. -- 2.39.5