org.eclipse.actf.accservice.core.win32.msaa
Class MsaaAccessibilityEventService

java.lang.Object
  extended by org.eclipse.actf.accservice.core.win32.msaa.MsaaAccessibilityEventService
All Implemented Interfaces:
Serializable, IAccessibilityEventService
Direct Known Subclasses:
IA2AccessibilityEventService

public class MsaaAccessibilityEventService
extends Object
implements IAccessibilityEventService

See Also:
Serialized Form

Field Summary
static int DEFAULT_CONTEXT_FLAG
          default flag if none specified: WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS
static int DWMEM_FILESIZE
           
static int EVENT_OBJECT_ACCELERATORCHANGE
           
static int EVENT_OBJECT_CREATE
           
static int EVENT_OBJECT_DEFACTIONCHANGE
           
static int EVENT_OBJECT_DESCRIPTIONCHANGE
           
static int EVENT_OBJECT_DESTROY
           
static int EVENT_OBJECT_FOCUS
           
static int EVENT_OBJECT_HELPCHANGE
           
static int EVENT_OBJECT_HIDE
           
static int EVENT_OBJECT_LOCATIONCHANGE
           
static int EVENT_OBJECT_NAMECHANGE
           
static int EVENT_OBJECT_PARENTCHANGE
           
static int EVENT_OBJECT_REORDER
           
static int EVENT_OBJECT_SELECTION
           
static int EVENT_OBJECT_SELECTIONADD
           
static int EVENT_OBJECT_SELECTIONREMOVE
           
static int EVENT_OBJECT_SELECTIONWITHIN
           
static int EVENT_OBJECT_SHOW
           
static int EVENT_OBJECT_STATECHANGE
           
static int EVENT_OBJECT_VALUECHANGE
           
static int EVENT_SYSTEM_ALERT
           
static int EVENT_SYSTEM_CAPTUREEND
           
static int EVENT_SYSTEM_CAPTURESTART
           
static int EVENT_SYSTEM_CONTEXTHELPEND
           
static int EVENT_SYSTEM_CONTEXTHELPSTART
           
static int EVENT_SYSTEM_DIALOGEND
           
static int EVENT_SYSTEM_DIALOGSTART
           
static int EVENT_SYSTEM_DRAGDROPEND
           
static int EVENT_SYSTEM_DRAGDROPSTART
           
static int EVENT_SYSTEM_FOREGROUND
           
static int EVENT_SYSTEM_MENUEND
           
static int EVENT_SYSTEM_MENUPOPUPEND
           
static int EVENT_SYSTEM_MENUPOPUPSTART
           
static int EVENT_SYSTEM_MENUSTART
           
static int EVENT_SYSTEM_MINIMIZEEND
           
static int EVENT_SYSTEM_MINIMIZESTART
           
static int EVENT_SYSTEM_MOVESIZEEND
           
static int EVENT_SYSTEM_MOVESIZESTART
           
static int EVENT_SYSTEM_SCROLLINGEND
           
static int EVENT_SYSTEM_SCROLLINGSTART
           
static int EVENT_SYSTEM_SOUND
           
static int EVENT_SYSTEM_SWITCHEND
           
static int EVENT_SYSTEM_SWITCHSTART
           
static int FILE_MAP_COPY
           
static int FILE_MAP_READ
           
static int FILE_MAP_WRITE
           
static String fileMappingObjName
           
protected  int inContextListenerCount
           
protected static long initClockTicks
           
protected static boolean isMapFileOpen
           
protected static Map<org.eclipse.actf.accservice.core.win32.msaa.MsaaAccessibilityEventService.WinEventData,List<IModelEventListener>> listenerMap
           
protected static int mapFilePtr
           
static int PAGE_READONLY
           
static int PAGE_READWRITE
           
static int PAGE_WRITECOPY
           
protected static long timeDiff
           
protected  IWindowService windowService
           
static int WINEVENT_INCONTEXT
           
static int WINEVENT_OUTOFCONTEXT
           
static int WINEVENT_SKIPOWNPROCESS
           
static int WINEVENT_SKIPOWNTHREAD
           
 
Fields inherited from interface org.eclipse.actf.accservice.IAccessibilityEventService
serialVersionUID
 
Constructor Summary
MsaaAccessibilityEventService(IWindowService windowService)
           
 
Method Summary
 void addAccessibilityEventListener(IModelEventListener listener, Object[] eventTypes, Object[] params)
          add the listener to be notified when events of the given type are fired from the underlying system.
static boolean closeHandle(int hObject)
           
protected static int createAccessibleObjectFromEvent(int hwnd, int idObject, int idChild)
           
static int createFileMapping(int lProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, String name)
           
