maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r416972 [1/3] - in /maven/doxia/trunk: doxia-core/src/main/java/org/apache/maven/doxia/module/ doxia-modules/doxia-module-itext/ doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ doxia-modules/doxia-module-...
Date Sat, 24 Jun 2006 23:41:41 GMT
Author: jvanzyl
Date: Sat Jun 24 16:41:41 2006
New Revision: 416972

URL: http://svn.apache.org/viewvc?rev=416972&view=rev
Log:
o Vincent, I've labelled what I can get working in the itext module. I can get everything
working but tables so I can 
  do what I need to now, so hopefully when you put in your missing source file it will all
work again.

  I moved your SinkActionContext into the itext module for now. So that's where it is if you're
looking for it.



Added:
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/SinkActionContext.java
  (contents, props changed)
      - copied, changed from r416961, maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/SinkActionContext.java
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/itext.xml  
(with props)
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/test.apt.org
Removed:
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/SinkActionContext.java
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/test.apt.bak
Modified:
    maven/doxia/trunk/doxia-modules/doxia-module-itext/pom.xml
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java
    maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/resources/apt/test.apt

Modified: maven/doxia/trunk/doxia-modules/doxia-module-itext/pom.xml
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-itext/pom.xml?rev=416972&r1=416971&r2=416972&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-itext/pom.xml (original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-itext/pom.xml Sat Jun 24 16:41:41 2006
@@ -21,23 +21,16 @@
       <timezone>-5</timezone>
     </developer>
   </developers>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.4</source>
-          <target>1.4</target>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
   <dependencies>
     <dependency>
-      <groupId>itext</groupId>
+      <groupId>com.lowagie</groupId>
       <artifactId>itext</artifactId>
-      <version>1.3.1</version>
+      <version>1.4</version>
     </dependency>
+    <dependency>
+      <groupId>xpp3</groupId>
+      <artifactId>xpp3</artifactId>
+      <version>1.1.3.4-RC3</version>
+    </dependency>    
   </dependencies>
 </project>

Modified: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java?rev=416972&r1=416971&r2=416972&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java
(original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java
Sat Jun 24 16:41:41 2006
@@ -16,16 +16,10 @@
  * limitations under the License.
  */
 
-import java.awt.Color;
-import java.io.IOException;
-import java.io.LineNumberReader;
-import java.io.StringReader;
-import java.io.Writer;
-import java.net.MalformedURLException;
-import java.net.URL;
-
+import com.lowagie.text.BadElementException;
+import com.lowagie.text.ElementTags;
+import com.lowagie.text.Image;
 import org.apache.maven.doxia.module.HtmlTools;
-import org.apache.maven.doxia.module.SinkActionContext;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.SinkAdapter;
 import org.codehaus.plexus.util.IOUtil;
@@ -33,9 +27,13 @@
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
-import com.lowagie.text.BadElementException;
-import com.lowagie.text.ElementTags;
-import com.lowagie.text.Image;
+import java.awt.*;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
 
 /**
  * <p>A doxia Sink which produces an XML Front End document for <code>iText</code>
framework.</p>
@@ -808,7 +806,7 @@
     }
 
     // ----------------------------------------------------------------------
-    // Tables
+    //  Tables
     // ----------------------------------------------------------------------
 
     public void table_()

Modified: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java?rev=416972&r1=416971&r2=416972&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
(original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
Sat Jun 24 16:41:41 2006
@@ -16,12 +16,6 @@
  * limitations under the License.
  */
 
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Locale;
-
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.PageSize;
 import com.lowagie.text.Rectangle;
@@ -29,6 +23,12 @@
 import com.lowagie.text.xml.XmlToPdf;
 import com.lowagie.text.xml.XmlToRtf;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Locale;
+
 /**
  * A set of util methods for the <code>iText</code> framework
  *
@@ -41,15 +41,14 @@
      * Set the default page size for the document depending the user's country.
      * TODO Maybe more generic?
      *
-     * @see com.lowagie.text.PageSize
-     *
      * @return the page size
+     * @see com.lowagie.text.PageSize
      */
     public static Rectangle getDefaultPageSize()
     {
         String defaultCountry = Locale.getDefault().getCountry();
-        if ( defaultCountry != null
-            && ( defaultCountry.equals( Locale.US.getCountry() ) || defaultCountry.equals(
Locale.CANADA.getCountry() ) ) )
+        if ( defaultCountry != null &&
+            ( defaultCountry.equals( Locale.US.getCountry() ) || defaultCountry.equals( Locale.CANADA.getCountry()
) ) )
         {
             return PageSize.LETTER;
         }
@@ -60,10 +59,9 @@
     /**
      * Return a page size as String.
      *
-     * @see com.lowagie.text.PageSize
-     *
      * @param rect a Rectangle
      * @return a page size as String
+     * @see com.lowagie.text.PageSize
      */
     public static String getPageSize( Rectangle rect )
     {
@@ -78,10 +76,9 @@
     /**
      * Return true if the page size is supported by <code>PageSize</code> class,
false otherwise
      *
-     * @see com.lowagie.text.PageSize
-     *
      * @param aPageSize a page size
      * @return true if the page size is supported, false otherwise
+     * @see com.lowagie.text.PageSize
      */
     public static boolean isPageSizeSupported( String aPageSize )
     {
@@ -89,9 +86,9 @@
         for ( int i = 0; i < sizes.length; i++ )
         {
             Field currentField = sizes[i];
-            if ( ( currentField.getName().equalsIgnoreCase( aPageSize ) )
-                && ( Modifier.isStatic( currentField.getModifiers() ) )
-                && ( currentField.getType().equals( Rectangle.class ) ) )
+            if ( ( currentField.getName().equalsIgnoreCase( aPageSize ) ) &&
+                ( Modifier.isStatic( currentField.getModifiers() ) ) &&
+                ( currentField.getType().equals( Rectangle.class ) ) )
             {
                 return true;
             }
@@ -104,19 +101,21 @@
      * Parse an iText XML from the specified <CODE>InputStream</CODE>, writing
an Pdf document
      * specified <CODE>OutputStream</CODE>.
      *
-     * @see com.lowagie.text.xml.XmlToPdf
-     *
      * @param is the <CODE>InputStream</CODE> from which the XML is read.
      * @param os the <CODE>OutputStream</CODE> to which the result as Pdf is
written.
      * @throws RuntimeException if any
+     * @see com.lowagie.text.xml.XmlToPdf
      */
-    public static void writePdf( InputStream is, OutputStream os )
+    public static void writePdf( InputStream is,
+                                 OutputStream os )
         throws RuntimeException
     {
         try
         {
             XmlToPdf x = new XmlToPdf();
+
             x.parse( is, os );
+
         }
         catch ( DocumentException e )
         {
@@ -128,13 +127,13 @@
      * Parse an iText XML from the specified <CODE>InputStream</CODE>, writing
an rtf document
      * specified <CODE>OutputStream</CODE>.
      *
-     * @see com.lowagie.text.xml.XmlToRtf
-     *
      * @param is the <CODE>InputStream</CODE> from which the XML is read.
      * @param os the <CODE>OutputStream</CODE> to which the result as RTF is
written.
      * @throws RuntimeException if any
+     * @see com.lowagie.text.xml.XmlToRtf
      */
-    public static void writeRtf( InputStream is, OutputStream os )
+    public static void writeRtf( InputStream is,
+                                 OutputStream os )
         throws RuntimeException
     {
         try
@@ -152,13 +151,13 @@
      * Parse an iText XML from the specified <CODE>InputStream</CODE>, writing
an html document
      * specified <CODE>OutputStream</CODE>.
      *
-     * @see com.lowagie.text.xml.XmlToHtml
-     *
      * @param is the <CODE>InputStream</CODE> from which the XML is read.
      * @param os the <CODE>OutputStream</CODE> to which the result as Html is
written.
      * @throws RuntimeException if any
+     * @see com.lowagie.text.xml.XmlToHtml
      */
-    public static void writeHtml( InputStream is, OutputStream os )
+    public static void writeHtml( InputStream is,
+                                  OutputStream os )
         throws RuntimeException
     {
         try

Copied: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/SinkActionContext.java
(from r416961, maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/SinkActionContext.java)
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/SinkActionContext.java?p2=maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/SinkActionContext.java&p1=maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/SinkActionContext.java&r1=416961&r2=416972&rev=416972&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/SinkActionContext.java
(original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/SinkActionContext.java
Sat Jun 24 16:41:41 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.doxia.module;
+package org.apache.maven.doxia.module.itext;
 
 import java.util.Stack;
 
@@ -56,18 +56,24 @@
 
     private Stack stack = new Stack();
 
+    private int currentAction;
+
     public int getCurrentAction()
     {
+        //return currentAction;
         return ((Integer)stack.peek()).intValue();
     }
 
     public void release()
     {
+        //currentAction = -1;
         stack.pop();
     }
 
     public void setAction( int action )
     {
+        //currentAction = action;
+
         stack.push( new Integer( action ) );
     }
 }

Propchange: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/SinkActionContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/SinkActionContext.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java?rev=416972&r1=416971&r2=416972&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java
(original)
+++ maven/doxia/trunk/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java
Sat Jun 24 16:41:41 2006
@@ -70,6 +70,7 @@
         throws Exception
     {
         ITextSink sink = new ITextSink( new FileWriter( getGeneratedFile( prefix, suffix
) ) );
+
         sink.setClassLoader( new URLClassLoader( new URL[] { ITextSinkTestCase.class.getResource(
"/images/" ) } ) );
 
         return sink;
@@ -105,6 +106,15 @@
         return reader;
     }
 
+    public void testGeneratingPDFFromITextXml()
+        throws Exception
+    {
+        File f = new File( getBasedir(), "src/test/resources/apt/itext.xml" );
+
+        ITextUtil.writePdf( new FileInputStream( f ),
+                            new FileOutputStream( getGeneratedFile( "test_itext_apt", ".pdf"
) ) );
+    }
+
     /**
      * Generate a pdf and a rtf from an <code>apt</code> file
      *
@@ -120,8 +130,8 @@
 
         sink.close();
 
-        //ITextUtil.writePdf( new FileInputStream( getGeneratedFile( "test_apt", ".xml" )
),
-          //                  new FileOutputStream( getGeneratedFile( "test_apt", ".pdf"
) ) );
+        ITextUtil.writePdf( new FileInputStream( getGeneratedFile( "test_apt", ".xml" ) ),
+                            new FileOutputStream( getGeneratedFile( "test_apt", ".pdf" )
) );
 
         //ITextUtil.writeRtf( new FileInputStream( getGeneratedFile( "test_apt", ".xml" )
),
           //                  new FileOutputStream( getGeneratedFile( "test_apt", ".rtf"
) ) );



Mime
View raw message