Java Java TM Access Bridge
for the Microsoft Windows Operating System

 

Version 2.0.1


API Specification
Contents

API Files

The Java Access Bridge API can be found in three files: AccessBridgeCalls.h , AccessBridgePackages.h , and AccessBridgeCallbacks.h . These files correspond to the Java Access Bridge API calls, the API data structures, and the API callbacks, respectively.

API Calls

The Java Access Bridge API calls are contained in AccessBridgeCalls.h and to use them, you must also compile the file AccessBridgeCalls.c , which is the glue to the API, loads WindowsAccessBridge.dll, and otherwise makes everything work.

Initialization/Shutdown Functions


BOOL  
         initializeAccessBridge();


BOOL  
         shutdownAccessBridge();


      

These two functions start things up, and shut them down (as the names would lead you to believe). You cannot use any other part of the Java Access Bridge API until you've called initializeAccessBridge. Similarly, it is important to call shutdownAccessBridge when finished (before your application exits), so that proper memory cleanup can occur. Note however, calling shutdownAccessBridge is not a substitute for releasing any data structures being maintained on your behalf in the JavaVM; you must call ReleaseJavaObject (see below) to do that.

Gateway Functions


BOOL  
         IsJavaWindow(HWND window);


BOOL  
         GetAccessibleContextFromHWND(HWND target, long *vmID, AccessibleContext *ac);


      

The IsJavaWindow() function checks to see if the given window implements the Java Accessibility API. The GetAccessibleContextFromHWND() function gets the AccessibleContext and vmID for the given window. Other Access Bridge functions require the AccessibleContext and vmID.

Event-Handling Functions


void  
         SetFocusGained(AccessBridge_FocusGainedFP fp);


void  
         SetFocusLost(AccessBridge_FocusLostFP fp);


...


      

These all take a function pointer to the function which will handle the event type.  When you no longer are interested in receiving those types of events, call the function again, passing in NULL.  Prototypes for the function pointers you need pass into these functions can be found in the file AccessBridgeCallbacks.h and are described below in API callbacks.

General Functions


void  
         ReleaseJavaObject(long vmID, Java_Object object);


BOOL  
         GetVersionInfo(long vmID, AccessBridgeVersionInfo *info);


      

The Java Access Bridge automatically maintains a reference to all Java objects in the Virtual Machine, so they are not garbage collected. To prevent memory leaks, you must call ReleaseJavaObject on all Java objects returned to you by the Java Access Bridge once you are finished with them. See JavaFerret.c for an illustration of how to do this. In order to determine the functionality available, you can get version information from the GetVersionInfo call. Note that in order to determine the version of the Java virtual machine you need to pass in a valid vmID; otherwise all that is returned in the version of the WindowsAccessBridge.DLL file to which your application is connected.

Accessible Context Functions


BOOL  
         GetAccessibleContextAt(long vmID, AccessibleContext acParent,


                               jint x, jint y, AccessibleContext *ac)


BOOL  
         GetAccessibleContextWithFocus(HWND window, long *vmID,


                                     AccessibleContext *ac);





BOOL  
         GetAccessibleContextInfo(long vmID,


                                AccessibleContext ac,


                                AccessibleContextInfo *info);





AccessibleContext  
         GetAccessibleChildFromContext(long vmID,


                                                    AccessibleContext ac,


                                                   jint index);


AccessibleContext  
         GetAccessibleParentFromContext(long vmID,


                                                    AccessibleContext ac);


      

These functions provide the core of the Java Accessibility API that is exposed by the Java Access Bridge.  The first two allow you to obtain an AccessibleContext object - which is basically a magic cookie (really a Java Object reference) to the Accessible object in question, and a Java VM cookie. These two cookies are how you will reference objects through the Java Access Bridge.  The rest of the Java Access Bridge API requires that you pass in these two parameters.

The next function returns detailed information about the AccessibleContext object belonging to the JavaVM passed in. In order to improve performance, the various distinct methods in the Java Accessibility API are collected together into a few routines in the Java Access Bridge API, and returned in structs. These structs are defined in the file AccessBridgePackages.h and are described below in API callbacks.

The last two functions in this section allow you to walk the GUI component heirarchy, retrieving the n th child, or the parent, of a particular GUI object.

Accessible Text Functions


BOOL  
         GetAccessibleTextInfo(long vmID, AccessibleText at,


                             AccessibleTextInfo *textInfo,


                             jint x, jint y);


BOOL  
         GetAccessibleTextItems(long vmID, AccessibleText at,


                              AccessibleTextItemsInfo *textItems,


                              jint index);


BOOL  
         GetAccessibleTextSelectionInfo(long vmID, AccessibleText at,


                        AccessibleTextSelectionInfo *textSelection);


char *
         GetAccessibleTextAttributes(long vmID, AccessibleText at,


                                    jint index,


                                    AccessibleTextAttributesInfo *attributes);


BOOL  
         GetAccessibleTextRect(long vmID, AccessibleText at,


                             AccessibleTextRectInfo *rectInfo,


                             jint index);


BOOL  
         GetAccessibleTextRange(long vmID, AccessibleText at,


                              jint start, jint end,


                              wchar_t *text, short len);


