Java Java TM Access Bridge for Microsoft Windows, v1.0.2 FCS
API Specification
Contents

API Files

AccessBridgeCalls.h AccessBridgePackages.h AccessBridgeCallbacks.h API callsAPI data structuresAPI callbacks

API Calls

AccessBridgeCalls.h AccessBridgeCalls.c WindowsAccessBridge.dll

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 aren't 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,
                          &n bsp;   jint x, jint y, AccessibleContext *ac);
 BOOL GetAccessibleContextWithFocus(HWND window, long *vmID,
                          &n bsp;          AccessibleContext *ac);

 BOOL GetAccessibleContextInfo(long vmID,
                          &n bsp;     AccessibleContext ac,
                          &n bsp;     AccessibleContextInfo *info);

 AccessibleContext GetAccessibleChildFromContext(long vmID,
                          &n bsp;            &nbs p;          AccessibleContext ac,
                          &n bsp;            &nbs p;          jint index);
 AccessibleContext GetAccessibleParentFromContext(long vmID,
                          &n bsp;            &nbs p;           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,
                          &n bsp;  AccessibleTextInfo *textInfo,
                          &n bsp;  jint x, jint y);
 BOOL GetAccessibleTextItems(long vmID, AccessibleText at,
                          &n bsp;   AccessibleTextItemsInfo *textItems,
                          &n bsp;   jint index);
 BOOL GetAccessibleTextSelectionInfo(long vmID, AccessibleText at,
                          &n bsp; AccessibleTextSelectionInfo *textSelection);
 char * GetAccessibleTextAttributes(long vmID, AccessibleText at,
                          &n bsp;         jint index,
                          &n bsp;         AccessibleTextAttributesInfo *attributes);
 BOOL GetAccessibleTextRect(long vmID, AccessibleText at,
                          &n bsp;  AccessibleTextRectInfo *rectInfo,
                          &n bsp;  jint index);
 BOOL GetAccessibleTextRange(long vmID, AccessibleText at,
                          &n bsp;   jint start, jint end,
                          &n bsp;   wchar_t *text, short len);
 BOOL GetAccessibleTextLineBounds(long vmID, AccessibleText at,
                          &n bsp;        jint index, jint *startIndex,
                          &n bsp;        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,
                          &n bsp;            &nbs p;    wchar_t *value, short len);
 BOOL GetMaximumAccessibleValueFromContext(long vmID, AccessibleValue av,
                          &n bsp;            &nbs p;    wchar_ *value, short len);
 BOOL GetMinimumAccessibleValueFromContext(long vmID, AccessibleValue av,
                          &n bsp;            &nbs p;    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

AccessBridgePackages.h
#define MAX_STRING_SIZE    1024
#define SHORT_STRING_SIZE   256

struct AccessBridgeVersionInfo {
 wchar_t VMversion[SHORT_STRING_SIZE];        &nb sp;      // 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
                          &n bsp;          // (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

AccessBridgeCallbacks.h JavaFerretmust ReleaseJavaObject jobject
typedef void (* AccessBridge_FocusGainedFP) (long vmID,
                          &n bsp;            &nbs p;     jobject event,
                          &n bsp;            &nbs p;     jobject source);
typedef void (* AccessBridge_FocusLostFP) (long vmID,
                          &n bsp;            &nbs p;   jobject event,
                          &n bsp;            &nbs p;   jobject source);
typedef void (* AccessBridge_CaretUpdateFP) (long vmID,
                          &n bsp;            &nbs p;     jobject event,
                          &n bsp;            &nbs p;     jobject source);
typedef void (* AccessBridge_MouseClickedFP) (long vmID,
                          &n bsp;            &nbs p;      jobject event,
                          &n bsp;            &nbs p;      jobject source);
typedef void (* AccessBridge_MouseEnteredFP) (long vmID,
                          &n bsp;            &nbs p;      jobject event,
                          &n bsp;            &nbs p;      jobject source);
typedef void (* AccessBridge_MouseExitedFP) (long vmID,
                          &n bsp;            &nbs p;      jobject event,
                          &n bsp;            &nbs p;      jobject source);
typedef void (* AccessBridge_MousePressedFP) (long vmID,
                          &n bsp;            &nbs p;      jobject event,
                          &n bsp;            &nbs p;      jobject source);
typedef void (* AccessBridge_MouseReleasedFP) (long vmID,
                          &n bsp;            &nbs p;       jobject event,
                          &n bsp;            &nbs p;       jobject source);
typedef void (* AccessBridge_MenuCanceledFP) (long vmID,
                          &n bsp;            &nbs p;      jobject event,
                          &n bsp;            &nbs p;      jobject source);
typedef void (* AccessBridge_MenuDeselectedFP) (long vmID,
                          &n bsp;            &nbs p;        jobject event,
                          &n bsp;            &nbs p;        jobject source);
typedef void (* AccessBridge_MenuSelectedFP) (long vmID,
                          &n bsp;            &nbs p;      jobject event,
                          &n bsp;            &nbs p;      jobject source);
typedef void (* AccessBridge_PopupMenuCanceledFP) (long vmID
                          &n bsp;            &nbs p;           jobject event,
                          &n bsp;            &nbs p;           jobject source);
typedef void (* AccessBridge_PopupMenuWillBecomeInvisibleFP) (long vmID,
                          &n bsp;            &nbs p;                       jobject event,
                          &n bsp;            &nbs p;                       jobject source);
typedef void (* AccessBridge_PopupMenuWillBecomeVisibleFP) (long vmID,
                          &n bsp;            &nbs p;                     jobject event,
                          &n bsp;            &nbs p;                     jobject source);
typedef void (* AccessBridge_PropertyNameChangeFP) (long vmID,
                          &n bsp;            &nbs p;            jobject event,
                          &n bsp;            &nbs p;            jobject source,
                          &n bsp;            &nbs p;            wchar_t *oldName,
                          &n bsp;            &nbs p;            wchar_t *newName);
typedef void (* AccessBridge_PropertyDescriptionChangeFP) (long vmID,
                          &n bsp;            &nbs p;                    jobject event,
                          &n bsp;            &nbs p;                    jobject source,
                          &n bsp;            &nbs p;                    wchar_t *oldDescription,
                          &n bsp;            &nbs p;                    wchar_t *newDescription);
typedef void (* AccessBridge_PropertyStateChangeFP) (long vmID,
                          &n bsp;            &nbs p;             jobject event,
                          &n bsp;            &nbs p;             jobject source,
                          &n bsp;            &nbs p;             wchar_t *oldState,
                          &n bsp;            &nbs p;             wchar_t *newState);
typedef void (* AccessBridge_PropertyValueChangeFP) (long vmID,
                          &n bsp;            &nbs p;             jobject event,
                          &n bsp;            &nbs p;             jobject source,
                          &n bsp;            &nbs p;             wchar_t *oldValue,
                          &n bsp;            &nbs p;             wchar_t *newValue);
typedef void (* AccessBridge_PropertySelectionChangeFP) (long vmID,
                          &n bsp;            &nbs p;                  jobject event,
                          &n bsp;            &nbs p;                  jobject source);
typedef void (* AccessBridge_PropertyTextChangeFP) (long vmID,
                          &n bsp;            &nbs p;            jobject event,
                          &n bsp;            &nbs p;            jobject source);
typedef void (* AccessBridge_PropertyCaretChangeFP) (long vmID,
                          &n bsp;            &nbs p;             jobject event,
                          &n bsp;            &nbs p;             jobject source,
                          &n bsp;            &nbs p;             int oldPosition,
                          &n bsp;            &nbs p;             int newPosition);
typedef void (* AccessBridge_PropertyVisibleDataChangeFP) (long vmID,
                          &n bsp;            &nbs p;                    jobject event,
                          &n bsp;            &nbs p;                    jobject source);
typedef void (* AccessBridge_PropertyChildChangeFP) (long vmID,
                          &n bsp;            &nbs p;             jobject event,
                          &n bsp;            &nbs p;             jobject source,
                          &n bsp;            &nbs p;             jobject oldChild,
                          &n bsp;            &nbs p;             jobject newChild);
typedef void (* AccessBridge_PropertyActiveDescendentChangeFP) (long vmID, jobject event,
                          &n bsp;            &nbs p;                         jobject source,
                          &n bsp;            &nbs p;                         jobject oldActiveDescendent,
                          &n bsp;            &nbs p;                         jobject newActiveDescendent);

Copyright © 2001 Sun Microsystems, Inc. All Rights Reserved.

Please send comments to: access@sun.com
Sun
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve

Java 8 banner (182) IoT banner RHS (160)