com.jniwrapper.macosx.accessibility
Class AXUIElement

java.lang.Object
  extended bycom.jniwrapper.macosx.accessibility.AXUIElement

public class AXUIElement
extends java.lang.Object


Method Summary
 java.lang.String[] copyActionNames(AXUIElementRef element)
          Returns a list of all the actions the specified accessibility object can perform.
 java.lang.String[] copyAttributeNames(AXUIElementRef element)
          Returns a list of all the attributes supported by the specified accessibility object.
 java.lang.Object copyAttributeValue(AXUIElementRef element, java.lang.String attribute)
          Returns the value of an accessibility object's attribute.
 java.lang.Object[] copyAttributeValues(AXUIElementRef element, java.lang.String attribute, int index, int maxValues)
          Returns an array of attribute values for the accessibility object's attribute, starting at the specified index.
 AXUIElementRef copyElementAtPosition(AXUIElementRef application, java.awt.Point position)
          Returns the accessibility object at the specified position in top-left relative screen coordinates.
 AXUIElementRef createSystemWide()
          Returns an accessibility object that provides access to system attributes.
 int getAttributeValueCount(AXUIElementRef element, java.lang.String attribute)
          Returns the count of the array of an accessibility object's attribute value.
static AXUIElement getInstance()
           
 boolean isAPIEnabled()
          Returns whether the accessibility API is enabled.
 boolean isAttributeSettable(AXUIElementRef element, java.lang.String attribute)
          Returns whether the specified accessibility object's attribute can be modified.
 boolean isCurrentProcessTrusted()
          Returns whether the current process is a trusted accessibility client.
 void makeProcessTrusted(java.lang.String executablePath)
          Attempts to make the process represented by the specified path a trusted accessibility client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AXUIElement getInstance()

isAPIEnabled

public boolean isAPIEnabled()
Returns whether the accessibility API is enabled.

Assistive applications will not work if the accessibility API is not enabled or if the calling process is not a trusted accessibility client. Users can enable the accessibility API by checking "Enable access for assistive devices" in Universal Access Preferences.

Returns:
Returns TRUE if the accessibility API is currently enabled, otherwise FALSE.

isCurrentProcessTrusted

public boolean isCurrentProcessTrusted()
Returns whether the current process is a trusted accessibility client.

Returns:
Returns TRUE if the current process is a trusted accessibility client, FALSE if it is not.

makeProcessTrusted

public void makeProcessTrusted(java.lang.String executablePath)
Attempts to make the process represented by the specified path a trusted accessibility client.

Use this function to make a process a trusted accessibility client. Note: The caller must be running as root to successfully call this function.

Parameters:
executablePath - The path to the executable of the process to make trusted.

createSystemWide

public AXUIElementRef createSystemWide()
Returns an accessibility object that provides access to system attributes.

This is useful for things like finding the focused accessibility object regardless of which application is currently active.

Returns:
The AXUIElementRef representing the system-wide accessibility object.

copyElementAtPosition

public AXUIElementRef copyElementAtPosition(AXUIElementRef application,
                                            java.awt.Point position)
Returns the accessibility object at the specified position in top-left relative screen coordinates.

This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location. Note that if the system-wide accessibility object is passed in the application parameter, the position test is not restricted to a particular application.

Parameters:
application - The AXUIElementRef representing the application that contains the screen coordinates (or the system-wide accessibility object).
position - The position.
Returns:
The accessibility object at the position

copyActionNames

public java.lang.String[] copyActionNames(AXUIElementRef element)
Returns a list of all the actions the specified accessibility object can perform.

Parameters:
element - The AXUIElementRef representing the accessibility object.
Returns:
An array of actions the accessibility object can perform (empty if the accessibility object supports no actions).

copyAttributeNames

public java.lang.String[] copyAttributeNames(AXUIElementRef element)
Returns a list of all the attributes supported by the specified accessibility object.

Parameters:
element - The AXUIElementRef representing the accessibility object.
Returns:
An array containing the accessibility object's attribute names.

copyAttributeValue

public java.lang.Object copyAttributeValue(AXUIElementRef element,
                                           java.lang.String attribute)
Returns the value of an accessibility object's attribute.

Parameters:
element - The AXUIElementRef representing the accessibility object.
attribute - The attribute name.
Returns:
The value associated with the specified attribute.

copyAttributeValues

public java.lang.Object[] copyAttributeValues(AXUIElementRef element,
                                              java.lang.String attribute,
                                              int index,
                                              int maxValues)
Returns an array of attribute values for the accessibility object's attribute, starting at the specified index.

This function is useful for dealing with large arrays, for example, a table view with a large number of children.

Parameters:
element - The AXUIElementRef representing the accessibility object.
attribute - The attribute name.
index - The index into the array.
maxValues - The maximum number of values you want (this may be more or less than the number of values associated with the attribute).
Returns:
The attribute values you requested. If maxValues is greater than the number of values associated with the attribute, the values array will contain values found between index and the end of the attribute's array, inclusive.

getAttributeValueCount

public int getAttributeValueCount(AXUIElementRef element,
                                  java.lang.String attribute)
Returns the count of the array of an accessibility object's attribute value.

Parameters:
element - The AXUIElementRef representing the accessibility object.
attribute - The attribute name.
Returns:
The size of the array that is the attribute's value.

isAttributeSettable

public boolean isAttributeSettable(AXUIElementRef element,
                                   java.lang.String attribute)
Returns whether the specified accessibility object's attribute can be modified.

Parameters:
element - The AXUIElementRef representing the accessibility object.
attribute - The attribute name.
Returns:
A Boolean value indicating whether the attribute is settable.