1 /*
   2  * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   4  */
   5 
   6 package com.sun.java.accessibility.util.java.awt;
   7 
   8 import java.lang.*;
   9 import java.util.*;
  10 import java.awt.*;
  11 import java.awt.image.*;
  12 import javax.accessibility.*;
  13 import com.sun.java.accessibility.util.*;
  14 
  15 /**
  16  * <p>The Translator class provides a translation to interface Accessible
  17  * for objects that do not implement interface Accessible.  Assistive
  18  * technologies can use the 'getAccessible' class method of Translator to
  19  * obtain an object that implements interface Accessible.  If the object
  20  * passed in already implements interface Accessible, getAccessible merely
  21  * returns the object.
  22  *
  23  * <p>An example of how an assistive technology might use the Translator
  24  * class is as follows:
  25  *
  26  * <PRE>
  27  *    Accessible accessible = Translator.getAccessible(someObj);
  28  *    // obtain information from the 'accessible' object.
  29  * </PRE>
  30  *
  31  * <P>This class extends the Translator class to provide specific support
  32  * for the Choice class.  Translator.getAccessible() will automatically
  33  * load this class when an assistive technology asks for an accessible
  34  * translator for Choice.
  35  *
  36  */
  37 public class ChoiceTranslator extends Translator {
  38 
  39     /**
  40      * Get the state of this object.
  41      * @return an instance of AccessibleState containing the current state of the object
  42      * @see AccessibleState
  43      */
  44     public AccessibleStateSet getAccessibleStateSet() {
  45         AccessibleStateSet states = super.getAccessibleStateSet();
  46         states.add(AccessibleState.SELECTED);
  47         return states;
  48     }
  49 
  50     public AccessibleRole getAccessibleRole() {
  51         return AccessibleRole.CHOICE;
  52     }
  53 }