BOOL  
         GetAccessibleTextLineBounds(long vmID, AccessibleText at,


                                   jint index, jint *startIndex,


                                   jint *endIndex);


      

These functions get AccessibleText information provided by the Java Accessibility API, broken down into seven chunks for efficiency. An AccessibleContext has AccessibleText information contained within it if the flag accessibleText in the AccessibleContextInfo data structure is set to TRUE. The structs used in these functions are defined in the file AccessBridgePackages.h and are described below in API callbacks.

Accessible Value Functions


BOOL  
         GetCurrentAccessibleValueFromContext(long vmID, AccessibleValue av,


                                             wchar_t *value, short len);


BOOL  
         GetMaximumAccessibleValueFromContext(long vmID, AccessibleValue av,


                                             wchar_ *value, short len);


BOOL  
         GetMinimumAccessibleValueFromContext(long vmID, AccessibleValue av,


                                             wchar_ *value, short len);


      

These functions get AccessibleValue information provided by the Java Accessibility API.  An AccessibleContext has AccessibleValue information contained within it if the flag accessibleValue in the AccessibleContextInfo data structure is set to TRUE. The values returned are strings ( char *value) because there is no way to tell in advance if the value is an integer, a floating point value, or some other object which subclasses the Java language constructe java.lang.Number.

Accessible Selection Functions


void  
         AddAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);


void  
         ClearAccessibleSelectionFromContext(long vmID, AccessibleSelection as);


jobject  
         GetAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);


int  
         GetAccessibleSelectionCountFromContext(long vmID, AccessibleSelection as);


BOOL  
         IsAccessibleChildSelectedFromContext(long vmID, AccessibleSelection as, int i);


void  
         RemoveAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);


void  
         SelectAllAccessibleSelectionFromContext(long vmID, AccessibleSelection as);


      

These functions get and manipulate AccessibleSelection information provided by the Java Accessibility API. An AccessibleContext has AccessibleSelection information contained within it if the flag accessibleSelection in the AccessibleContextInfo data structure is set to TRUE. The AccessibleSelection support is the first place where the user-interface can be manipulated - vs. simply being queried - through adding and removing items from a selection. Some of the functions use an index that is in 'child' coordinates, while other use 'selection' coordinates. For example, adding to and removing from a selection is done passing child indicies (e.g. add the 4th child to the selection). On the other hand, enumerating the selected children is done in 'selection' coordinates (e.g. get the AccessibleContext of the first thing selected).

API Data Structures

The Java Access Bridge API data structures are contained in AccessBridgePackages.h . There are data structures in this file that you do not need (and can ignore) - they are used as part of the inter-process communication mechanism of the two Java Access Bridge DLLs. The data structures of importance are defined below:


#define MAX_STRING_SIZE     1024


#define SHORT_STRING_SIZE    256








struct  
         AccessBridgeVersionInfo {


 wchar_t VMversion[SHORT_STRING_SIZE];                // version of the Java VM


 wchar_t bridgeJavaClassVersion[SHORT_STRING_SIZE];   // version of the AccessBridge.class


 wchar_t bridgeJavaDLLVersion[SHORT_STRING_SIZE];     // version of JavaAccessBridge.dll


 wchar_t bridgeWinDLLVersion[SHORT_STRING_SIZE];      // version of WindowsAccessBridge.dll


};





struct  
         AccessibleContextInfo {


 wchar_ name[MAX_STRING_SIZE];        // the AccessibleName of the object


 wchar_ description[MAX_STRING_SIZE]; // the AccessibleDescription of the object





 wchar_ role[SHORT_STRING_SIZE];     // localized AccesibleRole string


 wchar_ states[SHORT_STRING_SIZE];   // localized AccesibleStateSet string


                                      // (comma separated)





 jint indexInParent        // index of object in parent


 jint childrenCount        // # of children, if any





 jint x;          // screen coords in pixels


 jint y;          // "


 jint width;      // pixel width of object


 jint height;     // pixel height of object





 BOOL accessibleComponent;   // flags for various additional


 BOOL accessibleAction;      //  Java Accessibility interfaces


 BOOL accessibleSelection;   //  FALSE if this object doesn't


 BOOL accessibleText;        //  implement the additional interface


 BOOL accessibleValue;       //  in question


};





struct  
         AccessibleTextInfo {


 jint charCount;       // # of characters in this text object


 jint caretIndex;      // index of caret


 jint indexAtPoint;    // index at the passsed in point


};





struct  
         AccessibleTextItemsInfo {


 wchar_ letter;


 wchar_ word[SHORT_STRING_SIZE];


 wchar_ sentence[MAX_STRING_SIZE];


};





struct  
         AccessibleTextSelectionInfo {


 jint selectionStartIndex;


 jint selectionEndIndex;


 wchar_ selectedText[MAX_STRING_SIZE];


};





struct  
         AccessibleTextRectInfo {


 jint x;          // bounding rect of char at index


 jint y;          // "


 jint width;      // "


 jint height;     // "


};





