I wrote the functionality, but forgot to actually USE it.. so this new
patch actually makes JEditorPane by default use HTMLEditorKit when
needed.

This one is accompanied by
gnu.testlet.javax.swing.JEditorPane.ConstructorsAndTypes which
demonstrates the correct behaviour but which we do not pass yet because
of an AssertionError being thrown in the text classes.  This may be
happening because methods that should be overridden in the html packages
are not completed yet.

2005-12-08  Anthony Balkissoon  <[EMAIL PROTECTED]>

        * javax/swing/JEditorPane.java:
        (init): Changed to no-argument instead of taking in an EditorKit and
        passing it to setEditorKit.  Callers will have to call setEditorKit
        themselves.
        (JEditorPane()): Changed call to init to have no arguments, call
        setEditorKit after init.
        (JEditorPane(String, String)): Likewise.
        (JEditorPane(URL)): Don't call default constructor, call init and then
        setEditorKit using the appropriate EditorKit for text/html.

--Tony

On Thu, 2005-12-08 at 15:02 -0500, Anthony Balkissoon wrote:
> This patch accompanies the new tests in
> gnu.testlet.javax.swing.JEditorPane.ContentType
> 
> This patch makes JEditorPane handle different content types properly,
> using the appropriate EditorKit for different types.  This will allow
> Lillian and myself to write test apps for html using JEditorPane because
> now it will use HTMLEditorKit to display the content.
> 
> 2005-12-08  Anthony Balkissoon  <[EMAIL PROTECTED]>
> 
>       * javax/swing/JEditorPane.java:
>       (registerMap): New field.
>       (editorMap): New field.
>       (JEditorPane()): Call init instead of setEditorKit.
>       (JEditorPane(String, String)): Likewise.
>       (init): New method.
>       (createEditorKitForContentType): Implemented and documented.
>       (getEditorKitClassNameForContentType): Likewise.
>       (getEditorKitForContentType): Likewise.
>       (registerEditorKitForContentType): Likewise.
>       (replaceSelection): Call super (this is temporary until the real
>       implementation happens.  There is already a TODO noting that this needs
>       to be implemented.
>       (setEditorKitForContentType): Implemented and documented.
> 
> --Tony
> _______________________________________________
> Classpath-patches mailing list
> Classpath-patches@gnu.org
> http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: javax/swing/JEditorPane.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JEditorPane.java,v
retrieving revision 1.28
diff -u -r1.28 JEditorPane.java
--- javax/swing/JEditorPane.java	8 Dec 2005 20:00:42 -0000	1.28
+++ javax/swing/JEditorPane.java	8 Dec 2005 20:12:54 -0000
@@ -518,7 +518,8 @@
 
   public JEditorPane()
   {
-    init(createDefaultEditorKit());
+    init();
+    setEditorKit(createDefaultEditorKit());
   }
 
   public JEditorPane(String url) throws IOException
@@ -528,25 +529,24 @@
 
   public JEditorPane(String type, String text)
   {
-    init(createEditorKitForContentType(type));
+    init();
+    setEditorKit(createEditorKitForContentType(type));
     setText(text);
   }
 
   public JEditorPane(URL url) throws IOException
   {
-    this();
+    init ();
+    setEditorKit (createEditorKitForContentType("text/html"));;
     setPage(url);
   }
   
   /**
-   * Called by the constructors to set the EditorKit and set up the 
-   * default bindings for content types and EditorKits.
-   * 
-   * @param kit the initial EditorKit
+   * Called by the constructors to set up the default bindings for content 
+   * types and EditorKits.
    */
-  void init(EditorKit kit)
+  void init()
   {
-    setEditorKit(kit);
     editorMap = new HashMap();
     registerMap = new HashMap();
     registerEditorKitForContentType("application/rtf",
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to