static String eventName(int event)
           
protected static void fireAccessibilityModelEvent(AccessibilityModelEvent accEvent, int eventId, int processId, boolean inContext)
           
static long getClockTicks()
           
 boolean initThread()
           
protected static long internalGetClockTicks()
           
protected  boolean internalRemoveWinEventHook(int hook)
           
protected  int internalSetWinEventHook(int eventMin, int eventMax, int idThread, int idProcess, int dwFlags)
           
static int mapViewOfFile(int hFileMappingObj, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, int dwNumberOfBytesToMap)
           
static int openFileMapping(int dwDesiredAccess, boolean bInheritHandle, String name)
           
static String[] readFromMem(int lpBaseAddress)
           
 void removeAccessibilityEventListener(IModelEventListener listener, Object[] eventTypes)
          remove a previously added listener
protected  boolean removeWinEventHook(int hook)
          remove a previously registered winEventHook
protected static void setTimeDiff()
           
protected  int setWinEventHook(int eventMin, int eventMax, int idProcess, int idThread, int flag)
          MSAA SetWinEventHook function wrapper
static boolean unmapViewOfFile(int lpBaseAddress)
           
protected static void winEventCallback(int eventId, int hwnd, int idObject, int idChild, long time, int isGlobal)
          callback from the native Windows system for out-of-process Msaa events.
protected  void winEventIPCallback()
          callback from the native Windows system for in-process Msaa events.
static void writeToMem(int lpBaseAddress, int content)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_SYSTEM_ALERT

public static final int EVENT_SYSTEM_ALERT
See Also:
Constant Field Values

EVENT_SYSTEM_FOREGROUND

public static final int EVENT_SYSTEM_FOREGROUND
See Also:
Constant Field Values

EVENT_SYSTEM_MENUSTART

public static final int EVENT_SYSTEM_MENUSTART
See Also:
Constant Field Values

EVENT_SYSTEM_MENUEND

public static final int EVENT_SYSTEM_MENUEND
See Also:
Constant Field Values

EVENT_SYSTEM_SOUND

public static final int EVENT_SYSTEM_SOUND
See Also:
Constant Field Values

EVENT_SYSTEM_CAPTURESTART

public static final int EVENT_SYSTEM_CAPTURESTART
See Also:
Constant Field Values

EVENT_SYSTEM_CAPTUREEND

public static final int EVENT_SYSTEM_CAPTUREEND
See Also:
Constant Field Values

EVENT_SYSTEM_MOVESIZESTART

public static final int EVENT_SYSTEM_MOVESIZESTART
See Also:
Constant Field Values

EVENT_SYSTEM_MOVESIZEEND

public static final int EVENT_SYSTEM_MOVESIZEEND
See Also:
Constant Field Values

EVENT_SYSTEM_CONTEXTHELPSTART

public static final int EVENT_SYSTEM_CONTEXTHELPSTART
See Also:
Constant Field Values

EVENT_SYSTEM_CONTEXTHELPEND

public static final int EVENT_SYSTEM_CONTEXTHELPEND
See Also:
Constant Field Values

EVENT_SYSTEM_DRAGDROPSTART

public static final int EVENT_SYSTEM_DRAGDROPSTART
See Also:
Constant Field Values

EVENT_SYSTEM_DRAGDROPEND

public static final int EVENT_SYSTEM_DRAGDROPEND
See Also:
Constant Field Values

EVENT_SYSTEM_DIALOGSTART

public static final int EVENT_SYSTEM_DIALOGSTART
See Also:
Constant Field Values

EVENT_SYSTEM_DIALOGEND

public static final int EVENT_SYSTEM_DIALOGEND
See Also:
Constant Field Values

EVENT_SYSTEM_SCROLLINGSTART

public static final int EVENT_SYSTEM_SCROLLINGSTART
See Also:
Constant Field Values

EVENT_SYSTEM_SCROLLINGEND

public static final int EVENT_SYSTEM_SCROLLINGEND
See Also:
Constant Field Values

EVENT_SYSTEM_SWITCHSTART

public static final int EVENT_SYSTEM_SWITCHSTART
See Also:
Constant Field Values

EVENT_SYSTEM_SWITCHEND

public static final int EVENT_SYSTEM_SWITCHEND
See Also:
Constant Field Values

EVENT_SYSTEM_MINIMIZESTART

public static final int EVENT_SYSTEM_MINIMIZESTART
See Also:
Constant Field Values

EVENT_SYSTEM_MINIMIZEEND

public static final int EVENT_SYSTEM_MINIMIZEEND
See Also:
Constant Field Values

EVENT_SYSTEM_MENUPOPUPSTART

