maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r400356 - in /maven/doxia/trunk: doxia-core/src/main/java/org/apache/maven/doxia/ doxia-core/src/main/java/org/apache/maven/doxia/module/apt/ doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/ doxia-core/src/main/java/org/apach...
Date Sat, 06 May 2006 20:10:10 GMT
Author: trygvis
Date: Sat May  6 13:10:05 2006
New Revision: 400356

URL: http://svn.apache.org/viewcvs?rev=400356&view=rev
Log:
o Adding a basic editor for Doxia documents. It uses the Sink API for both reading and writing files so it can in theory read and write anything that Doxia itself can read and write.

Added:
    maven/doxia/trunk/doxia-sandbox/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/   (with props)
    maven/doxia/trunk/doxia-sandbox/doxia-editor/pom.xml
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/Application.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultApplication.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultStyleManager.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditor.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditorException.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/EditorDocumentListener.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/StyleManager.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/AbstractDoxiaAction.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/OpenDocumentAction.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/SaveDocumentAction.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/ActionManager.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/DefaultActionManager.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DebugSink.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentBuilder.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentSerializer.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DocumentParser.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentBuilder.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentSerializer.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/EditorSink.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/PipelineSink.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaAttribute.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaDocument.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Element.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/LeafElement.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Paragraph.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Section.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Text.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/widgets/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/windows/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/windows/EditorWindow.java
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/resources/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/resources/META-INF/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/resources/META-INF/plexus/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/resources/META-INF/plexus/components.xml
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/test/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/test/apt/
    maven/doxia/trunk/doxia-sandbox/doxia-editor/src/test/apt/test.apt
Modified:
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/StructureSink.java
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/validation/advices/PrintAdvisor.java
    maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTestCase.java
    maven/doxia/trunk/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java Sat May  6 13:10:05 2006
@@ -25,9 +25,10 @@
 import java.io.Reader;
 
 /**
+ * @plexus.component role="org.apache.maven.doxia.Doxia"
+ *
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id:DefaultDoxia.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $
- * @plexus.component role="org.apache.maven.doxia.Doxia"
  */
 public class DefaultDoxia
     implements Doxia
@@ -50,5 +51,4 @@
 
         parser.parse( source, sink );
     }
