src/macosx/classes/sun/lwawt/macosx/CAccessibility.java

Print this page




  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 sun.lwawt.macosx;
  27 
  28 import java.awt.*;
  29 import java.beans.*;
  30 import java.lang.reflect.Field;
  31 import java.lang.reflect.InvocationTargetException;
  32 import java.security.PrivilegedAction;
  33 import java.util.*;
  34 import java.util.concurrent.Callable;
  35 
  36 import javax.accessibility.*;
  37 import javax.swing.*;
  38 
  39 class CAccessibility implements PropertyChangeListener {
  40     private static Set<String> ignoredRoles;
  41 
  42     static {
  43         // Need to load the native library for this code.
  44         java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("awt"));




  45     }


  46 
  47     static CAccessibility sAccessibility;
  48     static synchronized CAccessibility getAccessibility(final String[] roles) {
  49         if (sAccessibility != null) return sAccessibility;
  50         sAccessibility = new CAccessibility();
  51 
  52         if (roles != null) {
  53             ignoredRoles = new HashSet<String>(roles.length);
  54             for (final String role : roles) ignoredRoles.add(role);
  55         } else {
  56             ignoredRoles = new HashSet<String>();
  57         }
  58 
  59         return sAccessibility;
  60     }
  61 
  62     private CAccessibility() {
  63         KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener("focusOwner", this);
  64     }
  65 




  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 sun.lwawt.macosx;
  27 
  28 import java.awt.*;
  29 import java.beans.*;
  30 import java.lang.reflect.Field;
  31 import java.lang.reflect.InvocationTargetException;

  32 import java.util.*;
  33 import java.util.concurrent.Callable;
  34 
  35 import javax.accessibility.*;
  36 import javax.swing.*;
  37 
  38 class CAccessibility implements PropertyChangeListener {
  39     private static Set<String> ignoredRoles;
  40 
  41     static {
  42         // Need to load the native library for this code.
  43         java.security.AccessController.doPrivileged(
  44             new java.security.PrivilegedAction<Void>() {
  45                 public Void run() {
  46                     System.loadLibrary("awt");
  47                     return null;
  48                 }
  49             });
  50     }
  51 
  52     static CAccessibility sAccessibility;
  53     static synchronized CAccessibility getAccessibility(final String[] roles) {
  54         if (sAccessibility != null) return sAccessibility;
  55         sAccessibility = new CAccessibility();
  56 
  57         if (roles != null) {
  58             ignoredRoles = new HashSet<String>(roles.length);
  59             for (final String role : roles) ignoredRoles.add(role);
  60         } else {
  61             ignoredRoles = new HashSet<String>();
  62         }
  63 
  64         return sAccessibility;
  65     }
  66 
  67     private CAccessibility() {
  68         KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener("focusOwner", this);
  69     }
  70