[Patch][gui] Choice accessibility fix/documentation

Michael Koch konqueror@gmx.de
Mon Jan 24 11:23:00 GMT 2005


Hi list,


I commited the attached patch to merge it from GNU classpath to
java-gui-branch. It fixes some issues in our AWT accessibility code.


Michael


2005-01-24  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* java/awt/Checkbox.java:
	(AccessibleAWTCheckbox()): Added public constructor
	to call superclass.
	* java/awt/Choice.java:
	(AccessibleAWTChoice): Added class documentation.
	(AccessibleAWTChoice()): Added public constructor
	to call superclass.
	(AccessibleAWTChoice.getAccessibleAction()): Documented.
	(AccessibleAWTChoice.getAccessibleRole()): Documented,
	and changed role to COMBO_BOX.
	(AccessibleAWTChoice.getAccessibleActionCount()): Documented.
	(AccessibleAWTChoice.getAccessibleActionDescription(int)): Documented.
	(AccessibleAWTChoice.doAccessibleAction(int)): Documented.

-------------- next part --------------
Index: java/awt/Checkbox.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Checkbox.java,v
retrieving revision 1.9.20.6
diff -u -r1.9.20.6 Checkbox.java
--- java/awt/Checkbox.java	20 Jan 2005 17:01:25 -0000	1.9.20.6
+++ java/awt/Checkbox.java	24 Jan 2005 11:21:32 -0000
@@ -113,6 +113,16 @@
   private static final long serialVersionUID = 7881579233144754107L;
 
   /**
+   * Default constructor which simply calls the
+   * super class for generic component accessibility
+   * handling.
+   */
+  public AccessibleAWTCheckbox()
+  {
+    super();
+  }
+
+  /**
    * Captures changes to the state of the checkbox and
    * fires appropriate accessible property change events.
    *
Index: java/awt/Choice.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Choice.java,v
retrieving revision 1.14.2.4
diff -u -r1.14.2.4 Choice.java
--- java/awt/Choice.java	29 Dec 2004 17:22:53 -0000	1.14.2.4
+++ java/awt/Choice.java	24 Jan 2005 11:21:32 -0000
@@ -85,23 +85,65 @@
 // Listener chain
 private ItemListener item_listeners;
 
+/**
+ * This class provides accessibility support for the
+ * combo box.
+ *
+ * @author Jerry Quinn  (jlquinn@optonline.net)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
   protected class AccessibleAWTChoice
-    extends Component.AccessibleAWTComponent
-    implements AccessibleAction
+  extends AccessibleAWTComponent
+  implements AccessibleAction
   {
+
+    /**
+     * Serialization constant to match JDK 1.5
+     */
+    private static final long serialVersionUID = 7175603582428509322L;
+
+    /**
+     * Default constructor which simply calls the
+     * super class for generic component accessibility
+     * handling.
+     */
+    public AccessibleAWTChoice()
+    {
+      super();
+    }
+
+    /**
+     * Returns an implementation of the <code>AccessibleAction</code>
+     * interface for this accessible object.  In this case, the
+     * current instance is simply returned (with a more appropriate
+     * type), as it also implements the accessible action as well as
+     * the context.
+     *
+     * @return the accessible action associated with this context.
+     * @see javax.accessibility.AccessibleAction
+     */
     public AccessibleAction getAccessibleAction()
     {
       return this;
     }
 
-    // FIXME: I think this is right, but should be checked by someone who
-    // knows better.
+    /**
+     * Returns the role of this accessible object.
+     *
+     * @return the instance of <code>AccessibleRole</code>,
+     *         which describes this object.
+     * @see javax.accessibility.AccessibleRole
+     */
     public AccessibleRole getAccessibleRole()
     {
-      return AccessibleRole.POPUP_MENU;
+      return AccessibleRole.COMBO_BOX;
     }
 	  
-    /* (non-Javadoc)
+    /**
+     * Returns the number of actions associated with this accessible
+     * object.  In this case, it is the number of choices available.
+     *
+     * @return the number of choices available.
      * @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
      */
     public int getAccessibleActionCount()
@@ -109,7 +151,14 @@
       return pItems.size();
     }
 
-    /* (non-Javadoc)
+    /**
+     * Returns a description of the action with the supplied id.
+     * In this case, it is the text used in displaying the particular
+     * choice on-screen.
+     *
+     * @param i the id of the choice whose description should be
+     *          retrieved.
+     * @return the <code>String</code> used to describe the choice.
      * @see javax.accessibility.AccessibleAction#getAccessibleActionDescription(int)
      */
     public String getAccessibleActionDescription(int i)
@@ -117,7 +166,13 @@
       return (String) pItems.get(i);
     }
 	  
-    /* (non-Javadoc)
+    /**
+     * Executes the action with the specified id.  In this case,
+     * calling this method provides the same behaviour as would
+     * choosing a choice from the list in a visual manner.
+     *
+     * @param i the id of the choice to select.
+     * @return true if a valid choice was specified.
      * @see javax.accessibility.AccessibleAction#doAccessibleAction(int)
      */
     public boolean doAccessibleAction(int i)


More information about the Java-patches mailing list