-
 }

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java Sat May  6 13:10:05 2006
@@ -30,8 +30,7 @@
 import java.util.StringTokenizer;
 
 /**
- * @plexus.component role="org.apache.maven.doxia.parser.Parser"
- * role-hint="apt"
+ * @plexus.component role="org.apache.maven.doxia.parser.Parser" role-hint="apt"
  */
 public class AptParser
     extends AbstractParser

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/docbook/DocBookParser.java Sat May  6 13:10:05 2006
@@ -31,7 +31,7 @@
 import java.util.Stack;
 
 /**
- * Parse a DocBook document and emit events into the specified doxia
+ * Parse a DocBook model and emit events into the specified doxia
  * Sink.
  *
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java Sat May  6 13:10:05 2006
@@ -31,7 +31,7 @@
 import java.util.Iterator;
 
 /**
- * Parse a fml document and emit events into the specified doxia Sink.
+ * Parse a fml model and emit events into the specified doxia Sink.
  *
  * @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
  * @version $Id:FmlParser.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java Sat May  6 13:10:05 2006
@@ -28,7 +28,7 @@
 import java.util.Map;
 
 /**
- * Parse an xdoc document and emit events into the specified doxia
+ * Parse an xdoc model and emit events into the specified doxia
  * Sink.
  *
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java Sat May  6 13:10:05 2006
@@ -25,7 +25,7 @@
 import java.io.Writer;
 
 /**
- * A doxia Sink which produces an xdoc document.
+ * A doxia Sink which produces an xdoc model.
  *
  * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
  * @version $Id:XdocSink.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java Sat May  6 13:10:05 2006
@@ -26,7 +26,7 @@
 import java.util.Stack;
 
 /**
- * Parse an xdoc document and emit events into the specified doxia
+ * Parse an xdoc model and emit events into the specified doxia
  * Sink.
  *
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -90,8 +90,8 @@
                 }
                 /*
                  * The ADDRESS element may be used by authors to supply contact information 
-                 * for a document or a major part of a document such as a form. This element
-                 *  often appears at the beginning or end of a document.
+                 * for a model or a major part of a model such as a form. This element
+                 *  often appears at the beginning or end of a model.
                  */
                 else if ( parser.getName().equals( "address" ) )
                 {

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/StructureSink.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/StructureSink.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/StructureSink.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/StructureSink.java Sat May  6 13:10:05 2006
@@ -20,9 +20,6 @@
 
 public class StructureSink
 {
-
-    // -----------------------------------------------------------------------
-
     public static boolean isExternalLink( String text )
     {
         text = text.toLowerCase();

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/validation/advices/PrintAdvisor.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/validation/advices/PrintAdvisor.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/validation/advices/PrintAdvisor.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/validation/advices/PrintAdvisor.java Sat May  6 13:10:05 2006
@@ -20,7 +20,7 @@
 
 
 /**
- * Advisor that prints the hierarchy of a document as is beeing generated
+ * Advisor that prints the hierarchy of a model as is beeing generated
  *
  * @author Juan F. Codagnone
  * @since Nov 6, 2005

Modified: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTestCase.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTestCase.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTestCase.java (original)
+++ maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTestCase.java Sat May  6 13:10:05 2006
@@ -41,7 +41,7 @@
     protected abstract Parser getParser();
 
     /**
-     * Path of the document to test, relative to basedir
+     * Path of the model to test, relative to basedir
      * 
      * @return the relative path
      */
@@ -58,7 +58,7 @@
     }
 
     /**
-     * Parse the document in the path specified by {@link #getDocument()},
+     * Parse the model in the path specified by {@link #getDocument()},
      * with parser from {@link #getParser()}, and output to sink from {@link #getSink()}
      * 
      * @throws Exception

Propchange: maven/doxia/trunk/doxia-sandbox/doxia-editor/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  6 13:10:05 2006
@@ -0,0 +1,8 @@
+target
+*~
+*.log
+.classpath
+.project
+*.ipr
+*.iws
+*.iml

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/pom.xml
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/pom.xml?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/pom.xml (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/pom.xml Sat May  6 13:10:05 2006
@@ -0,0 +1,22 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.maven.doxia</groupId>
+    <artifactId>doxia</artifactId>
+  <version>1.0-alpha-8-SNAPSHOT</version>
+  </parent>
+  <artifactId>doxia-editor</artifactId>
+  <version>1.0-alpha-1-SNAPSHOT</version>
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>doxia-core</artifactId>
+      <version>1.0-alpha-8-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-container-default</artifactId>
+      <version>1.0-alpha-8</version>
+    </dependency>
+  </dependencies>
+</project>

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/Application.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/Application.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/Application.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/Application.java Sat May  6 13:10:05 2006
@@ -0,0 +1,28 @@
+package org.apache.maven.doxia.editor;
+
+import org.apache.maven.doxia.editor.action.manager.ActionManager;
+import org.apache.maven.doxia.editor.action.AbstractDoxiaAction;
+import org.apache.maven.doxia.editor.windows.EditorWindow;
+import org.apache.maven.doxia.editor.io.DoxiaDocumentBuilder;
+import org.apache.maven.doxia.Doxia;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public interface Application
+{
+    String ROLE = Application.class.getName();
+
+    ActionManager getActionManager();
+
+    Object lookup( String role );
+
+    EditorWindow getEditorWindow();
+
+    void setEditorWindow( EditorWindow editorWindow );
+
+    Doxia getDoxia();
+
+    DoxiaDocumentBuilder getDoxiaDocumentBuilder();
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultApplication.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultApplication.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultApplication.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultApplication.java Sat May  6 13:10:05 2006
@@ -0,0 +1,92 @@
+package org.apache.maven.doxia.editor;
+
+import org.apache.maven.doxia.Doxia;
+import org.apache.maven.doxia.editor.action.manager.ActionManager;
+import org.apache.maven.doxia.editor.io.DoxiaDocumentBuilder;
+import org.apache.maven.doxia.editor.windows.EditorWindow;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.StoppingException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DefaultApplication
+    implements Application, Contextualizable, Startable
+{
+    private Doxia doxia;
+
+    private DoxiaDocumentBuilder doxiaDocumentBuilder;
+
+    private PlexusContainer container;
+
+    public EditorWindow editorWindow;
+
+    public ActionManager getActionManager()
+    {
+        return (ActionManager) lookup( ActionManager.ROLE );
+    }
+
+    public Object lookup( String role )
+    {
+        try
+        {
+            return container.lookup( role );
+        }
+        catch ( ComponentLookupException e )
+        {
+            throw new RuntimeException( "error while looking up '" + role + "'.", e );
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public EditorWindow getEditorWindow()
+    {
+        return editorWindow;
+    }
+
+    public void setEditorWindow( EditorWindow editorWindow )
+    {
+        this.editorWindow = editorWindow;
+    }
+
+    public Doxia getDoxia()
+    {
+        return doxia;
+    }
+
+    public DoxiaDocumentBuilder getDoxiaDocumentBuilder()
+    {
+        return doxiaDocumentBuilder;
+    }
+
+    // ----------------------------------------------------------------------
+    // Component Lifecycle
+    // ----------------------------------------------------------------------
+
+    public void contextualize( Context context )
+        throws ContextException
+    {
+        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+    }
+
+    public void start()
+        throws StartingException
+    {
+    }
+
+    public void stop()
+        throws StoppingException
+    {
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultStyleManager.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultStyleManager.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultStyleManager.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DefaultStyleManager.java Sat May  6 13:10:05 2006
@@ -0,0 +1,132 @@
+package org.apache.maven.doxia.editor;
+
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.apache.maven.doxia.editor.model.DoxiaAttribute;
+
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.StyleConstants;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DefaultStyleManager
+    extends AbstractLogEnabled
+    implements StyleManager, Initializable
+{
+    private SimpleAttributeSet titleStyle = new SimpleAttributeSet();
+
+    private SimpleAttributeSet authorStyle = new SimpleAttributeSet();
+
+    private SimpleAttributeSet dateStyle = new SimpleAttributeSet();
+
+    private SimpleAttributeSet section1Style = new SimpleAttributeSet();
+
+    private SimpleAttributeSet section2Style = new SimpleAttributeSet();
+
+    private SimpleAttributeSet section3Style = new SimpleAttributeSet();
+
+    private SimpleAttributeSet section4Style = new SimpleAttributeSet();
+
+    private SimpleAttributeSet section5Style = new SimpleAttributeSet();
+
+    private SimpleAttributeSet textStyle = new SimpleAttributeSet();
+
+    private SimpleAttributeSet paragraphSeparatorStyle = new SimpleAttributeSet();
+
+    // ----------------------------------------------------------------------
+    // StyleManager Implementation
+    // ----------------------------------------------------------------------
+
+    public SimpleAttributeSet getTitleStyle()
+    {
+        return titleStyle;
+    }
+
+    public SimpleAttributeSet getAuthorStyle()
+    {
+        return authorStyle;
+    }
+
+    public SimpleAttributeSet getDateStyle()
+    {
+        return dateStyle;
+    }
+
+    public SimpleAttributeSet getSection1Style()
+    {
+        return section1Style;
+    }
+
+    public SimpleAttributeSet getSection2Style()
+    {
+        return section2Style;
+    }
+
+    public SimpleAttributeSet getSection3Style()
+    {
+        return section3Style;
+    }
+
+    public SimpleAttributeSet getSection4Style()
+    {
+        return section4Style;
+    }
+
+    public SimpleAttributeSet getSection5Style()
+    {
+        return section5Style;
+    }
+
+    public SimpleAttributeSet getTextStyle()
+    {
+        return textStyle;
+    }
+
+    public SimpleAttributeSet getParagraphSeparatorStyle()
+    {
+        return paragraphSeparatorStyle;
+    }
+
+    // ----------------------------------------------------------------------
+    // Component Lifecycle
+    // ----------------------------------------------------------------------
+
+    public void initialize()
+        throws InitializationException
+    {
+        StyleConstants.setBold( titleStyle, true );
+        StyleConstants.setFontSize( titleStyle, 20 );
+        titleStyle.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.TITLE );
+
+        StyleConstants.setFontSize( authorStyle, 20 );
+        authorStyle.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.AUTHOR );
+
+        StyleConstants.setFontSize( dateStyle, 20 );
+        dateStyle.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.DATE );
+
+        StyleConstants.setFontSize( section1Style, 18 );
+        section1Style.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.SECTION_1 );
+
+        StyleConstants.setFontSize( section2Style, 16 );
+        StyleConstants.setItalic( section2Style, true );
+        section2Style.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.SECTION_2 );
+
+        StyleConstants.setFontSize( section3Style, 14 );
+        section3Style.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.SECTION_3 );
+
+        StyleConstants.setFontSize( section4Style, 12 );
+        StyleConstants.setBold( section4Style, true );
+        section4Style.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.SECTION_4 );
+
+        StyleConstants.setFontSize( section5Style, 12 );
+        StyleConstants.setItalic( section5Style, true );
+        section5Style.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.SECTION_5 );
+
+        textStyle.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.TEXT );
+
+        paragraphSeparatorStyle.addAttribute( DoxiaAttribute.TYPE, DoxiaAttribute.PARAGRAPH_SEPARATOR );
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditor.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditor.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditor.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditor.java Sat May  6 13:10:05 2006
@@ -0,0 +1,49 @@
+package org.apache.maven.doxia.editor;
+
+import org.apache.maven.doxia.editor.windows.EditorWindow;
+import org.codehaus.plexus.embed.Embedder;
+
+import javax.swing.*;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DoxiaEditor
+{
+    public static void main( String[] args )
+        throws Exception
+    {
+        new DoxiaEditor().work();
+    }
+
+    private void work()
+        throws Exception
+    {
+        Embedder embedder = new Embedder();
+
+        embedder.start();
+
+        Application application = (Application) embedder.lookup( Application.ROLE );
+
+        EditorWindow window = new EditorWindow( application );
+
+        application.setEditorWindow( window );
+
+        window.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
+
+        application.getActionManager().getAction( "open-document" ).actionPerformed( null );
+
+        // ----------------------------------------------------------------------
+        // Power on
+        // ----------------------------------------------------------------------
+
+        window.show();
+
+        // ----------------------------------------------------------------------
+        // Power off
+        // ----------------------------------------------------------------------
+
+        embedder.release( application );
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditorException.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditorException.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditorException.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/DoxiaEditorException.java Sat May  6 13:10:05 2006
@@ -0,0 +1,19 @@
+package org.apache.maven.doxia.editor;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DoxiaEditorException
+    extends Exception
+{
+    public DoxiaEditorException( String message )
+    {
+        super( message );
+    }
+
+    public DoxiaEditorException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/EditorDocumentListener.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/EditorDocumentListener.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/EditorDocumentListener.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/EditorDocumentListener.java Sat May  6 13:10:05 2006
@@ -0,0 +1,53 @@
+package org.apache.maven.doxia.editor;
+
+import org.apache.maven.doxia.editor.model.DoxiaAttribute;
+
+import javax.swing.event.DocumentListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.text.Element;
+import javax.swing.text.StyledDocument;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class EditorDocumentListener
+    implements DocumentListener
+{
+    // ----------------------------------------------------------------------
+    // DocumentListener Implementation
+    // ----------------------------------------------------------------------
+
+    public void changedUpdate( DocumentEvent e )
+    {
+//        System.out.println( "EditorDocumentListener.changedUpdate" );
+//
+//        System.out.println( "e.getOffset() = " + e.getOffset() );
+//        System.out.println( "e.getLength() = " + e.getLength() );
+//        System.out.println( "e.getType() = " + e.getType() );
+//
+//        Element element = ( (StyledDocument) e.getDocument() ).getCharacterElement( e.getOffset() );
+//
+//        Object type = element.getAttributes().getAttribute( DoxiaAttribute.TYPE );
+//
+//        System.out.println( "type = " + type );
+    }
+
+    public void insertUpdate( DocumentEvent e )
+    {
+//        System.out.println( "EditorDocumentListener.insertUpdate" );
+//
+//        System.out.println( "e.getOffset() = " + e.getOffset() );
+//        System.out.println( "e.getLength() = " + e.getLength() );
+//        System.out.println( "e.getType() = " + e.getType() );
+    }
+
+    public void removeUpdate( DocumentEvent e )
+    {
+//        System.out.println( "EditorDocumentListener.removeUpdate" );
+//
+//        System.out.println( "e.getOffset() = " + e.getOffset() );
+//        System.out.println( "e.getLength() = " + e.getLength() );
+//        System.out.println( "e.getType() = " + e.getType() );
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/StyleManager.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/StyleManager.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/StyleManager.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/StyleManager.java Sat May  6 13:10:05 2006
@@ -0,0 +1,32 @@
+package org.apache.maven.doxia.editor;
+
+import javax.swing.text.SimpleAttributeSet;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public interface StyleManager
+{
+    String ROLE = StyleManager.class.getName();
+
+    SimpleAttributeSet getTitleStyle();
+
+    SimpleAttributeSet getAuthorStyle();
+
+    SimpleAttributeSet getDateStyle();
+
+    SimpleAttributeSet getSection1Style();
+
+    SimpleAttributeSet getSection2Style();
+
+    SimpleAttributeSet getSection3Style();
+
+    SimpleAttributeSet getSection4Style();
+
+    SimpleAttributeSet getSection5Style();
+
+    SimpleAttributeSet getTextStyle();
+
+    SimpleAttributeSet getParagraphSeparatorStyle();
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/AbstractDoxiaAction.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/AbstractDoxiaAction.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/AbstractDoxiaAction.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/AbstractDoxiaAction.java Sat May  6 13:10:05 2006
@@ -0,0 +1,45 @@
+package org.apache.maven.doxia.editor.action;
+
+import org.apache.maven.doxia.editor.Application;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public abstract class AbstractDoxiaAction
+    extends AbstractAction
+{
+    private Application application;
+
+    public Application getApplication()
+    {
+        return application;
+    }
+
+    public void setApplication( Application application )
+    {
+        this.application = application;
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    protected abstract void doAction( ActionEvent e )
+        throws Exception;
+
+    public final void actionPerformed( ActionEvent event )
+    {
+        try
+        {
+            doAction( event );
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace( System.out );
+        }
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/OpenDocumentAction.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/OpenDocumentAction.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/OpenDocumentAction.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/OpenDocumentAction.java Sat May  6 13:10:05 2006
@@ -0,0 +1,44 @@
+package org.apache.maven.doxia.editor.action;
+
+import org.apache.maven.doxia.Doxia;
+import org.apache.maven.doxia.editor.io.DebugSink;
+import org.apache.maven.doxia.editor.io.EditorSink;
+import org.apache.maven.doxia.editor.io.PipelineSink;
+import org.apache.maven.doxia.editor.model.DoxiaDocument;
+
+import java.awt.event.ActionEvent;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class OpenDocumentAction
+    extends AbstractDoxiaAction
+{
+    public void doAction( ActionEvent event )
+        throws Exception
+    {
+        // ----------------------------------------------------------------------
+        // Load the model
+        // ----------------------------------------------------------------------
+
+        Doxia doxia = getApplication().getDoxia();
+
+        EditorSink editorSink = new EditorSink();
+
+        List pipeline = new ArrayList();
+        pipeline.add( DebugSink.newInstance() );
+        pipeline.add( editorSink );
+
+        doxia.parse( new FileReader( "src/test/apt/test.apt" ), "apt", PipelineSink.newInstance( pipeline ) );
+
+        DoxiaDocument document = editorSink.getDocument();
+
+        getApplication().getDoxiaDocumentBuilder().loadDocument( document, getApplication().getEditorWindow().getDocument() );
+
+        getApplication().getEditorWindow().setTitle( document.getTitle().getText() );
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/SaveDocumentAction.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/SaveDocumentAction.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/SaveDocumentAction.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/SaveDocumentAction.java Sat May  6 13:10:05 2006
@@ -0,0 +1,21 @@
+package org.apache.maven.doxia.editor.action;
+
+import org.apache.maven.doxia.editor.io.DoxiaDocumentSerializer;
+
+import java.awt.event.ActionEvent;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class SaveDocumentAction
+    extends AbstractDoxiaAction
+{
+    public void doAction( ActionEvent e )
+        throws Exception
+    {
+        DoxiaDocumentSerializer serializer = (DoxiaDocumentSerializer) getApplication().lookup( DoxiaDocumentSerializer.ROLE );
+
+        serializer.serialize( getApplication().getEditorWindow().getDocument(), "xdoc" );
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/ActionManager.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/ActionManager.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/ActionManager.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/ActionManager.java Sat May  6 13:10:05 2006
@@ -0,0 +1,14 @@
+package org.apache.maven.doxia.editor.action.manager;
+
+import javax.swing.*;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public interface ActionManager
+{
+    String ROLE = ActionManager.class.getName();
+
+    Action getAction( String name );
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/DefaultActionManager.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/DefaultActionManager.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/DefaultActionManager.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/action/manager/DefaultActionManager.java Sat May  6 13:10:05 2006
@@ -0,0 +1,55 @@
+package org.apache.maven.doxia.editor.action.manager;
+
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.apache.maven.doxia.editor.action.manager.ActionManager;
+import org.apache.maven.doxia.editor.action.AbstractDoxiaAction;
+import org.apache.maven.doxia.editor.Application;
+
+import javax.swing.*;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DefaultActionManager
+    extends AbstractLogEnabled
+    implements ActionManager, Initializable
+{
+    private Application application;
+
+    private Map actions = new HashMap();
+
+    // ----------------------------------------------------------------------
+    // ActionManager Implementation
+    // ----------------------------------------------------------------------
+
+    public Action getAction( String name )
+    {
+        Action action = (Action) actions.get( name );
+
+        if ( action == null )
+        {
+            throw new RuntimeException( "No such action '" + name + "'." );
+        }
+
+        if ( action instanceof AbstractDoxiaAction )
+        {
+            ((AbstractDoxiaAction) action).setApplication( application );
+        }
+
+        return action;
+    }
+
+    // ----------------------------------------------------------------------
+    // Component Lifecycle
+    // ----------------------------------------------------------------------
+
+    public void initialize()
+        throws InitializationException
+    {
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DebugSink.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DebugSink.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DebugSink.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DebugSink.java Sat May  6 13:10:05 2006
@@ -0,0 +1,28 @@
+package org.apache.maven.doxia.editor.io;
+
+import org.apache.maven.doxia.sink.Sink;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DebugSink
+    implements InvocationHandler
+{
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        System.out.println( "element: " + method.getName() );
+
+        return null;
+    }
+
+    public static Sink newInstance()
+    {
+        return (Sink) Proxy.newProxyInstance( DebugSink.class.getClassLoader(), new Class[]{Sink.class}, new DebugSink() );
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentBuilder.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentBuilder.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentBuilder.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentBuilder.java Sat May  6 13:10:05 2006
@@ -0,0 +1,194 @@
+package org.apache.maven.doxia.editor.io;
+
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.apache.maven.doxia.editor.model.DoxiaDocument;
+import org.apache.maven.doxia.editor.model.Element;
+import org.apache.maven.doxia.editor.model.Section;
+import org.apache.maven.doxia.editor.model.Text;
+import org.apache.maven.doxia.editor.model.Paragraph;
+import org.apache.maven.doxia.editor.StyleManager;
+import org.apache.maven.doxia.editor.DoxiaEditorException;
+
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.StyleConstants;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DefaultDoxiaDocumentBuilder
+    extends AbstractLogEnabled
+    implements DoxiaDocumentBuilder
+{
+    private final static String newLine = System.getProperty( "line.separator" );
+
+    private StyleManager styleManager;
+
+    // ----------------------------------------------------------------------
+    // DoxiaDocumentBuilder Implementation
+    // ----------------------------------------------------------------------
+
+    public void loadDocument( DoxiaDocument doxiaDocument, Document document )
+        throws DoxiaEditorException
+    {
+        try
+        {
+            if ( doxiaDocument.getTitle() != null )
+            {
+                document.insertString( document.getLength(), doxiaDocument.getTitle().getText() + newLine,
+                                       styleManager.getTitleStyle() );
+            }
+
+            if ( doxiaDocument.getAuthor() != null )
+            {
+                document.insertString( document.getLength(), "Author: " + doxiaDocument.getAuthor().getText() + newLine,
+                                       styleManager.getAuthorStyle() );
+            }
+
+            if ( doxiaDocument.getDate() != null )
+            {
+                document.insertString( document.getLength(), "Date: " + doxiaDocument.getDate().getText() + newLine,
+                                       styleManager.getDateStyle() );
+            }
+
+            insertChildren( document, doxiaDocument );
+        }
+        catch ( BadLocationException e )
+        {
+            throw new DoxiaEditorException( "Error while loading document", e );
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private void insertChildren( Document document, Element element )
+        throws BadLocationException
+    {
+        for ( Iterator it = element.getChildren().iterator(); it.hasNext(); )
+        {
+            Object o = it.next();
+
+            insertElement( document, o );
+        }
+    }
+
+    private void insertElement( Document document, Object o )
+        throws BadLocationException
+    {
+        boolean insertChildren;
+
+        if ( o instanceof Section )
+        {
+            insertChildren = insertSection( document, (Section) o );
+        }
+        else if ( o instanceof Text )
+        {
+            insertChildren = insertText( document, (Text) o, true );
+        }
+        else if ( o instanceof Paragraph )
+        {
+            insertChildren = insertParagraph( document, (Paragraph) o );
+        }
+        else
+        {
+            // This would be bad.
+            System.err.println( "Unknown type: " + o.getClass().getName() );
+            insertChildren = false;
+        }
+
+        if ( insertChildren && o instanceof Element )
+        {
+            insertChildren( document, (Element) o );
+        }
+    }
+
+    private boolean insertSection( Document document, Section section )
+        throws BadLocationException
+    {
+        AttributeSet style;
+
+        switch ( section.getDepth() )
+        {
+            case 1:
+                style = styleManager.getSection1Style();
+                break;
+            case 2:
+                style = styleManager.getSection2Style();
+                break;
+            case 3:
+                style = styleManager.getSection3Style();
+                break;
+            case 4:
+                style = styleManager.getSection4Style();
+                break;
+            case 5:
+                style = styleManager.getSection5Style();
+                break;
+            default:
+                throw new RuntimeException( "Unknown section depth: " + section.getDepth() );
+        }
+        System.out.println(
+            "Inserting section, start: " + document.getLength() + ", size: " + section.getTitle().getText().length() );
+
+        document.insertString( document.getLength(), section.getTitle().getText() + newLine, style );
+
+        return true;
+    }
+
+    private boolean insertText( Document document, Text text, boolean insertNewline )
+        throws BadLocationException
+    {
+        // TODO: This has to come from the style manager and has to be singletons
+
+        MutableAttributeSet attributeSet = (MutableAttributeSet) styleManager.getTextStyle().clone();
+
+        if ( text.isBold() )
+        {
+            StyleConstants.setBold( attributeSet, true );
+        }
+
+        if ( text.isItalic() )
+        {
+            StyleConstants.setItalic( attributeSet, true );
+        }
+
+        if ( text.isMonospaced() )
+        {
+            // TODO:
+        }
+
+        System.out.println( "Inserting text, start: " + document.getLength() + ", size: " + text.getText().length() );
+        document.insertString( document.getLength(), text.getText(), attributeSet );
+
+        if ( insertNewline )
+        {
+            document.insertString( document.getLength(), newLine, attributeSet );
+        }
+
+        return true;
+    }
+
+    private boolean insertParagraph( Document document, Paragraph paragraph )
+        throws BadLocationException
+    {
+        for ( int i = 0; i < paragraph.getChildren().size(); i++ )
+        {
+            Object o = paragraph.getChildren().get( i );
+
+            insertText( document, (Text) o, false );
+        }
+
+        System.out.println( "Inserting paragraph, start: " + document.getLength() + ", size: 2" );
+        document.insertString( document.getLength(), newLine + newLine, styleManager.getParagraphSeparatorStyle() );
+
+        return false;
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentSerializer.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentSerializer.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentSerializer.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DefaultDoxiaDocumentSerializer.java Sat May  6 13:10:05 2006
@@ -0,0 +1,53 @@
+package org.apache.maven.doxia.editor.io;
+
+import org.apache.maven.doxia.Doxia;
+import org.apache.maven.doxia.editor.Application;
+import org.apache.maven.doxia.module.xdoc.XdocSink;
+import org.apache.maven.doxia.parser.ParseException;
+import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import javax.swing.text.Document;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DefaultDoxiaDocumentSerializer
+    extends AbstractLogEnabled
+    implements DoxiaDocumentSerializer
+{
+    private Application application;
+
+    private Doxia doxia;
+
+    // ----------------------------------------------------------------------
+    // DoxiaDocumentSerializer Implementation
+    // ----------------------------------------------------------------------
+
+    public void serialize( Document document, String sinkId )
+        throws ParserNotFoundException, ParseException, IOException
+    {
+        XdocSink sink = new XdocSink( new FileWriter( "/tmp/document.xdoc" ) );
+
+        DocumentParser.document.set( application.getEditorWindow().getDocument() );
+
+        List list = new ArrayList();
+        list.add( DebugSink.newInstance() );
+//        list.add( new WellformednessCheckingSink() );
+        list.add( sink );
+
+        try
+        {
+            doxia.parse( null, "doxia-document", PipelineSink.newInstance( list ) );
+        }
+        finally
+        {
+            DocumentParser.document.set( null );
+        }
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DocumentParser.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DocumentParser.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DocumentParser.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DocumentParser.java Sat May  6 13:10:05 2006
@@ -0,0 +1,147 @@
+package org.apache.maven.doxia.editor.io;
+
+import org.apache.maven.doxia.editor.model.DoxiaAttribute;
+import org.apache.maven.doxia.parser.ParseException;
+import org.apache.maven.doxia.parser.Parser;
+import org.apache.maven.doxia.sink.Sink;
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.Element;
+import java.io.Reader;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DocumentParser
+    implements Parser
+{
+    public static ThreadLocal document = new ThreadLocal();
+
+    private boolean inHead;
+
+    private boolean startedBody;
+
+    public void parse( Reader source, Sink sink )
+        throws ParseException
+    {
+        Document document = (Document) DocumentParser.document.get();
+
+        System.out.println( "document.getLength() = " + document.getLength() );
+
+        try
+        {
+            inHead = true;
+
+            sink.head();
+            dump( document.getDefaultRootElement(), sink );
+            sink.body_();
+        }
+        catch ( BadLocationException e )
+        {
+            System.out.println( "e.offsetRequested() = " + e.offsetRequested() );
+            throw new ParseException( "Error while parsing document.", e );
+        }
+    }
+
+    private void dump( Element element, Sink sink )
+        throws BadLocationException
+    {
+        if ( !inHead && !startedBody )
+        {
+            sink.head_();
+            sink.body();
+
+            startedBody = true;
+        }
+
+        AttributeSet attributes = element.getAttributes();
+        Object type = attributes.getAttribute( DoxiaAttribute.TYPE );
+
+        if ( type != null )
+        {
+            System.out.println( "type: " + type );
+
+            if ( type == DoxiaAttribute.TITLE )
+            {
+                sink.title();
+                sink.text( getText( element ) );
+                sink.title_();
+            }
+            else if ( type == DoxiaAttribute.AUTHOR )
+            {
+                sink.author();
+                sink.text( getText( element ) );
+                sink.author_();
+            }
+            else if ( type == DoxiaAttribute.DATE )
+            {
+                sink.date();
+                sink.text( getText( element ) );
+                sink.date_();
+            }
+            else if ( type == DoxiaAttribute.SECTION_1 )
+            {
+                sink.section1();
+                sink.text( getText( element ) );
+                sink.section1_();
+                inHead = false;
+            }
+            else if ( type == DoxiaAttribute.SECTION_2 )
+            {
+                sink.section2();
+                sink.text( getText( element ) );
+                sink.section2_();
+                inHead = false;
+            }
+            else if ( type == DoxiaAttribute.SECTION_3 )
+            {
+                sink.section3();
+                sink.text( getText( element ) );
+                sink.section3_();
+                inHead = false;
+            }
+            else if ( type == DoxiaAttribute.SECTION_4 )
+            {
+                sink.section4();
+                sink.text( getText( element ) );
+                sink.section4_();
+                inHead = false;
+            }
+            else if ( type == DoxiaAttribute.SECTION_5 )
+            {
+                sink.section5();
+                sink.text( getText( element ) );
+                sink.section5_();
+                inHead = false;
+            }
+            else if ( type == DoxiaAttribute.PARAGRAPH_SEPARATOR )
+            {
+                sink.paragraph_();
+                sink.paragraph();
+                inHead = false;
+            }
+            else if ( type == DoxiaAttribute.TEXT )
+            {
+                sink.text( getText( element ) );
+                inHead = false;
+            }
+        }
+
+        for ( int i = 0; i < element.getElementCount(); i++ )
+        {
+            dump( element.getElement( i ), sink );
+        }
+    }
+
+    private String getText( Element element )
+        throws BadLocationException
+    {
+        int startOffset = element.getStartOffset();
+        int endOffset = element.getEndOffset();
+
+        return element.getDocument().getText( startOffset, endOffset - startOffset ).trim();
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentBuilder.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentBuilder.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentBuilder.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentBuilder.java Sat May  6 13:10:05 2006
@@ -0,0 +1,18 @@
+package org.apache.maven.doxia.editor.io;
+
+import org.apache.maven.doxia.editor.DoxiaEditorException;
+import org.apache.maven.doxia.editor.model.DoxiaDocument;
+
+import javax.swing.text.Document;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public interface DoxiaDocumentBuilder
+{
+    String ROLE = DoxiaDocumentBuilder.class.getName();
+
+    void loadDocument( DoxiaDocument doxiaDocument, Document document )
+        throws DoxiaEditorException;
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentSerializer.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentSerializer.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentSerializer.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/DoxiaDocumentSerializer.java Sat May  6 13:10:05 2006
@@ -0,0 +1,19 @@
+package org.apache.maven.doxia.editor.io;
+
+import org.apache.maven.doxia.parser.ParseException;
+import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
+
+import javax.swing.text.Document;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public interface DoxiaDocumentSerializer
+{
+    String ROLE = DoxiaDocumentSerializer.class.getName();
+
+    void serialize( Document document, String sinkId )
+        throws ParserNotFoundException, ParseException, IOException;
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/EditorSink.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/EditorSink.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/EditorSink.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/EditorSink.java Sat May  6 13:10:05 2006
@@ -0,0 +1,451 @@
+package org.apache.maven.doxia.editor.io;
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.editor.model.DoxiaDocument;
+import org.apache.maven.doxia.editor.model.Section;
+import org.apache.maven.doxia.editor.model.Paragraph;
+import org.apache.maven.doxia.editor.model.Text;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class EditorSink
+    implements Sink
+{
+    private DoxiaDocument document;
+
+    private Section section1;
+
+    private Section section2;
+
+    private Section section3;
+
+    private Section section4;
+
+    private Section section5;
+
+    private Section currentSection;
+
+    private Paragraph paragraph;
+
+    private Text text;
+
+    private boolean italic;
+
+    private boolean bold;
+
+    private boolean monospaced;
+
+    // ----------------------------------------------------------------------
+    // Sink Implementation
+    // ----------------------------------------------------------------------
+
+    public void head()
+    {
+    }
+
+    public void head_()
+    {
+    }
+
+    public void body()
+    {
+    }
+
+    public void body_()
+    {
+    }
+
+    public void section1()
+    {
+        currentSection = section1 = new Section();
+    }
+
+    public void section1_()
+    {
+        section1.setDepth( 1 );
+        getDocument().getChildren().add( section1 );
+    }
+
+    public void section2()
+    {
+        currentSection = section2 = new Section();
+    }
+
+    public void section2_()
+    {
+        section2.setDepth( 2 );
+        section1.getChildren().add( section2 );
+    }
+
+    public void section3()
+    {
+        currentSection = section3 = new Section();
+    }
+
+    public void section3_()
+    {
+        section3.setDepth( 3 );
+        section2.getChildren().add( section3 );
+    }
+
+    public void section4()
+    {
+        currentSection = section4 = new Section();
+    }
+
+    public void section4_()
+    {
+        section4.setDepth( 4 );
+        section3.getChildren().add( section4 );
+    }
+
+    public void section5()
+    {
+        currentSection = section5 = new Section();
+    }
+
+    public void section5_()
+    {
+        section5.setDepth( 5 );
+        section4.getChildren().add( section5 );
+    }
+
+    public void list()
+    {
+    }
+
+    public void list_()
+    {
+    }
+
+    public void listItem()
+    {
+    }
+
+    public void listItem_()
+    {
+    }
+
+    public void numberedList( int numbering )
+    {
+    }
+
+    public void numberedList_()
+    {
+    }
+
+    public void numberedListItem()
+    {
+    }
+
+    public void numberedListItem_()
+    {
+    }
+
+    public void definitionList()
+    {
+    }
+
+    public void definitionList_()
+    {
+    }
+
+    public void definitionListItem()
+    {
+    }
+
+    public void definitionListItem_()
+    {
+    }
+
+    public void definition()
+    {
+    }
+
+    public void definition_()
+    {
+    }
+
+    public void figure()
+    {
+    }
+
+    public void figure_()
+    {
+    }
+
+    public void table()
+    {
+    }
+
+    public void table_()
+    {
+    }
+
+    public void tableRows( int[] justification, boolean grid )
+    {
+    }
+
+    public void tableRows_()
+    {
+    }
+
+    public void tableRow()
+    {
+    }
+
+    public void tableRow_()
+    {
+    }
+
+    public void title()
+    {
+    }
+
+    public void title_()
+    {
+        getDocument().setTitle( text );
+    }
+
+    public void author()
+    {
+    }
+
+    public void author_()
+    {
+        getDocument().setAuthor( text );
+    }
+
+    public void date()
+    {
+    }
+
+    public void date_()
+    {
+        getDocument().setDate( text );
+    }
+
+    public void sectionTitle()
+    {
+    }
+
+    public void sectionTitle_()
+    {
+    }
+
+    public void sectionTitle1()
+    {
+    }
+
+    public void sectionTitle1_()
+    {
+        section1.setTitle( text );
+    }
+
+    public void sectionTitle2()
+    {
+    }
+
+    public void sectionTitle2_()
+    {
+        section2.setTitle( text );
+    }
+
+    public void sectionTitle3()
+    {
+    }
+
+    public void sectionTitle3_()
+    {
+        section3.setTitle( text );
+    }
+
+    public void sectionTitle4()
+    {
+    }
+
+    public void sectionTitle4_()
+    {
+        section4.setTitle( text );
+    }
+
+    public void sectionTitle5()
+    {
+    }
+
+    public void sectionTitle5_()
+    {
+        section5.setTitle( text );
+    }
+
+    public void paragraph()
+    {
+        paragraph = new Paragraph();
+    }
+
+    public void paragraph_()
+    {
+        currentSection.getChildren().add( paragraph );
+        paragraph = null;
+    }
+
+    public void verbatim( boolean boxed )
+    {
+    }
+
+    public void verbatim_()
+    {
+    }
+
+    public void definedTerm()
+    {
+    }
+
+    public void definedTerm_()
+    {
+    }
+
+    public void figureCaption()
+    {
+    }
+
+    public void figureCaption_()
+    {
+    }
+
+    public void tableCell()
+    {
+    }
+
+    public void tableCell( String width )
+    {
+    }
+
+    public void tableCell_()
+    {
+    }
+
+    public void tableHeaderCell()
+    {
+    }
+
+    public void tableHeaderCell( String width )
+    {
+    }
+
+    public void tableHeaderCell_()
+    {
+    }
+
+    public void tableCaption()
+    {
+    }
+
+    public void tableCaption_()
+    {
+    }
+
+    public void figureGraphics( String name )
+    {
+    }
+
+    public void horizontalRule()
+    {
+    }
+
+    public void pageBreak()
+    {
+    }
+
+    public void anchor( String name )
+    {
+    }
+
+    public void anchor_()
+    {
+    }
+
+    public void link( String name )
+    {
+    }
+
+    public void link_()
+    {
+    }
+
+    public void italic()
+    {
+        italic = true;
+    }
+
+    public void italic_()
+    {
+        italic = false;
+    }
+
+    public void bold()
+    {
+        bold = true;
+    }
+
+    public void bold_()
+    {
+        bold = false;
+    }
+
+    public void monospaced()
+    {
+        monospaced = true;
+    }
+
+    public void monospaced_()
+    {
+        monospaced = false;
+    }
+
+    public void lineBreak()
+    {
+    }
+
+    public void nonBreakingSpace()
+    {
+    }
+
+    public void text( String text )
+    {
+        this.text = new Text( text, bold, italic, monospaced );
+
+        if ( paragraph != null )
+        {
+            paragraph.getChildren().add( this.text );
+        }
+    }
+
+    public void rawText( String text )
+    {
+    }
+
+    public void flush()
+    {
+    }
+
+    public void close()
+    {
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public DoxiaDocument getDocument()
+    {
+        if ( document == null )
+        {
+            document = new DoxiaDocument();
+        }
+
+        return document;
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/PipelineSink.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/PipelineSink.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/PipelineSink.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/io/PipelineSink.java Sat May  6 13:10:05 2006
@@ -0,0 +1,50 @@
+package org.apache.maven.doxia.editor.io;
+
+import org.apache.maven.doxia.sink.Sink;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class PipelineSink
+    implements InvocationHandler
+{
+    private List pipeline;
+
+    public PipelineSink( List pipeline )
+    {
+        this.pipeline = pipeline;
+    }
+
+    public void addSink( Sink sink )
+    {
+        pipeline.add( sink );
+    }
+
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        for ( Iterator it = pipeline.iterator(); it.hasNext(); )
+        {
+            Sink sink = (Sink) it.next();
+
+            method.invoke( sink, args );
+        }
+
+        return null;
+    }
+
+    public static Sink newInstance( List pipeline )
+    {
+        return (Sink) Proxy.newProxyInstance( PipelineSink.class.getClassLoader(),
+                                              new Class[]{Sink.class},
+                                              new PipelineSink( pipeline ) );
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaAttribute.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaAttribute.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaAttribute.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaAttribute.java Sat May  6 13:10:05 2006
@@ -0,0 +1,42 @@
+package org.apache.maven.doxia.editor.model;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DoxiaAttribute
+{
+    public final static String TYPE = "DOXIA_TYPE";
+
+    public final static DoxiaAttribute TITLE = new DoxiaAttribute( "TITLE" );
+    public final static DoxiaAttribute AUTHOR = new DoxiaAttribute( "AUTHOR" );
+    public final static DoxiaAttribute DATE = new DoxiaAttribute( "DATE" );
+    public final static DoxiaAttribute SECTION_1 = new DoxiaAttribute( "SECTION_1" );
+    public final static DoxiaAttribute SECTION_2 = new DoxiaAttribute( "SECTION_2" );
+    public final static DoxiaAttribute SECTION_3 = new DoxiaAttribute( "SECTION_3" );
+    public final static DoxiaAttribute SECTION_4 = new DoxiaAttribute( "SECTION_4" );
+    public final static DoxiaAttribute SECTION_5 = new DoxiaAttribute( "SECTION_5" );
+    public final static DoxiaAttribute TEXT = new DoxiaAttribute( "TEXT" );
+    public final static DoxiaAttribute PARAGRAPH_SEPARATOR = new DoxiaAttribute( "PARAGRAPH_SEPARATOR" );
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private final String value;
+
+    public DoxiaAttribute( String value )
+    {
+        this.value = value;
+    }
+
+    public static String getType()
+    {
+        return TYPE;
+    }
+
+    public String toString()
+    {
+        return "DoxiaAttribute: " + value;
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaDocument.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaDocument.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaDocument.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/DoxiaDocument.java Sat May  6 13:10:05 2006
@@ -0,0 +1,45 @@
+package org.apache.maven.doxia.editor.model;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class DoxiaDocument
+    extends Element
+{
+    private Text title;
+
+    private Text author;
+
+    private Text date;
+
+    public Text getTitle()
+    {
+        return title;
+    }
+
+    public void setTitle( Text title )
+    {
+        this.title = title;
+    }
+
+    public Text getAuthor()
+    {
+        return author;
+    }
+
+    public void setAuthor( Text author )
+    {
+        this.author = author;
+    }
+
+    public Text getDate()
+    {
+        return date;
+    }
+
+    public void setDate( Text date )
+    {
+        this.date = date;
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Element.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Element.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Element.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Element.java Sat May  6 13:10:05 2006
@@ -0,0 +1,28 @@
+package org.apache.maven.doxia.editor.model;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class Element
+{
+    private List children;
+
+    public List getChildren()
+    {
+        if ( children == null )
+        {
+            children = new ArrayList();
+        }
+
+        return children;
+    }
+
+    public void setChildren( List children )
+    {
+        this.children = children;
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/LeafElement.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/LeafElement.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/LeafElement.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/LeafElement.java Sat May  6 13:10:05 2006
@@ -0,0 +1,9 @@
+package org.apache.maven.doxia.editor.model;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class LeafElement
+{
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Paragraph.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Paragraph.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Paragraph.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Paragraph.java Sat May  6 13:10:05 2006
@@ -0,0 +1,10 @@
+package org.apache.maven.doxia.editor.model;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class Paragraph
+    extends Element
+{
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Section.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Section.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Section.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Section.java Sat May  6 13:10:05 2006
@@ -0,0 +1,43 @@
+package org.apache.maven.doxia.editor.model;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class Section
+    extends Element
+{
+    private Text title;
+
+    private int depth;
+
+    public Section()
+    {
+    }
+
+    public Section( Text title, int depth )
+    {
+        this.title = title;
+        this.depth = depth;
+    }
+
+    public Text getTitle()
+    {
+        return title;
+    }
+
+    public void setTitle( Text title )
+    {
+        this.title = title;
+    }
+
+    public int getDepth()
+    {
+        return depth;
+    }
+
+    public void setDepth( int depth )
+    {
+        this.depth = depth;
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Text.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Text.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Text.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/model/Text.java Sat May  6 13:10:05 2006
@@ -0,0 +1,65 @@
+package org.apache.maven.doxia.editor.model;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class Text
+    extends LeafElement
+{
+    private String text;
+
+    private boolean bold;
+
+    private boolean italic;
+
+    private boolean monospaced;
+
+    public Text( String text, boolean bold, boolean italic, boolean monospaced )
+    {
+        this.text = text;
+        this.bold = bold;
+        this.italic = italic;
+        this.monospaced = monospaced;
+    }
+
+    public String getText()
+    {
+        return text;
+    }
+
+    public void setText( String text )
+    {
+        this.text = text;
+    }
+
+    public boolean isBold()
+    {
+        return bold;
+    }
+
+    public void setBold( boolean bold )
+    {
+        this.bold = bold;
+    }
+
+    public boolean isItalic()
+    {
+        return italic;
+    }
+
+    public void setItalic( boolean italic )
+    {
+        this.italic = italic;
+    }
+
+    public boolean isMonospaced()
+    {
+        return monospaced;
+    }
+
+    public void setMonospaced( boolean monospaced )
+    {
+        this.monospaced = monospaced;
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/windows/EditorWindow.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/windows/EditorWindow.java?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/windows/EditorWindow.java (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/java/org/apache/maven/doxia/editor/windows/EditorWindow.java Sat May  6 13:10:05 2006
@@ -0,0 +1,54 @@
+package org.apache.maven.doxia.editor.windows;
+
+import org.apache.maven.doxia.editor.Application;
+import org.apache.maven.doxia.editor.EditorDocumentListener;
+
+import javax.swing.*;
+import javax.swing.text.Document;
+import java.awt.*;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class EditorWindow
+    extends JFrame
+{
+    private Application application;
+
+    private JToolBar toolBar;
+
+    private JTextPane textPane;
+
+    private Document document;
+
+    public EditorWindow( Application application )
+        throws HeadlessException
+    {
+        this.application = application;
+
+        // ----------------------------------------------------------------------
+        // Initialize the widgets
+        // ----------------------------------------------------------------------
+
+        textPane = new JTextPane();
+
+        document = textPane.getDocument();
+
+        document.addDocumentListener( new EditorDocumentListener() );
+
+        toolBar = new JToolBar();
+        toolBar.add( application.getActionManager().getAction( "open-document" ) ).setText( "Open" );
+        toolBar.add( application.getActionManager().getAction( "save-document" ) ).setText( "Save" );
+
+        getContentPane().add( textPane, BorderLayout.CENTER );
+        getContentPane().add( toolBar, BorderLayout.PAGE_START );
+        setSize( 600, 500 );
+    }
+
+
+    public Document getDocument()
+    {
+        return document;
+    }
+}

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/resources/META-INF/plexus/components.xml?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/main/resources/META-INF/plexus/components.xml Sat May  6 13:10:05 2006
@@ -0,0 +1,75 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.doxia.editor.io.DoxiaDocumentSerializer</role>
+      <implementation>org.apache.maven.doxia.editor.io.DefaultDoxiaDocumentSerializer</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.doxia.Doxia</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.doxia.editor.Application</role>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.apache.maven.doxia.editor.io.DoxiaDocumentBuilder</role>
+      <implementation>org.apache.maven.doxia.editor.io.DefaultDoxiaDocumentBuilder</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.doxia.editor.StyleManager</role>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.apache.maven.doxia.parser.Parser</role>
+      <role-hint>doxia-document</role-hint>
+      <implementation>org.apache.maven.doxia.editor.io.DocumentParser</implementation>
+    </component>
+    <component>
+      <role>org.apache.maven.doxia.editor.action.manager.ActionManager</role>
+      <implementation>org.apache.maven.doxia.editor.action.manager.DefaultActionManager</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.doxia.editor.Application</role>
+        </requirement>
+        <requirement>
+          <role>javax.swing.Action</role>
+          <field-name>actions</field-name>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.apache.maven.doxia.editor.StyleManager</role>
+      <implementation>org.apache.maven.doxia.editor.DefaultStyleManager</implementation>
+    </component>
+    <component>
+      <role>org.apache.maven.doxia.editor.Application</role>
+      <implementation>org.apache.maven.doxia.editor.DefaultApplication</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.doxia.Doxia</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.doxia.editor.io.DoxiaDocumentBuilder</role>
+        </requirement>
+      </requirements>
+    </component>
+
+    <!--
+     |
+     | Actions
+     |
+     |-->
+    <component>
+      <role>javax.swing.Action</role>
+      <role-hint>open-document</role-hint>
+      <implementation>org.apache.maven.doxia.editor.action.OpenDocumentAction</implementation>
+    </component>
+    <component>
+      <role>javax.swing.Action</role>
+      <role-hint>save-document</role-hint>
+      <implementation>org.apache.maven.doxia.editor.action.SaveDocumentAction</implementation>
+    </component>
+  </components>
+</component-set>

Added: maven/doxia/trunk/doxia-sandbox/doxia-editor/src/test/apt/test.apt
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sandbox/doxia-editor/src/test/apt/test.apt?rev=400356&view=auto
==============================================================================
--- maven/doxia/trunk/doxia-sandbox/doxia-editor/src/test/apt/test.apt (added)
+++ maven/doxia/trunk/doxia-sandbox/doxia-editor/src/test/apt/test.apt Sat May  6 13:10:05 2006
@@ -0,0 +1,18 @@
+ -----
+ Maven: the cute and fully build tool.
+ -----
+ Jason van Zyl
+ -----
+
+Maven: the cute and fluffy build tool that's good for the whole family
+
+ Maven will make you laugh; Maven will make you jump for joy; Maven will
+ make you put that dirty little tool called Ant in the litter box with
+ the cat treats where it belongs!
+
+* Say Goodbye the build time stains!
+
+ Maven helps you get rid of those <hard to get rid of> build stains. Wash with Maven
+ and go!
+
+ Paragraph 2

Modified: maven/doxia/trunk/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java
URL: http://svn.apache.org/viewcvs/maven/doxia/trunk/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java?rev=400356&r1=400355&r2=400356&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java (original)
+++ maven/doxia/trunk/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java Sat May  6 13:10:05 2006
@@ -1,4 +1,6 @@
-package org.apache.maven.doxia.sink;/*
+package org.apache.maven.doxia.sink;
+
+/*
  * Copyright 2004-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -206,4 +208,3 @@
 
     void close();
 }
-



Mime
View raw message