< prev index next >
src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 23,43 ****
* questions.
*/
package sun.lwawt.macosx;
! import sun.lwawt.LWWindowPeer;
!
! import java.awt.*;
! import java.beans.*;
import java.lang.reflect.InvocationTargetException;
! import java.util.*;
import java.util.concurrent.Callable;
! import javax.accessibility.*;
! import javax.swing.*;
import sun.awt.AWTAccessor;
class CAccessibility implements PropertyChangeListener {
private static Set<String> ignoredRoles;
static {
--- 23,65 ----
* questions.
*/
package sun.lwawt.macosx;
! import java.awt.Component;
! import java.awt.Container;
! import java.awt.Dimension;
! import java.awt.KeyboardFocusManager;
! import java.awt.Point;
! import java.awt.Window;
! import java.beans.PropertyChangeEvent;
! import java.beans.PropertyChangeListener;
import java.lang.reflect.InvocationTargetException;
! import java.util.ArrayList;
! import java.util.HashSet;
! import java.util.Set;
import java.util.concurrent.Callable;
! import javax.accessibility.Accessible;
! import javax.accessibility.AccessibleAction;
! import javax.accessibility.AccessibleComponent;
! import javax.accessibility.AccessibleContext;
! import javax.accessibility.AccessibleRole;
! import javax.accessibility.AccessibleSelection;
! import javax.accessibility.AccessibleState;
! import javax.accessibility.AccessibleStateSet;
! import javax.accessibility.AccessibleTable;
! import javax.accessibility.AccessibleText;
! import javax.accessibility.AccessibleValue;
! import javax.swing.Icon;
! import javax.swing.JComponent;
! import javax.swing.JEditorPane;
! import javax.swing.JLabel;
! import javax.swing.JTextArea;
!
import sun.awt.AWTAccessor;
+ import sun.lwawt.LWWindowPeer;
class CAccessibility implements PropertyChangeListener {
private static Set<String> ignoredRoles;
static {
*** 624,634 ****
// Is this the active descendant?
currentAccessible = (Accessible)childrenAndRoles.get(i);
currentAC = currentAccessible.getAccessibleContext();
currentName = currentAC.getAccessibleName();
currentRole = (AccessibleRole)childrenAndRoles.get(i+1);
! if ( currentName.equals(activeDescendantName) &&
currentRole.equals(activeDescendantRole) ) {
newArray.add(0, currentAccessible);
newArray.add(1, currentRole);
} else {
newArray.add(currentAccessible);
--- 646,656 ----
// Is this the active descendant?
currentAccessible = (Accessible)childrenAndRoles.get(i);
currentAC = currentAccessible.getAccessibleContext();
currentName = currentAC.getAccessibleName();
currentRole = (AccessibleRole)childrenAndRoles.get(i+1);
! if (currentName != null && currentName.equals(activeDescendantName) &&
currentRole.equals(activeDescendantRole) ) {
newArray.add(0, currentAccessible);
newArray.add(1, currentRole);
} else {
newArray.add(currentAccessible);
*** 647,656 ****
--- 669,696 ----
return new Object[] { childrenAndRoles.get(whichChildren * 2), childrenAndRoles.get((whichChildren * 2) + 1) };
}
}, c);
}
+ private static final int JAVA_AX_ROWS = 1;
+ private static final int JAVA_AX_COLS = 2;
+
+ public static int getTableInfo(final Accessible a, final Component c,
+ final int info) {
+ if (a == null) return 0;
+ return invokeAndWait(() -> {
+ AccessibleContext ac = a.getAccessibleContext();
+ AccessibleTable table = ac.getAccessibleTable();
+ if (info == JAVA_AX_COLS) {
+ return table.getAccessibleColumnCount();
+ } else if (info == JAVA_AX_ROWS) {
+ return table.getAccessibleRowCount();
+ } else
+ return 0;
+ }, c);
+ }
+
private static AccessibleRole getAccessibleRoleForLabel(JLabel l, AccessibleRole fallback) {
String text = l.getText();
if (text != null && text.length() > 0) {
return fallback;
}
< prev index next >