< prev index next >

src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java

Print this page




  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.accessibility;
  27 
  28 import sun.awt.AWTAccessor;
  29 import sun.awt.AppContext;

  30 
  31 import java.util.Locale;
  32 import java.beans.JavaBean;
  33 import java.beans.BeanProperty;
  34 import java.beans.PropertyChangeListener;
  35 import java.beans.PropertyChangeSupport;
  36 import java.beans.PropertyChangeEvent;
  37 import java.awt.IllegalComponentStateException;
  38 
  39 import javax.swing.SwingContainer;
  40 
  41 /**
  42  * AccessibleContext represents the minimum information all accessible objects
  43  * return.  This information includes the accessible name, description, role,
  44  * and state of the object, as well as information about its parent and
  45  * children.  AccessibleContext also contains methods for
  46  * obtaining more specific accessibility information about a component.
  47  * If the component supports them, these methods will return an object that
  48  * implements one or more of the following interfaces:
  49  * <ul>


  82 @SwingContainer(false)
  83 public abstract class AccessibleContext {
  84 
  85     /**
  86      * The AppContext that should be used to dispatch events for this
  87      * AccessibleContext
  88      */
  89     private volatile AppContext targetAppContext;
  90 
  91     static {
  92         AWTAccessor.setAccessibleContextAccessor(new AWTAccessor.AccessibleContextAccessor() {
  93             @Override
  94             public void setAppContext(AccessibleContext accessibleContext, AppContext appContext) {
  95                 accessibleContext.targetAppContext = appContext;
  96             }
  97 
  98             @Override
  99             public AppContext getAppContext(AccessibleContext accessibleContext) {
 100                 return accessibleContext.targetAppContext;
 101             }





 102         });
 103     }
 104 
 105    /**
 106     * Constant used to determine when the accessibleName property has
 107     * changed.  The old value in the PropertyChangeEvent will be the old
 108     * accessibleName and the new value will be the new accessibleName.
 109     *
 110     * @see #getAccessibleName
 111     * @see #addPropertyChangeListener
 112     */
 113    public static final String ACCESSIBLE_NAME_PROPERTY = "AccessibleName";
 114 
 115    /**
 116     * Constant used to determine when the accessibleDescription property has
 117     * changed.  The old value in the PropertyChangeEvent will be the
 118     * old accessibleDescription and the new value will be the new
 119     * accessibleDescription.
 120     *
 121     * @see #getAccessibleDescription


 400      * @see #setAccessibleDescription
 401      */
 402     protected String accessibleDescription = null;
 403 
 404     /**
 405      * Used to handle the listener list for property change events.
 406      *
 407      * @see #addPropertyChangeListener
 408      * @see #removePropertyChangeListener
 409      * @see #firePropertyChangeListener
 410      */
 411     private PropertyChangeSupport accessibleChangeSupport = null;
 412 
 413     /**
 414      * Used to represent the context's relation set
 415      * @see #getAccessibleRelationSet
 416      */
 417     private AccessibleRelationSet relationSet
 418         = new AccessibleRelationSet();
 419 
 420     private Object nativeAXResource;






 421 
 422     /**
 423      * Gets the accessibleName property of this object.  The accessibleName
 424      * property of an object is a localized String that designates the purpose
 425      * of the object.  For example, the accessibleName property of a label
 426      * or button might be the text of the label or button itself.  In the
 427      * case of an object that doesn't display its name, the accessibleName
 428      * should still be set.  For example, in the case of a text field used
 429      * to enter the name of a city, the accessibleName for the en_US locale
 430      * could be 'city.'
 431      *
 432      * @return the localized name of the object; null if this
 433      * object does not have a name
 434      *
 435      * @see #setAccessibleName
 436      */
 437     public String getAccessibleName() {
 438         return accessibleName;
 439     }
 440 




  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.accessibility;
  27 
  28 import sun.awt.AWTAccessor;
  29 import sun.awt.AppContext;
  30 import sun.awt.Disposable;
  31 
  32 import java.util.Locale;
  33 import java.beans.JavaBean;
  34 import java.beans.BeanProperty;
  35 import java.beans.PropertyChangeListener;
  36 import java.beans.PropertyChangeSupport;
  37 import java.beans.PropertyChangeEvent;
  38 import java.awt.IllegalComponentStateException;
  39 
  40 import javax.swing.SwingContainer;
  41 
  42 /**
  43  * AccessibleContext represents the minimum information all accessible objects
  44  * return.  This information includes the accessible name, description, role,
  45  * and state of the object, as well as information about its parent and
  46  * children.  AccessibleContext also contains methods for
  47  * obtaining more specific accessibility information about a component.
  48  * If the component supports them, these methods will return an object that
  49  * implements one or more of the following interfaces:
  50  * <ul>


  83 @SwingContainer(false)
  84 public abstract class AccessibleContext {
  85 
  86     /**
  87      * The AppContext that should be used to dispatch events for this
  88      * AccessibleContext
  89      */
  90     private volatile AppContext targetAppContext;
  91 
  92     static {
  93         AWTAccessor.setAccessibleContextAccessor(new AWTAccessor.AccessibleContextAccessor() {
  94             @Override
  95             public void setAppContext(AccessibleContext accessibleContext, AppContext appContext) {
  96                 accessibleContext.targetAppContext = appContext;
  97             }
  98 
  99             @Override
 100             public AppContext getAppContext(AccessibleContext accessibleContext) {
 101                 return accessibleContext.targetAppContext;
 102             }
 103 
 104             @Override
 105             public void dispose(AccessibleContext accessibleContext) {
 106                 accessibleContext.dispose();
 107             }
 108         });
 109     }
 110 
 111    /**
 112     * Constant used to determine when the accessibleName property has
 113     * changed.  The old value in the PropertyChangeEvent will be the old
 114     * accessibleName and the new value will be the new accessibleName.
 115     *
 116     * @see #getAccessibleName
 117     * @see #addPropertyChangeListener
 118     */
 119    public static final String ACCESSIBLE_NAME_PROPERTY = "AccessibleName";
 120 
 121    /**
 122     * Constant used to determine when the accessibleDescription property has
 123     * changed.  The old value in the PropertyChangeEvent will be the
 124     * old accessibleDescription and the new value will be the new
 125     * accessibleDescription.
 126     *
 127     * @see #getAccessibleDescription


 406      * @see #setAccessibleDescription
 407      */
 408     protected String accessibleDescription = null;
 409 
 410     /**
 411      * Used to handle the listener list for property change events.
 412      *
 413      * @see #addPropertyChangeListener
 414      * @see #removePropertyChangeListener
 415      * @see #firePropertyChangeListener
 416      */
 417     private PropertyChangeSupport accessibleChangeSupport = null;
 418 
 419     /**
 420      * Used to represent the context's relation set
 421      * @see #getAccessibleRelationSet
 422      */
 423     private AccessibleRelationSet relationSet
 424         = new AccessibleRelationSet();
 425 
 426     private Disposable nativeAXResource;
 427 
 428     void dispose() {
 429         if (nativeAXResource != null) {
 430             nativeAXResource.dispose();
 431         }
 432     }
 433 
 434     /**
 435      * Gets the accessibleName property of this object.  The accessibleName
 436      * property of an object is a localized String that designates the purpose
 437      * of the object.  For example, the accessibleName property of a label
 438      * or button might be the text of the label or button itself.  In the
 439      * case of an object that doesn't display its name, the accessibleName
 440      * should still be set.  For example, in the case of a text field used
 441      * to enter the name of a city, the accessibleName for the en_US locale
 442      * could be 'city.'
 443      *
 444      * @return the localized name of the object; null if this
 445      * object does not have a name
 446      *
 447      * @see #setAccessibleName
 448      */
 449     public String getAccessibleName() {
 450         return accessibleName;
 451     }
 452 


< prev index next >