public static final int EVENT_SYSTEM_MENUPOPUPSTART
See Also:
Constant Field Values

EVENT_SYSTEM_MENUPOPUPEND

public static final int EVENT_SYSTEM_MENUPOPUPEND
See Also:
Constant Field Values

EVENT_OBJECT_CREATE

public static final int EVENT_OBJECT_CREATE
See Also:
Constant Field Values

EVENT_OBJECT_DESTROY

public static final int EVENT_OBJECT_DESTROY
See Also:
Constant Field Values

EVENT_OBJECT_SHOW

public static final int EVENT_OBJECT_SHOW
See Also:
Constant Field Values

EVENT_OBJECT_HIDE

public static final int EVENT_OBJECT_HIDE
See Also:
Constant Field Values

EVENT_OBJECT_REORDER

public static final int EVENT_OBJECT_REORDER
See Also:
Constant Field Values

EVENT_OBJECT_FOCUS

public static final int EVENT_OBJECT_FOCUS
See Also:
Constant Field Values

EVENT_OBJECT_SELECTION

public static final int EVENT_OBJECT_SELECTION
See Also:
Constant Field Values

EVENT_OBJECT_SELECTIONADD

public static final int EVENT_OBJECT_SELECTIONADD
See Also:
Constant Field Values

EVENT_OBJECT_SELECTIONREMOVE

public static final int EVENT_OBJECT_SELECTIONREMOVE
See Also:
Constant Field Values

EVENT_OBJECT_SELECTIONWITHIN

public static final int EVENT_OBJECT_SELECTIONWITHIN
See Also:
Constant Field Values

EVENT_OBJECT_STATECHANGE

public static final int EVENT_OBJECT_STATECHANGE
See Also:
Constant Field Values

EVENT_OBJECT_LOCATIONCHANGE

public static final int EVENT_OBJECT_LOCATIONCHANGE
See Also:
Constant Field Values

EVENT_OBJECT_NAMECHANGE

public static final int EVENT_OBJECT_NAMECHANGE
See Also:
Constant Field Values

EVENT_OBJECT_DESCRIPTIONCHANGE

public static final int EVENT_OBJECT_DESCRIPTIONCHANGE
See Also:
Constant Field Values

EVENT_OBJECT_VALUECHANGE

public static final int EVENT_OBJECT_VALUECHANGE
See Also:
Constant Field Values

EVENT_OBJECT_PARENTCHANGE

public static final int EVENT_OBJECT_PARENTCHANGE
See Also:
Constant Field Values

EVENT_OBJECT_HELPCHANGE

public static final int EVENT_OBJECT_HELPCHANGE
See Also:
Constant Field Values

EVENT_OBJECT_DEFACTIONCHANGE

public static final int EVENT_OBJECT_DEFACTIONCHANGE
See Also:
Constant Field Values

EVENT_OBJECT_ACCELERATORCHANGE

public static final int EVENT_OBJECT_ACCELERATORCHANGE
See Also:
Constant Field Values

WINEVENT_OUTOFCONTEXT

public static final int WINEVENT_OUTOFCONTEXT
See Also:
Constant Field Values

WINEVENT_SKIPOWNTHREAD

public static final int WINEVENT_SKIPOWNTHREAD
See Also:
Constant Field Values

WINEVENT_SKIPOWNPROCESS

public static final int WINEVENT_SKIPOWNPROCESS
See Also:
Constant Field Values

WINEVENT_INCONTEXT

public static final int WINEVENT_INCONTEXT
See Also:
Constant Field Values

DEFAULT_CONTEXT_FLAG

public static final int DEFAULT_CONTEXT_FLAG
default flag if none specified: WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS

See Also:
Constant Field Values

fileMappingObjName

public static final String fileMappingObjName
See Also:
Constant Field Values

DWMEM_FILESIZE

public static final int DWMEM_FILESIZE
See Also:
Constant Field Values

PAGE_READONLY

public static final int PAGE_READONLY
See Also:
Constant Field Values

PAGE_READWRITE

public static final int PAGE_READWRITE
See Also:
Constant Field Values

PAGE_WRITECOPY

public static final int PAGE_WRITECOPY
See Also:
Constant Field Values

FILE_MAP_COPY

public static final int FILE_MAP_COPY
See Also:
Constant Field Values

FILE_MAP_WRITE

public static final int FILE_MAP_WRITE
See Also:
Constant Field Values

FILE_MAP_READ

public static final int FILE_MAP_READ
See Also:
Constant Field Values

timeDiff

protected static long timeDiff

initClockTicks

protected static long initClockTicks

mapFilePtr

protected static int mapFilePtr

isMapFileOpen

