vmote       2003/06/30 15:01:03

  Modified:    src/java/org/apache/fop/rtf/rtflib/exceptions
                        RtfException.java RtfStructureException.java
               src/java/org/apache/fop/rtf/rtflib/interfaces
                        ITableColumnsInfo.java
               src/java/org/apache/fop/rtf/rtflib/testdocs BasicLink.java
                        CreateTestDocuments.java MergedTableCells.java
                        ParagraphAlignment.java SimpleTable.java
                        TestDocument.java
               src/java/org/apache/fop/rtf/rtflib/tools ImageConstants.java
                        ImageUtil.java
  Log:
  Refactor constants to conform to style guidelines. Add javadoc comments.
  
  Revision  Changes    Path
  1.4       +4 -2      
xml-fop/src/java/org/apache/fop/rtf/rtflib/exceptions/RtfException.java
  
  Index: RtfException.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/exceptions/RtfException.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RtfException.java 30 Jun 2003 01:31:13 -0000      1.3
  +++ RtfException.java 30 Jun 2003 22:00:52 -0000      1.4
  @@ -61,8 +61,10 @@
   /**  Base class for rtflib exceptions.
    *  @author Bertrand Delacretaz [EMAIL PROTECTED]
    */
  -
   public class RtfException extends java.io.IOException {
  +    /**
  +     * @param reason Description of reason for Exception.
  +     */
       public RtfException(String reason) {
           super(reason);
       }
  
  
  
  1.4       +4 -2      
xml-fop/src/java/org/apache/fop/rtf/rtflib/exceptions/RtfStructureException.java
  
  Index: RtfStructureException.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/exceptions/RtfStructureException.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RtfStructureException.java        30 Jun 2003 01:31:13 -0000      1.3
  +++ RtfStructureException.java        30 Jun 2003 22:00:53 -0000      1.4
  @@ -61,9 +61,11 @@
   /**  Thrown when a method call would lead to an invalid RTF document structure.
    *  @author Bertrand Delacretaz [EMAIL PROTECTED]
    */
  -
   public class RtfStructureException
   extends RtfException {
  +    /**
  +     * @param reason Description of reason for exception.
  +     */
       public RtfStructureException(String reason) {
           super(reason);
       }
  
  
  
  1.5       +5 -5      
xml-fop/src/java/org/apache/fop/rtf/rtflib/interfaces/ITableColumnsInfo.java
  
  Index: ITableColumnsInfo.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/interfaces/ITableColumnsInfo.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ITableColumnsInfo.java    30 Jun 2003 01:31:13 -0000      1.4
  +++ ITableColumnsInfo.java    30 Jun 2003 22:00:53 -0000      1.5
  @@ -76,9 +76,9 @@
        */
       float getColumnWidth();
   
  -     /** @return current column iteration index */
  -     int getColumnIndex();
  +    /** @return current column iteration index */
  +    int getColumnIndex();
   
  -     /** @return number of columns */
  -     int getNumberOfColumns();
  +    /** @return number of columns */
  +    int getNumberOfColumns();
   }
  
  
  
  1.5       +6 -2      
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/BasicLink.java
  
  Index: BasicLink.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/BasicLink.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BasicLink.java    30 Jun 2003 17:45:33 -0000      1.4
  +++ BasicLink.java    30 Jun 2003 22:01:01 -0000      1.5
  @@ -82,7 +82,11 @@
       public BasicLink() {
       }
   
  -    /** generate the body of the test document */
  +    /** generate the body of the test document
  +     * @param rda RtfDocumentArea
  +     * @param sect RtfSection
  +     * @throws IOException for I/O Errors
  +     */
       protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws 
IOException {
           RtfParagraph p = sect.newParagraph ();
           p.newLineBreak();
  
  
  
  1.7       +12 -5     
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/CreateTestDocuments.java
  
  Index: CreateTestDocuments.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/CreateTestDocuments.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CreateTestDocuments.java  30 Jun 2003 17:45:33 -0000      1.6
  +++ CreateTestDocuments.java  30 Jun 2003 22:01:01 -0000      1.7
  @@ -68,10 +68,14 @@
    */
   
   public class CreateTestDocuments {
  +
  +    /**
  +     * package name for the testdocs
  +     */
       public static final String TESTDOCS_PACKAGE = 
"org.apache.fop.rtf.rtflib.testdocs";
   
       /** List of all TestDocument subclasses from this package */
  -    private static final String [] classNames = {
  +    private static final String [] CLASS_NAMES = {
           "SimpleDocument",
           "TextAttributes",
           "SimpleTable",
  @@ -91,8 +95,8 @@
               throw new IOException("output directory (" + outDir + ") must exist and 
be writable");
           }
   
  -        for (int i = 0; i < classNames.length; i++) {
  -            createOneTestDocument(classNames[i], outDir);
  +        for (int i = 0; i < CLASS_NAMES.length; i++) {
  +            createOneTestDocument(CLASS_NAMES[i], outDir);
           }
       }
   
  @@ -111,7 +115,10 @@
           td.generateOutput();
       }
   
  -    /** execute this to create test documents from all classes listed in classNames 
array */
  +    /** execute this to create test documents from all classes listed in classNames 
array
  +     * @param args String array of arguments
  +     * @throws Exception for errors
  +     */
       public static void main(String args[])
       throws Exception {
           if (args.length < 1) {
  
  
  
  1.4       +3 -2      
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/MergedTableCells.java
  
  Index: MergedTableCells.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/MergedTableCells.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MergedTableCells.java     30 Jun 2003 17:45:33 -0000      1.3
  +++ MergedTableCells.java     30 Jun 2003 22:01:01 -0000      1.4
  @@ -71,13 +71,14 @@
    */
   
   class MergedTableCells extends TestDocument {
  +    static final int MM_TO_TWIPS = (int)(1440f / 25.4f);
  +
       /** generate the body of the test document */
       protected void generateDocument(RtfDocumentArea rda, RtfSection sect)
       throws IOException {
           sect.newParagraph().newText("This document contains a table with some 
merged cells.");
   
           final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
  -        final int MM_TO_TWIPS = (int)(1440f / 25.4f);
   
           // first row, test horizontal merging
           {
  
  
  
  1.5       +11 -1     
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ParagraphAlignment.java
  
  Index: ParagraphAlignment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ParagraphAlignment.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ParagraphAlignment.java   30 Jun 2003 17:45:33 -0000      1.4
  +++ ParagraphAlignment.java   30 Jun 2003 22:01:01 -0000      1.5
  @@ -69,8 +69,18 @@
    */
   public class ParagraphAlignment extends TestDocument {
   
  +    /**
  +     * Constructor
  +     */
       public ParagraphAlignment() {
       }
  +
  +    /**
  +     * Generate the document.
  +     * @param rda RtfDocumentArea
  +     * @param sect RtfSection
  +     * @throws java.io.IOException for I/O errors
  +     */
       protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws 
java.io.IOException
       {
           RtfAttributes attr = new RtfAttributes ();
  
  
  
  1.4       +8 -8      
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleTable.java
  
  Index: SimpleTable.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleTable.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SimpleTable.java  30 Jun 2003 17:45:33 -0000      1.3
  +++ SimpleTable.java  30 Jun 2003 22:01:01 -0000      1.4
  @@ -71,16 +71,16 @@
    */
   class SimpleTable extends TestDocument {
       /** generate the body of the test document */
  +    static final int MAX_ROW = 2;
  +    static final int MAX_COL = 3;
  +    static final int INCH_TO_TWIPS = 1440;
  +    static final int C1W = 4;
  +
       protected void generateDocument(RtfDocumentArea rda, RtfSection sect)
       throws IOException {
           final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
  -        final int MAX_ROW = 2;
  -        final int MAX_COL = 3;
  -
  -        final int INCH_TO_TWIPS = 1440;
  -        final int c1w = 4;
  -        tbl.newTableRow().newTableCell(c1w * INCH_TO_TWIPS).newParagraph().newText
  -                ("Here's a table row with just one cell, width " + c1w + "''");
  +        tbl.newTableRow().newTableCell(C1W * INCH_TO_TWIPS).newParagraph().newText
  +                ("Here's a table row with just one cell, width " + C1W + "''");
   
           for (int row = 0; row < MAX_ROW; row++) {
               final RtfTableRow r = tbl.newTableRow();
  
  
  
  1.6       +5 -5      
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/TestDocument.java
  
  Index: TestDocument.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/TestDocument.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestDocument.java 30 Jun 2003 17:45:33 -0000      1.5
  +++ TestDocument.java 30 Jun 2003 22:01:01 -0000      1.6
  @@ -74,11 +74,11 @@
    */
   
   abstract class TestDocument {
  -    private File m_output;
  +    private File output;
   
       final void setOutputDir(File outDir)
       throws IOException {
  -        m_output = new File(outDir, getRtfFilename());
  +        output = new File(outDir, getRtfFilename());
       }
   
       final String getRtfFilename() {
  @@ -90,8 +90,8 @@
   
       final void generateOutput()
       throws IOException {
  -        debugMsg("Generating document " + m_output + "...");
  -        final RtfFile f = new RtfFile(new FileWriter(m_output));
  +        debugMsg("Generating document " + output + "...");
  +        final RtfFile f = new RtfFile(new FileWriter(output));
           final RtfDocumentArea rda = f.startDocumentArea();
           final RtfSection sect = rda.newSection();
           addIntroComments(sect);
  
  
  
  1.6       +19 -17    
xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageConstants.java
  
  Index: ImageConstants.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageConstants.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ImageConstants.java       30 Jun 2003 17:45:33 -0000      1.5
  +++ ImageConstants.java       30 Jun 2003 22:01:02 -0000      1.6
  @@ -71,41 +71,43 @@
       //////////////////////////////////////////////////
   
       /** Defines the case, if image is not supported */
  -    public static int I_NOT_SUPPORTED = -1;
  -
  -    public static int I_EMF = 0;
  -    public static int I_PNG = 1;
  -    public static int I_JPG = 2;
  +    public static final int I_NOT_SUPPORTED = -1;
  +    /** Integer equivalent for EMF */
  +    public static final int I_EMF = 0;
  +    /** Integer equivalent for PNG */
  +    public static final int I_PNG = 1;
  +    /** Integer equivalent for JPG */
  +    public static final int I_JPG = 2;
   
       /** Defines the RTF properties */
  -    public static String [] RTF_TAGS = new String []
  +    public static final String [] RTF_TAGS = new String []
           {
               "emfblip", "pngblip", "jpegblip"
           };
   
  -    public static int I_TO_CONVERT_BASIS = 50;
  -    public static int I_GIF = 50;
  -    public static int I_JPG_C = 51;
  +    public static final int I_TO_CONVERT_BASIS = 50;
  +    public static final int I_GIF = 50;
  +    public static final int I_JPG_C = 51;
   
       /** Defines the types for converting rtf supported image types */
  -    public static int [] CONVERT_TO = new int []
  +    public static final int [] CONVERT_TO = new int []
           {
               I_JPG, I_JPG
           };
   
       /** EMF file extension */
  -    public static String EMF_EXT = "emf";
  +    public static final String EMF_EXT = "emf";
       /** PNG file extension */
  -    public static String PNG_EXT = "png";
  +    public static final String PNG_EXT = "png";
       /** JPG file extension */
  -    public static String JPG_EXT = "jpg";
  +    public static final String JPG_EXT = "jpg";
       /** JPEG file extension */
  -    public static String JPEG_EXT = "jpeg";
  +    public static final String JPEG_EXT = "jpeg";
       /** GIF file extension */
  -    public static String GIF_EXT = "gif";
  +    public static final String GIF_EXT = "gif";
   
       /** Defines the file extensions and the RTF property belongs to */
  -    public static Hashtable SUPPORTED_IMAGE_TYPES = new Hashtable ();
  +    public static final Hashtable SUPPORTED_IMAGE_TYPES = new Hashtable ();
       static {
           SUPPORTED_IMAGE_TYPES.put (EMF_EXT, new Integer (I_EMF));
           SUPPORTED_IMAGE_TYPES.put (PNG_EXT, new Integer (I_PNG));
  
  
  
  1.6       +11 -13    xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageUtil.java
  
  Index: ImageUtil.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageUtil.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ImageUtil.java    30 Jun 2003 17:45:33 -0000      1.5
  +++ ImageUtil.java    30 Jun 2003 22:01:03 -0000      1.6
  @@ -84,9 +84,8 @@
        *
        * @param value String with digits
        *
  -     * @return
  -     *  -1      There is no digit\n
  -     *  number  The digits as integer
  +     * @return -1      There is no digit
  +     *         number  The digits as integer
        */
       public static int getInt (String value) {
           String retString = new String ();
  @@ -111,9 +110,8 @@
        *
        * @param value String with digits
        *
  -     * @return
  -     * true    The string contains a % value
  -     * false   Other string
  +     * @return true    The string contains a % value
  +     *         false   Other string
        */
       public static boolean isPercent (String value) {
           if (value.endsWith ("%")) {
  @@ -132,9 +130,8 @@
        * @param searchAt Position to start compare
        * @param searchForward Direction to compare byte arrays
        *
  -     * @return
  -     *  true    If equal\n
  -     *  false   If different
  +     * @return true    If equal
  +     *         false   If different
        */
       public static boolean compareHexValues (byte[] pattern, byte[] data, int 
searchAt,
                                               boolean searchForward) {
  @@ -178,10 +175,11 @@
        * Determines a integer value from a hexadecimal byte array.
        *
        * @param data Image
  -     * @param start Start index to read from
  -     * @param end End index until to read
  +     * @param startAt Start index to read from
  +     * @param length Number of data elements to read
  +     * @param searchForward True if searching forward, False if not (??)
        *
  -     * @return A number
  +     * @return integer
        */
       public static int getIntFromByteArray (byte[] data, int startAt, int length,
                                              boolean searchForward) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to