< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m

Print this page




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  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 // External Java Accessibility links:
  27 //
  28 // <http://java.sun.com/j2se/1.4.2/docs/guide/access/index.html>
  29 // <http://www-106.ibm.com/developerworks/library/j-access/?n-j-10172>
  30 // <http://archives.java.sun.com/archives/java-access.html> (Sun's mailing list for Java accessibility)
  31 
  32 #import "JavaComponentAccessibility.h"
  33 
  34 #import "sun_lwawt_macosx_CAccessibility.h"
  35 
  36 #import <AppKit/AppKit.h>
  37 
  38 #import <JavaNativeFoundation/JavaNativeFoundation.h>
  39 #import <JavaRuntimeSupport/JavaRuntimeSupport.h>
  40 
  41 #import <dlfcn.h>
  42 
  43 #import "JavaAccessibilityAction.h"
  44 #import "JavaAccessibilityUtilities.h"
  45 #import "JavaTextAccessibility.h"
  46 #import "ThreadUtilities.h"
  47 #import "AWTView.h"
  48 


 956 }
 957 
 958 - (BOOL)accessibilityIsTitleAttributeSettable
 959 {
 960     return NO;
 961 }
 962 
 963 - (NSWindow *)accessibilityTopLevelUIElementAttribute
 964 {
 965     return [self window];
 966 }
 967 
 968 - (BOOL)accessibilityIsTopLevelUIElementAttributeSettable
 969 {
 970     return NO;
 971 }
 972 
 973 // Element's value (id)
 974 // note that the appKit meaning of "accessibilityValue" is different from the java
 975 // meaning of "accessibleValue", which is specific to numerical values
 976 // (http://java.sun.com/j2se/1.3/docs/api/javax/accessibility/AccessibleValue.html#setCurrentAccessibleValue(java.lang.Number))
 977 - (id)accessibilityValueAttribute
 978 {
 979     static JNF_STATIC_MEMBER_CACHE(jm_getCurrentAccessibleValue, sjc_CAccessibility, "getCurrentAccessibleValue", "(Ljavax/accessibility/AccessibleValue;Ljava/awt/Component;)Ljava/lang/Number;");
 980 
 981     JNIEnv* env = [ThreadUtilities getJNIEnv];
 982 
 983     // ask Java for the component's accessibleValue. In java, the "accessibleValue" just means a numerical value
 984     // a text value is taken care of in JavaTextAccessibility
 985 
 986     // cmcnote should coalesce these calls into one java call
 987     jobject axValue = JNFCallStaticObjectMethod(env, sjm_getAccessibleValue, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
 988     return JNFJavaToNSNumber(env, JNFCallStaticObjectMethod(env, jm_getCurrentAccessibleValue, axValue, fComponent)); // AWT_THREADING Safe (AWTRunLoop)
 989 }
 990 
 991 - (BOOL)accessibilityIsValueAttributeSettable
 992 {
 993     // according ot AppKit sources, in general the value attribute is not settable, except in the cases
 994     // of an NSScroller, an NSSplitView, and text that's both enabled & editable
 995     BOOL isSettable = NO;
 996     NSString *role = [self accessibilityRoleAttribute];




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  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 // External Java Accessibility links:
  27 //
  28 // <https://docs.oracle.com/javase/8/docs/technotes/guides/access/index.html>
  29 // <http://www-106.ibm.com/developerworks/library/j-access/?n-j-10172>
  30 // <http://archives.java.sun.com/archives/java-access.html> (Sun's mailing list for Java accessibility)
  31 
  32 #import "JavaComponentAccessibility.h"
  33 
  34 #import "sun_lwawt_macosx_CAccessibility.h"
  35 
  36 #import <AppKit/AppKit.h>
  37 
  38 #import <JavaNativeFoundation/JavaNativeFoundation.h>
  39 #import <JavaRuntimeSupport/JavaRuntimeSupport.h>
  40 
  41 #import <dlfcn.h>
  42 
  43 #import "JavaAccessibilityAction.h"
  44 #import "JavaAccessibilityUtilities.h"
  45 #import "JavaTextAccessibility.h"
  46 #import "ThreadUtilities.h"
  47 #import "AWTView.h"
  48 


 956 }
 957 
 958 - (BOOL)accessibilityIsTitleAttributeSettable
 959 {
 960     return NO;
 961 }
 962 
 963 - (NSWindow *)accessibilityTopLevelUIElementAttribute
 964 {
 965     return [self window];
 966 }
 967 
 968 - (BOOL)accessibilityIsTopLevelUIElementAttributeSettable
 969 {
 970     return NO;
 971 }
 972 
 973 // Element's value (id)
 974 // note that the appKit meaning of "accessibilityValue" is different from the java
 975 // meaning of "accessibleValue", which is specific to numerical values
 976 // (https://docs.oracle.com/javase/8/docs/api/javax/accessibility/AccessibleValue.html#setCurrentAccessibleValue-java.lang.Number-)
 977 - (id)accessibilityValueAttribute
 978 {
 979     static JNF_STATIC_MEMBER_CACHE(jm_getCurrentAccessibleValue, sjc_CAccessibility, "getCurrentAccessibleValue", "(Ljavax/accessibility/AccessibleValue;Ljava/awt/Component;)Ljava/lang/Number;");
 980 
 981     JNIEnv* env = [ThreadUtilities getJNIEnv];
 982 
 983     // ask Java for the component's accessibleValue. In java, the "accessibleValue" just means a numerical value
 984     // a text value is taken care of in JavaTextAccessibility
 985 
 986     // cmcnote should coalesce these calls into one java call
 987     jobject axValue = JNFCallStaticObjectMethod(env, sjm_getAccessibleValue, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
 988     return JNFJavaToNSNumber(env, JNFCallStaticObjectMethod(env, jm_getCurrentAccessibleValue, axValue, fComponent)); // AWT_THREADING Safe (AWTRunLoop)
 989 }
 990 
 991 - (BOOL)accessibilityIsValueAttributeSettable
 992 {
 993     // according ot AppKit sources, in general the value attribute is not settable, except in the cases
 994     // of an NSScroller, an NSSplitView, and text that's both enabled & editable
 995     BOOL isSettable = NO;
 996     NSString *role = [self accessibilityRoleAttribute];


< prev index next >