This patch (committed) fixes a few minor bugs in the accessibility code (getAccessibleName() for several components, and getSelectedObjects() for JButton), and marks some more methods as stubs:

2006-03-23  David Gilbert  <[EMAIL PROTECTED]>

        * java/awt/Component.java
        (getAccessibleName): Just return accessibleName,
        * javax/swing/AbstractButton.java
        (getAccessibleStateSet): Mark as stub,
        (getAccessibleName): Implemented,
        (getAcessibleIcon): Mark as stub,
        (getAccessibleRelationSet): Likewise,
        (getAccessibleAction): Likewise,
        (getAccessibleValue): Likewise,
        (getAccessibleActionCount): Likewise,
        (getAccessibleActionDescription): Likewise,
        (doAccessibleAction): Likewise,
        (getCurrentAccessibleValue): Likewise,
        (setCurrentAccessibleValue): Likewise,
        (getMinimumAccessibleValue): Likewise,
        (getMaximumAccessibleValue): Likewise,
        (getAccessibleText): Likewise,
        (getIndexAtPoint): Likewise,
        (getCharacterBounds): Likewise,
        (getCharCount): Likewise,
        (getCaretPosition): Likewise,
        (getAtIndex): Likewise,
        (getAfterIndex): Likewise,
        (getBeforeIndex): Likewise,
        (getCharacterAttribute): Likewise,
        (getSelectionStart): Likewise,
        (getSelectionEnd): Likewise,
        (getSelectedText): Likewise,
        (getTextRectangle): Likewise,
        (setIconTextGap): Fire PropertyChangeEvent, not state changed,
        (getIconTextGap): Added @since 1.4,
        (setContentAreaFilled): Reordered code to make event sequence match
        reference implementation,
        * javax/swing/JButton.java
        (getSelectedObjects): Removed,
        *javax/swing/JComponent.java
        (getAccessibleName): Call super.

Regards,

Dave
Index: java/awt/Component.java
===================================================================
RCS file: /sources/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.108
diff -u -r1.108 Component.java
--- java/awt/Component.java     23 Mar 2006 21:17:22 -0000      1.108
+++ java/awt/Component.java     23 Mar 2006 23:00:48 -0000
@@ -5292,7 +5292,7 @@
      */
     public String getAccessibleName()
     {
-      return accessibleName == null ? getName() : accessibleName;
+      return accessibleName;
     }
 
     /**
Index: javax/swing/AbstractButton.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.51
diff -u -r1.51 AbstractButton.java
--- javax/swing/AbstractButton.java     13 Mar 2006 15:22:27 -0000      1.51
+++ javax/swing/AbstractButton.java     23 Mar 2006 23:00:56 -0000
@@ -37,6 +37,8 @@
 
 package javax.swing;
 
+import gnu.classpath.NotImplementedException;
+
 import java.awt.Graphics;
 import java.awt.Image;
 import java.awt.Insets;
@@ -389,132 +391,163 @@
     }
 
     public AccessibleStateSet getAccessibleStateSet()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
+    /**
+     * Returns the accessible name for the button.
+     */
     public String getAccessibleName()
     {
-      return null; // TODO
+      String result = super.getAccessibleName();
+      if (result == null)
+        result = text;
+      return result;
     }
 
     public AccessibleIcon[] getAccessibleIcon()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public AccessibleRelationSet getAccessibleRelationSet()
+      throws NotImplementedException
     {
       // TODO: What should be modified here?
       return super.getAccessibleRelationSet();
     }
 
     public AccessibleAction getAccessibleAction()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public AccessibleValue getAccessibleValue()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public int getAccessibleActionCount()
+      throws NotImplementedException
     {
       return 0; // TODO
     }
 
     public String getAccessibleActionDescription(int value0)
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public boolean doAccessibleAction(int value0)
+      throws NotImplementedException
     {
       return false; // TODO
     }
 
     public Number getCurrentAccessibleValue()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public boolean setCurrentAccessibleValue(Number value0)
+      throws NotImplementedException
     {
       return false; // TODO
     }
 
     public Number getMinimumAccessibleValue()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public Number getMaximumAccessibleValue()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public AccessibleText getAccessibleText()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public int getIndexAtPoint(Point value0)
+      throws NotImplementedException
     {
       return 0; // TODO
     }
 
     public Rectangle getCharacterBounds(int value0)
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public int getCharCount()
+      throws NotImplementedException
     {
       return 0; // TODO
     }
 
     public int getCaretPosition()
+      throws NotImplementedException
     {
       return 0; // TODO
     }
 
     public String getAtIndex(int value0, int value1)
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public String getAfterIndex(int value0, int value1)
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public String getBeforeIndex(int value0, int value1)
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public AttributeSet getCharacterAttribute(int value0)
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     public int getSelectionStart()
+      throws NotImplementedException
     {
       return 0; // TODO
     }
 
     public int getSelectionEnd()
+      throws NotImplementedException
     {
       return 0; // TODO
     }
 
     public String getSelectedText()
+      throws NotImplementedException
     {
       return null; // TODO
     }
 
     private Rectangle getTextRectangle()
+      throws NotImplementedException
     {
       return null; // TODO
     }
@@ -1283,6 +1316,8 @@
    * Set the value of the [EMAIL PROTECTED] #iconTextGap} property.
    * 
    * @param i The new value of the property
+   * 
+   * @since 1.4
    */
   public void setIconTextGap(int i)
   {
@@ -1291,7 +1326,7 @@
     
     int old = iconTextGap;
     iconTextGap = i;
-    fireStateChanged();
+    firePropertyChange("iconTextGap", new Integer(old), new Integer(i));
     revalidate();
     repaint();
   }
@@ -1300,6 +1335,8 @@
    * Get the value of the [EMAIL PROTECTED] #iconTextGap} property.
    *
    * @return The current value of the property
+   * 
+   * @since 1.4
    */
   public int getIconTextGap()
   {
@@ -1920,12 +1957,12 @@
     if (contentAreaFilled == b)
       return;
     
-    boolean old = contentAreaFilled;
-    contentAreaFilled = b;
-    firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b);
     // The JDK sets the opaque property to the value of the contentAreaFilled
     // property, so should we do.
     setOpaque(b);
+    boolean old = contentAreaFilled;
+    contentAreaFilled = b;
+    firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b);
    }
 
   /**
Index: javax/swing/JButton.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JButton.java,v
retrieving revision 1.23
diff -u -r1.23 JButton.java
--- javax/swing/JButton.java    19 Oct 2005 15:16:50 -0000      1.23
+++ javax/swing/JButton.java    23 Mar 2006 23:00:56 -0000
@@ -103,11 +103,6 @@
     setModel(new DefaultButtonModel());
   }
 
-  public Object[] getSelectedObjects()
-  {
-    return null;
-  }
-
   protected void configurePropertiesFromAction(Action a)
   {
     // Factory method which sets the AbstractButton's properties according to
Index: javax/swing/JComponent.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.108
diff -u -r1.108 JComponent.java
--- javax/swing/JComponent.java 23 Mar 2006 17:16:23 -0000      1.108
+++ javax/swing/JComponent.java 23 Mar 2006 23:01:00 -0000
@@ -252,9 +252,8 @@
      */
     public String getAccessibleName()
     {
-      // TODO: Figure out what exactly to return here. It's possible that this
-      // method simply should return null.
-      return null;
+      // TODO: Figure out what exactly to return here.
+      return super.getAccessibleName();
     }
 
     /**

Reply via email to