Added more default actions to the StyledEditorKit, and made some other
small related fixes.

2005-12-13  Lillian Angel  <[EMAIL PROTECTED]>

        * javax/swing/AbstractAction.java:
        (putValue): Fixed check, should use .equals when comparing
        objects.
        * javax/swing/text/StyledEditorKit.java
        (UnderlineAction): Fixed name.
        (ItalicAction): Likewise.
        (BoldAction): Likewise.
        (getActions): Added more default actions.
        * javax/swing/text/html/HTMLDocument.java:
        Removed unneeded import statement.
        * javax/swing/text/html/HTMLEditorKit.java:
        Added new field
        (getActions): Fixed to use augmentList to combine
        the actions from the super class with the ones from
        this class.

Index: javax/swing/AbstractAction.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/AbstractAction.java,v
retrieving revision 1.16
diff -u -r1.16 AbstractAction.java
--- javax/swing/AbstractAction.java	26 Jul 2005 15:30:54 -0000	1.16
+++ javax/swing/AbstractAction.java	13 Dec 2005 22:10:02 -0000
@@ -174,7 +174,7 @@
   public void putValue(String key, Object value)
   {
     Object old = getValue(key);
-    if (old != value)
+    if (old == null || !old.equals(value))
     {
       store.put(key, value);
       firePropertyChange(key, old, value);
Index: javax/swing/text/StyledEditorKit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/StyledEditorKit.java,v
retrieving revision 1.16
diff -u -r1.16 StyledEditorKit.java
--- javax/swing/text/StyledEditorKit.java	8 Dec 2005 20:49:43 -0000	1.16
+++ javax/swing/text/StyledEditorKit.java	13 Dec 2005 22:10:02 -0000
@@ -67,7 +67,7 @@
      */
     public UnderlineAction()
     {
-      super("TODO"); // TODO: Figure out name for this action.
+      super("font-underline");
     }
 
     /**
@@ -97,7 +97,7 @@
      */
     public ItalicAction()
     {
-      super("TODO"); // TODO: Figure out correct name of this Action.
+      super("font-italic");
     }
 
     /**
@@ -127,7 +127,7 @@
      */
     public BoldAction()
     {
-      super("TODO"); // TODO: Figure out correct name of this Action.
+      super("font-bold");
     }
 
     /**
@@ -585,8 +585,26 @@
   public Action[] getActions()
   {
     Action[] actions1 = super.getActions();
-    Action[] myActions = new Action[] { new BoldAction(), new ItalicAction(),
-					new UnderlineAction() };
+    Action[] myActions = new Action[] { 
+      new FontSizeAction("font-size-8", 8),
+      new FontSizeAction("font-size-10", 10),
+      new FontSizeAction("font-size-12", 12),
+      new FontSizeAction("font-size-14", 14),
+      new FontSizeAction("font-size-16", 16),
+      new FontSizeAction("font-size-18", 18),
+      new FontSizeAction("font-size-24", 24),
+      new FontSizeAction("font-size-36", 36),
+      new FontSizeAction("font-size-48", 48),
+      new FontFamilyAction("font-family-Serif", "Serif"),
+      new FontFamilyAction("font-family-Monospaced", "Monospaced"),
+      new FontFamilyAction("font-family-SansSerif", "SansSerif"),
+      new AlignmentAction("left-justify", StyleConstants.ALIGN_LEFT),
+      new AlignmentAction("center-justify", StyleConstants.ALIGN_CENTER),
+      new AlignmentAction("right-justify", StyleConstants.ALIGN_RIGHT),
+      new BoldAction(),
+      new ItalicAction(),
+      new UnderlineAction()
+    };
     return TextAction.augmentList(actions1, myActions);
   }
 
Index: javax/swing/text/html/HTMLDocument.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/HTMLDocument.java,v
retrieving revision 1.12
diff -u -r1.12 HTMLDocument.java
--- javax/swing/text/html/HTMLDocument.java	13 Dec 2005 21:52:12 -0000	1.12
+++ javax/swing/text/html/HTMLDocument.java	13 Dec 2005 22:10:02 -0000
@@ -41,7 +41,6 @@
 import java.net.URL;
 
 import java.io.IOException;
-import java.io.StringReader;
 
 import java.util.HashMap;
 import java.util.Stack;
Index: javax/swing/text/html/HTMLEditorKit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/HTMLEditorKit.java,v
retrieving revision 1.13
diff -u -r1.13 HTMLEditorKit.java
--- javax/swing/text/html/HTMLEditorKit.java	13 Dec 2005 16:30:03 -0000	1.13
+++ javax/swing/text/html/HTMLEditorKit.java	13 Dec 2005 22:10:03 -0000
@@ -68,6 +68,7 @@
 import javax.swing.text.StyleConstants;
 import javax.swing.text.StyleContext;
 import javax.swing.text.StyledEditorKit;
+import javax.swing.text.TextAction;
 import javax.swing.text.View;
 import javax.swing.text.ViewFactory;
 import javax.swing.text.html.parser.ParserDelegator;
@@ -739,6 +740,13 @@
   public static final String PARA_INDENT_RIGHT = "html-para-indent-right";
   
   /**
+   * Actions for HTML 
+   */
+  private static final Action[] defaultActions = {
+    // FIXME: Add default actions for html
+  };
+  
+  /**
    * The ViewFactory for HTMLFactory.
    */
   HTMLFactory viewFactory;
@@ -997,8 +1005,7 @@
    */
   public Action[] getActions()
   {
-    // FIXME: should return different actions, see static fields.
-    return super.getActions();
+    return TextAction.augmentList(super.getActions(), defaultActions);
   }
   
   /**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to