protected static boolean isMapFileOpen

listenerMap

protected static Map<org.eclipse.actf.accservice.core.win32.msaa.MsaaAccessibilityEventService.WinEventData,List<IModelEventListener>> listenerMap

windowService

protected IWindowService windowService

inContextListenerCount

protected int inContextListenerCount
Constructor Detail

MsaaAccessibilityEventService

public MsaaAccessibilityEventService(IWindowService windowService)
Method Detail

createFileMapping

public static int createFileMapping(int lProtect,
                                    int dwMaximumSizeHigh,
                                    int dwMaximumSizeLow,
                                    String name)

openFileMapping

public static int openFileMapping(int dwDesiredAccess,
                                  boolean bInheritHandle,
                                  String name)

mapViewOfFile

public static int mapViewOfFile(int hFileMappingObj,
                                int dwDesiredAccess,
                                int dwFileOffsetHigh,
                                int dwFileOffsetLow,
                                int dwNumberOfBytesToMap)

unmapViewOfFile

public static boolean unmapViewOfFile(int lpBaseAddress)

writeToMem

public static void writeToMem(int lpBaseAddress,
                              int content)

readFromMem

public static String[] readFromMem(int lpBaseAddress)

closeHandle

public static boolean closeHandle(int hObject)

initThread

public boolean initThread()

getClockTicks

public static long getClockTicks()

internalGetClockTicks

protected static long internalGetClockTicks()

setWinEventHook

protected int setWinEventHook(int eventMin,
                              int eventMax,
                              int idProcess,
                              int idThread,
                              int flag)
MSAA SetWinEventHook function wrapper

Parameters:
eventMin - - minimum event type for hook (use one of the pre-defined constants in this class)
eventMax - - maximum event value for hook (use one of the pre-defined constants in this class)
idProcess - - usually to be obtained from getProcessId(int)
idThread - - use id of desired thread or 0 for all threads
Returns:
hook reference to be used with unregisterWinEventHook or -1 if set was not successful
See Also:
removeWinEventHook(int)

internalSetWinEventHook

protected int internalSetWinEventHook(int eventMin,
                                      int eventMax,
                                      int idThread,
                                      int idProcess,
                                      int dwFlags)

removeWinEventHook

protected boolean removeWinEventHook(int hook)
remove a previously registered winEventHook

Parameters:
hook - - hook reference obtained from setWinEventHook
Returns:
true if hook successfully removed, false otherwise
See Also:
#setWinEventHook(int, int, int, int)

internalRemoveWinEventHook

protected boolean internalRemoveWinEventHook(int hook)

winEventCallback

protected static void winEventCallback(int eventId,
                                       int hwnd,
                                       int idObject,
                                       int idChild,
                                       long time,
                                       int isGlobal)
callback from the native Windows system for out-of-process Msaa events. The parameters are:

The appropriate listeners for the given event id are notified and the AccesibilityModelEvent is created from the formed MsaaAccessible

Parameters:
eventId -
hwnd -
idObject -
idChild -
time -

createAccessibleObjectFromEvent

protected static int createAccessibleObjectFromEvent(int hwnd,
                                                     int idObject,
                                                     int idChild)

winEventIPCallback

protected void winEventIPCallback()
callback from the native Windows system for in-process Msaa events. The event information is read from a memory map file as a string array.

The appropriate listeners for the given event id are notified and the AccesibilityModelEvent is created. Here, the source of the AccesibilityModelEvent is a string array containing information about the accessible that fired the event


fireAccessibilityModelEvent

protected static void fireAccessibilityModelEvent(AccessibilityModelEvent accEvent,
                                                  int eventId,
                                                  int processId,
                                                  boolean inContext)

addAccessibilityEventListener

public void addAccessibilityEventListener(IModelEventListener listener,
                                          Object[] eventTypes,
                                          Object[] params)
add the listener to be notified when events of the given type are fired from the underlying system. The optional parameters array, if specified, may have only one element that is of type Integer and that represents a bit-wise oring of the flag constants defined in this class.

Specified by:
addAccessibilityEventListener in interface IAccessibilityEventService
Parameters:
listener -
eventTypes - to be chosen from constants in this class
params - flag parameters taken from symbolic constants in this class
See Also:
MsaaGuiModel.registerModelEventListener(IModelEventListener, ModelEventType[], Object[])

setTimeDiff

protected static void setTimeDiff()

removeAccessibilityEventListener

public void removeAccessibilityEventListener(IModelEventListener listener,
                                             Object[] eventTypes)
remove a previously added listener

Specified by:
removeAccessibilityEventListener in interface IAccessibilityEventService

eventName

public static String eventName(int event)