< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java

Print this page

        

*** 37,47 **** --- 37,50 ---- import javax.swing.event.ChangeListener; import static javax.accessibility.AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY; import static javax.accessibility.AccessibleContext.ACCESSIBLE_CARET_PROPERTY; import static javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY; + import static javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY; import static javax.accessibility.AccessibleContext.ACCESSIBLE_TEXT_PROPERTY; + import javax.accessibility.AccessibleRole; + import javax.accessibility.AccessibleState; import sun.awt.AWTAccessor; class CAccessible extends CFRetainedResource implements Accessible {
*** 61,70 **** --- 64,76 ---- private static native void unregisterFromCocoaAXSystem(long ptr); private static native void valueChanged(long ptr); private static native void selectedTextChanged(long ptr); private static native void selectionChanged(long ptr); + private static native void menuOpened(long ptr); + private static native void menuClosed(long ptr); + private static native void menuItemSelected(long ptr); private Accessible accessible; private AccessibleContext activeDescendant;
*** 109,128 **** @Override public void propertyChange(PropertyChangeEvent e) { String name = e.getPropertyName(); if ( ptr != 0 ) { if (name.compareTo(ACCESSIBLE_CARET_PROPERTY) == 0) { selectedTextChanged(ptr); } else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0 ) { valueChanged(ptr); } else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0 ) { selectionChanged(ptr); } else if (name.compareTo(ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY) == 0 ) { ! Object nv = e.getNewValue(); ! if (nv instanceof AccessibleContext) { ! activeDescendant = (AccessibleContext)nv; } } } } } --- 115,163 ---- @Override public void propertyChange(PropertyChangeEvent e) { String name = e.getPropertyName(); if ( ptr != 0 ) { + Object newValue = e.getNewValue(); + Object oldValue = e.getOldValue(); if (name.compareTo(ACCESSIBLE_CARET_PROPERTY) == 0) { selectedTextChanged(ptr); } else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0 ) { valueChanged(ptr); } else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0 ) { selectionChanged(ptr); } else if (name.compareTo(ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY) == 0 ) { ! if (newValue instanceof AccessibleContext) { ! activeDescendant = (AccessibleContext)newValue; ! } ! } else if (name.compareTo(ACCESSIBLE_STATE_PROPERTY) == 0) { ! AccessibleContext thisAC = accessible.getAccessibleContext(); ! AccessibleRole thisRole = thisAC.getAccessibleRole(); ! Accessible parentAccessible = thisAC.getAccessibleParent(); ! AccessibleRole parentRole = null; ! if (parentAccessible != null) { ! parentRole = parentAccessible.getAccessibleContext().getAccessibleRole(); ! } ! // At least for now don't handle combo box menu state changes. ! // This may change when later fixing issues which currently ! // exist for combo boxes, but for now the following is only ! // for JPopupMenus, not for combobox menus. ! if (parentRole != AccessibleRole.COMBO_BOX) { ! if (thisRole == AccessibleRole.POPUP_MENU) { ! if ( newValue != null && ! ((AccessibleState)newValue) == AccessibleState.VISIBLE ) { ! menuOpened(ptr); ! } else if ( oldValue != null && ! ((AccessibleState)oldValue) == AccessibleState.VISIBLE ) { ! menuClosed(ptr); ! } ! } else if (thisRole == AccessibleRole.MENU_ITEM) { ! if ( newValue != null && ! ((AccessibleState)newValue) == AccessibleState.FOCUSED ) { ! menuItemSelected(ptr); ! } ! } } } } } }
< prev index next >