APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.java.accessibility.util

public Class EventQueueMonitor

Additional top-level classes in compilation unit: ComponentEvtDispatchThread, EventQueueMonitorItem.

extends Object
implements AWTEventListener
Class Inheritance
All Implemented Interfaces
java.awt.event.AWTEventListener, java.util.EventListener
Imports
java.util.*, java.awt.*, java.awt.event.*, javax.accessibility.*

The EventQueueMonitor class provides key core functionality for Assistive Technologies (and other system-level technologies that need some of the same things that Assistive Technology needs).
See Also
AWTEventMonitor, SwingEventMonitor

Field Summary

Modifier and TypeField and Description
private static ComponentEvtDispatchThread
cedt

Class that tells us what the component event dispatch thread is.

pack-priv static EventQueueMonitorItem
componentEventQueue

Queue that holds events for later processing.

pack-priv static Object
componentEventQueueLock

Handle the synchronization between the thing that populates the component event dispatch thread (queueComponentEvent) and the thing that processes the events (ComponentEvtDispatchThread).

pack-priv static Component
pack-priv static Point
pack-priv static boolean
guiInitialized

Class variable stating whether the GUI subsystem has been initialized or not.

pack-priv static GUIInitializedListener
pack-priv static MouseMotionListener
pack-priv static TopLevelWindowListener
pack-priv static Vector<Container>
pack-priv static Window

Constructor Summary

AccessConstructor and Description
public
EventQueueMonitor()

Create a new EventQueueMonitor instance.

Method Summary

Modifier and TypeMethod and Description
public static void
addGUIInitializedListener(GUIInitializedListener
the listener to add
l
)

Adds the specified listener to be notified when the GUI subsystem is initialized.

pack-priv static void
addTopLevelWindow(Component
the Container
c
)

Add a Container to the list of top-level containers in the cache.

public static void
addTopLevelWindowListener(TopLevelWindowListener
the listener to add
l
)

Adds the specified listener to be notified when a top level window is created or destroyed.

public void
eventDispatched(AWTEvent theEvent)

Implements java.awt.event.AWTEventListener.eventDispatched.

Handle events as a result of registering a listener on the EventQueue in maybeInitialize.

public static Accessible

Returns:

the Accessible at the specified point
getAccessibleAt
(Point
the point to be accessed
p
)

Obtain the Accessible object at the given point on the Screen.

pack-priv static synchronized Component

Returns:

the Component at the given Point on the screen in the given Container -- can be null if no Component is at that Point
getComponentAt
(Container
the Container to search
c
,
Point
the Point in screen coordinates
p
)

Return the Component at the given Point on the screen in the given Container.

public static Point

Returns:

the last recorded position of the mouse in screen coordinates
getCurrentMousePosition
()

Return the last recorded position of the mouse in screen coordinates.

pack-priv static synchronized Component
getShowingComponentAt(Container c, int x, int y)

Internal test

public static Window[]

Returns:

an array of top level Windows in use in the Java Virtual Machine
getTopLevelWindows
()

Return the list of top level Windows in use in the Java Virtual Machine.

public static Window

Returns:

the top level Window that currently has keyboard focus
getTopLevelWindowWithFocus
()

Return the top level Window that currently has keyboard focus.

public static boolean

Returns:

true if the GUI subsystem has been initialized
isGUIInitialized
()

Says whether the GUI subsystem has been initialized or not.

public static void
maybeInitialize()

Tell the EventQueueMonitor to start listening for events.

pack-priv static void
maybeNotifyAssistiveTechnologies()

Assisitive technologies that have registered a GUIInitializedListener will be notified.

pack-priv static void
processEvent(AWTEvent
the AWTEvent
theEvent
)

Process the event.

pack-priv static void
queueComponentEvent(ComponentEvent
a ComponentEvent
e
)

Queue up a ComponentEvent for later processing by the ComponentEvtDispatch thread.

public static void
removeGUIInitializedListener(GUIInitializedListener
the listener to remove
l
)

Removes the specified listener to be notified when the GUI subsystem is initialized.

pack-priv static void
removeTopLevelWindow(Window w)

Removes a container from the list of top level containers in the cache.

public static void
removeTopLevelWindowListener(TopLevelWindowListener
the listener to remove
l
)

Removes the specified listener to be notified when a top level window is created or destroyed.

pack-priv static void
updateCurrentMousePosition(MouseEvent
the MouseEvent that holds the new mouse position.
mouseEvent
)

Update current mouse position.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cedtback to summary
private static ComponentEvtDispatchThread cedt

Class that tells us what the component event dispatch thread is.

componentEventQueueback to summary
pack-priv static EventQueueMonitorItem componentEventQueue

Queue that holds events for later processing.

componentEventQueueLockback to summary
pack-priv static Object componentEventQueueLock

Handle the synchronization between the thing that populates the component event dispatch thread (queueComponentEvent) and the thing that processes the events (ComponentEvtDispatchThread).

currentMouseComponentback to summary
pack-priv static Component currentMouseComponent
currentMousePositionback to summary
pack-priv static Point currentMousePosition
guiInitializedback to summary
pack-priv static boolean guiInitialized

Class variable stating whether the GUI subsystem has been initialized or not.

