[Patch][gui] java.awt.Scrollbar accessibility

Michael Koch konqueror@gmx.de
Thu Jan 20 17:06:00 GMT 2005


Hi list,


I merged the attached patch from GNU classpath.


Michael


Andrew's original comment was:

I'm committing the attached patch, which is similar to the one
recently added for java.awt.Checkbox.AccessibleAWTCheckbox.


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

	* java/awt/Checkbox.java:
	(AccessibleAWTCheckbox): Added class documentation
	* java/awt/Scrollbar.java:
	(AccessibleAWTScrollBar): typo corrected and docs added
	(AccessibleAWTScrollBar.getAccessibleRole()): documented
	(AccessibleAWTScrollBar.getAccessibleStateSet()): likewise
	(AccessibleAWTScrollBar.getAccessibleValue()): likewise
	(AccessibleAWTScrollBar.getCurrentAccessibleValue()): likewise
	(AccessibleAWTScrollBar.setCurrentAccessibleValue(int)): likewise
	(AccessibleAWTScrollBar.getMinimumAccessibleValue()): likewise
	(AccessibleAWTScrollBar.getMaximumAccessibleValue()): likewise
	(getAccessibleContext()): name of accessible class corrected

-------------- next part --------------
Index: java/awt/Checkbox.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Checkbox.java,v
retrieving revision 1.9.20.5
diff -u -r1.9.20.5 Checkbox.java
--- java/awt/Checkbox.java	20 Jan 2005 08:21:50 -0000	1.9.20.5
+++ java/awt/Checkbox.java	20 Jan 2005 17:01:06 -0000
@@ -95,6 +95,13 @@
 // The list of listeners for this object.
 private transient ItemListener item_listeners;
 
+/**
+ * This class provides accessibility support for the
+ * checkbox.
+ *
+ * @author Jerry Quinn  (jlquinn@optonline.net)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
 protected class AccessibleAWTCheckbox
   extends AccessibleAWTComponent
   implements ItemListener, AccessibleAction, AccessibleValue
Index: java/awt/Scrollbar.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Scrollbar.java,v
retrieving revision 1.17.2.6
diff -u -r1.17.2.6 Scrollbar.java
--- java/awt/Scrollbar.java	11 Jan 2005 09:51:56 -0000	1.17.2.6
+++ java/awt/Scrollbar.java	20 Jan 2005 17:01:06 -0000
@@ -55,7 +55,8 @@
   * This class implements a scrollbar widget.
   *
   * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Tom Tromey <tromey@cygnus.com>
+  * @author Tom Tromey (tromey@cygnus.com)
+  * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
   */
 public class Scrollbar extends Component implements Accessible,
                                                     Adjustable
@@ -775,14 +776,43 @@
     return next_scrollbar_number++;
   }
   
-  protected class AccessibleAWTScrollbar extends AccessibleAWTComponent
+  /**
+   * This class provides accessibility support for the
+   * scrollbar.
+   *
+   * @author Jerry Quinn (jlquinn@optonline.net)
+   * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+   */
+  protected class AccessibleAWTScrollBar extends AccessibleAWTComponent
   	implements AccessibleValue
   {
+
+    /**
+     * Serialization constant to match JDK 1.5
+     */
+    private static final long serialVersionUID = -344337268523697807L;
+
+    /**
+     * 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.SCROLL_BAR;
     }
     
+    /**
+     * Returns the state set of this accessible object.
+     *
+     * @return a set of <code>AccessibleState</code>s
+     *         which represent the current state of the
+     *         accessible object.
+     * @see javax.accessibility.AccessibleState
+     * @see javax.accessibility.AccessibleStateSet
+     */
     public AccessibleStateSet getAccessibleStateSet()
     {
       AccessibleStateSet states = super.getAccessibleStateSet();
@@ -795,12 +825,28 @@
       return states;
     }
     
+    /**
+     * Returns an implementation of the <code>AccessibleValue</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 value as well as
+     * the context.
+     *
+     * @return the accessible value associated with this context.
+     * @see javax.accessibility.AccessibleValue
+     */
     public AccessibleValue getAccessibleValue()
     {
       return this;
     }
 
-    /* (non-Javadoc)
+    /**
+     * Returns the current value of this accessible object.
+     * In this case, this is the same as the value for
+     * the scrollbar, wrapped in an <code>Integer</code>
+     * object.
+     *
+     * @return the numeric value of this scrollbar.
      * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
      */
     public Number getCurrentAccessibleValue()
@@ -808,7 +854,14 @@
       return new Integer(getValue());
     }
 
-    /* (non-Javadoc)
+    /**
+     * Sets the current value of this accessible object
+     * to that supplied.  In this case, the value of the
+     * scrollbar is set, and this method always returns
+     * true.
+     *
+     * @param number the new accessible value.
+     * @return true if the value was set.
      * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
      */
     public boolean setCurrentAccessibleValue(Number number)
@@ -817,7 +870,13 @@
       return true;
     }
 
-    /* (non-Javadoc)
+    /**
+     * Returns the minimum acceptable accessible value used
+     * by this object.  In this case, this is the same as
+     * the minimum value of the scrollbar, wrapped in an
+     * object.
+     *
+     * @return the minimum value of this scrollbar.
      * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
      */
     public Number getMinimumAccessibleValue()
@@ -825,7 +884,13 @@
       return new Integer(getMinimum());
     }
 
-    /* (non-Javadoc)
+    /**
+     * Returns the maximum acceptable accessible value used
+     * by this object.  In this case, this is the same as
+     * the maximum value of the scrollbar, wrapped in an
+     * object.
+     *
+     * @return the maximum value of this scrollbar.
      * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
      */
     public Number getMaximumAccessibleValue()
@@ -844,7 +909,7 @@
   {
     /* Create the context if this is the first request */
     if (accessibleContext == null)
-      accessibleContext = new AccessibleAWTScrollbar();
+      accessibleContext = new AccessibleAWTScrollBar();
     return accessibleContext;
   }
 


More information about the Java-patches mailing list