struct  
         AccessibleTextAttributesInfo {


 BOOL bold;


 BOOL italic;


 BOOL underline;


 BOOL strikethrough;


 BOOL superscript;


 BOOL subscript;


 wchar_t backgroundColor[SHORT_STRING_SIZE];


 wchar_t foregroundColor[SHORT_STRING_SIZE];


 wchar_t fontFamily[SHORT_STRING_SIZE];


 jint fontSize;


 jint alignment;


 jint bidiLevel;


 jfloat firstLineIndent;


 jfloat leftIndent;


 jfloat rightIndent;


 jfloat lineSpacing;


 jfloat spaceAbove;


 jfloat spaceBelow;


 wchar_t fullAttributesString[MAX_STRING_SIZE];


};


      

API Callbacks

The Java Access Bridge API callbacks are contained in AccessBridgeCallbacks.h . Your event handling functions must match these prototypes. Note: all of the Java Access Bridge event handlers are defined and used in the JavaFerret example. You must call ReleaseJavaObject on every jobject returned via these event handlers once you are through with them, in order to prevent memory leaks in the Java VM.


typedef void (*
         AccessBridge_FocusGainedFP) (long vmID,


                                            jobject event,


                                            jobject source);


typedef void (*
         AccessBridge_FocusLostFP) (long vmID,


                                          jobject event,


                                          jobject source);


typedef void (*
         AccessBridge_CaretUpdateFP) (long vmID,


                                            jobject event,


                                            jobject source);


typedef void (*
         AccessBridge_MouseClickedFP) (long vmID,


                                             jobject event,


                                             jobject source);


typedef void (*
         AccessBridge_MouseEnteredFP) (long vmID,


                                             jobject event,


                                             jobject source);


typedef void (*
         AccessBridge_MouseExitedFP) (long vmID,


                                            jobject event,


                                            jobject source);


typedef void (*
         AccessBridge_MousePressedFP) (long vmID,


                                             jobject event,


                                             jobject source);


typedef void (*
         AccessBridge_MouseReleasedFP) (long vmID,


                                              jobject event,


                                              jobject source);


typedef void (*
         AccessBridge_MenuCanceledFP) (long vmID,


                                             jobject event,


                                             jobject source);


typedef void (*
         AccessBridge_MenuDeselectedFP) (long vmID,


                                               jobject event,


                                               jobject source);


typedef void (*
         AccessBridge_MenuSelectedFP) (long vmID,


                                             jobject event,


                                             jobject source);


typedef void (*
         AccessBridge_PopupMenuCanceledFP) (long vmID


                                                  jobject event,


                                                  jobject source);


typedef void (*
         AccessBridge_PopupMenuWillBecomeInvisibleFP) (long vmID,


                                                             jobject event,


                                                             jobject source);


typedef void (*
         AccessBridge_PopupMenuWillBecomeVisibleFP) (long vmID,


                                                            jobject event,


                                                            jobject source);


typedef void (*
         AccessBridge_PropertyNameChangeFP) (long vmID,


                                                   jobject event,


                                                   jobject source,


                                                   wchar_t *oldName,


                                                   wchar_t *newName);


typedef void (*
         AccessBridge_PropertyDescriptionChangeFP) (long vmID,


                                                          jobject event,


                                                          jobject source,


                                                          wchar_t *oldDescription,


                                                          wchar_t *newDescription);


typedef void (*
         AccessBridge_PropertyStateChangeFP) (long vmID,


                                                    jobject event,


                                                    jobject source,


                                                    wchar_t *oldState,


                                                    wchar_t *newState);


typedef void (*
         AccessBridge_PropertyValueChangeFP) (long vmID,


                                                    jobject event,


                                                    jobject source,


                                                    wchar_t *oldValue,


                                                    wchar_t *newValue);


typedef void (*
         AccessBridge_PropertySelectionChangeFP) (long vmID,


                                                        jobject event,


                                                        jobject source);


typedef void (*
         AccessBridge_PropertyTextChangeFP) (long vmID,


                                                   jobject event,


                                                   jobject source);


typedef void (*
         AccessBridge_PropertyCaretChangeFP) (long vmID,


                                                    jobject event,


                                                    jobject source,


                                                    int oldPosition,


                                                    int newPosition);


typedef void (*
         AccessBridge_PropertyVisibleDataChangeFP) (long vmID,


                                                          jobject event,


                                                          jobject source);


typedef void (*
         AccessBridge_PropertyChildChangeFP) (long vmID,


                                                    jobject event,


                                                    jobject source,


                                                    jobject oldChild,


                                                    jobject newChild);


typedef void (*
         AccessBridge_PropertyActiveDescendentChangeFP) (long vmID, jobject event,


                                                               jobject source,


                                                               jobject oldActiveDescendent,


                                                               jobject newActiveDescendent);





</blockquote>





<hr>





<table>


<tr>


<td>


         

         





    
           Copyright © 2006





    
           Sun Microsystems, Inc.





    All Rights Reserved.
        





    
        





   Please send comments to:  
           access@sun.com 





  
         


</td>


<td>


    
        Sun



</td>


</tr>


</table>


</body>





      
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
Java 8 banner (182)



Java One 2014 RHS Banner

Duke's Choice RHS Banner