See Also
isGUIInitialized
guiInitializedListenerback to summary
pack-priv static GUIInitializedListener guiInitializedListener
mouseMotionListenerback to summary
pack-priv static MouseMotionListener mouseMotionListener
topLevelWindowListenerback to summary
pack-priv static TopLevelWindowListener topLevelWindowListener
topLevelWindowsback to summary
pack-priv static Vector<Container> topLevelWindows
topLevelWindowWithFocusback to summary
pack-priv static Window topLevelWindowWithFocus

Constructor Detail

EventQueueMonitorback to summary
public EventQueueMonitor()

Create a new EventQueueMonitor instance. Normally, this will be called only by the AWT Toolkit during initialization time. Assistive technologies should not create instances of EventQueueMonitor by themselves. Instead, they should either refer to it directly via the static methods in this class, e.g., getCurrentMousePosition or obtain the instance by asking the Toolkit, e.g., java.awt.Toolkit#getSystemEventQueue.

Method Detail

addGUIInitializedListenerback to summary
public static void addGUIInitializedListener(GUIInitializedListener l)

Adds the specified listener to be notified when the GUI subsystem is initialized. Assistive technologies should get the results of isGUIInitialized before calling this method.

Parameters
l:GUIInitializedListener

the listener to add

See Also
isGUIInitialized, removeTopLevelWindowListener
addTopLevelWindowback to summary
pack-priv static void addTopLevelWindow(Component c)

Add a Container to the list of top-level containers in the cache. This follows the object's hierarchy up the tree until it finds the top most parent. If the parent is not already in the list of Containers, it adds it to the list.

Parameters
c:Component

the Container

addTopLevelWindowListenerback to summary
public static void addTopLevelWindowListener(TopLevelWindowListener l)

Adds the specified listener to be notified when a top level window is created or destroyed.

Parameters
l:TopLevelWindowListener

the listener to add

See Also
removeTopLevelWindowListener
eventDispatchedback to summary
public void eventDispatched(AWTEvent theEvent)

Implements java.awt.event.AWTEventListener.eventDispatched.

Handle events as a result of registering a listener on the EventQueue in maybeInitialize.

getAccessibleAtback to summary
public static Accessible getAccessibleAt(Point p)

Obtain the Accessible object at the given point on the Screen. The return value may be null if an Accessible object cannot be found at the particular point.

Parameters
p:Point

the point to be accessed

Returns:Accessible

the Accessible at the specified point

getComponentAtback to summary
pack-priv static synchronized Component getComponentAt(Container c, Point p)

Return the Component at the given Point on the screen in the given Container.

Parameters
c:Container

the Container to search

p:Point

the Point in screen coordinates

Returns:Component

the Component at the given Point on the screen in the given Container -- can be null if no Component is at that Point

getCurrentMousePositionback to summary
public static Point getCurrentMousePosition()

Return the last recorded position of the mouse in screen coordinates.

Returns:Point

the last recorded position of the mouse in screen coordinates

getShowingComponentAtback to summary
pack-priv static synchronized Component getShowingComponentAt(Container c, int x, int y)

Internal test

getTopLevelWindowsback to summary
public static Window[] getTopLevelWindows()

Return the list of top level Windows in use in the Java Virtual Machine.

Returns:Window[]

an array of top level Windows in use in the Java Virtual Machine

getTopLevelWindowWithFocusback to summary
public static Window getTopLevelWindowWithFocus()

Return the top level Window that currently has keyboard focus.

Returns:Window

the top level Window that currently has keyboard focus

isGUIInitializedback to summary
public static boolean isGUIInitialized()

Says whether the GUI subsystem has been initialized or not. If this returns true, the assistive technology can freely create GUI component instances. If the return value is false, the assistive technology should register a GUIInitializedListener and wait to create GUI component instances until the listener is called.

Returns:boolean

true if the GUI subsystem has been initialized

See Also
addGUIInitializedListener
maybeInitializeback to summary
public static void maybeInitialize()

Tell the EventQueueMonitor to start listening for events.

maybeNotifyAssistiveTechnologiesback to summary
pack-priv static void maybeNotifyAssistiveTechnologies()

Assisitive technologies that have registered a GUIInitializedListener will be notified.

See Also
addGUIInitializedListener
processEventback to summary
pack-priv static void processEvent(AWTEvent theEvent)

Process the event. This maintains the event cache in addition to calling all the registered listeners.

Note

The events that come through here are from peered Components.

Parameters
theEvent:AWTEvent

the AWTEvent

queueComponentEventback to summary
pack-priv static void queueComponentEvent(ComponentEvent e)

Queue up a ComponentEvent for later processing by the ComponentEvtDispatch thread.

Parameters
e:ComponentEvent

a ComponentEvent

removeGUIInitializedListenerback to summary
public static void removeGUIInitializedListener(GUIInitializedListener l)

Removes the specified listener to be notified when the GUI subsystem is initialized.

Parameters
l:GUIInitializedListener

the listener to remove

See Also
addGUIInitializedListener
removeTopLevelWindowback to summary
pack-priv static void removeTopLevelWindow(Window w)

Removes a container from the list of top level containers in the cache.

removeTopLevelWindowListenerback to summary
public static void removeTopLevelWindowListener(TopLevelWindowListener l)

Removes the specified listener to be notified when a top level window is created or destroyed.

Parameters
l:TopLevelWindowListener

the listener to remove

See Also
addTopLevelWindowListener
updateCurrentMousePositionback to summary
pack-priv static void updateCurrentMousePosition(MouseEvent mouseEvent)

Update current mouse position.

Parameters
mouseEvent:MouseEvent

the MouseEvent that holds the new mouse position.