org.fest.swing.monitor
Class WindowMonitor

java.lang.Object
  extended by org.fest.swing.monitor.WindowMonitor

public class WindowMonitor
extends Object

Understands a monitor that keeps track of all known root windows (showing, hidden, closed.)

Author:
Alex Ruiz

Method Summary
 Collection<EventQueue> allEventQueues()
          Returns all known event queues.
 EventQueue eventQueueFor(Component c)
          Returns the event queue corresponding to the given component.
static WindowMonitor instance()
          Returns the singleton instance of this class.
 boolean isWindowReady(Window w)
          Returns whether the window is ready to receive OS-level event input.
 Collection<Window> rootWindows()
          Return all available root windows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isWindowReady

public boolean isWindowReady(Window w)
Returns whether the window is ready to receive OS-level event input. A window's "isShowing" flag may be set true before the WINDOW_OPENED event is generated, and even after the WINDOW_OPENED is sent the window peer is not guaranteed to be ready.

Parameters:
w - the given window.
Returns:
whether the window is ready to receive OS-level event input.

eventQueueFor

public EventQueue eventQueueFor(Component c)
Returns the event queue corresponding to the given component. In most cases, this is the same as Component.getToolkit().getSystemEventQueue(), but in the case of applets will bypass the AppContext and provide the real event queue.

Parameters:
c - the given component.
Returns:
the event queue corresponding to the given component.

allEventQueues

public Collection<EventQueue> allEventQueues()
Returns all known event queues.

Returns:
all known event queues.

rootWindows

public Collection<Window> rootWindows()
Return all available root windows. A root window is one that has a null parent. Nominally this means a list similar to that returned by Frame.getFrames(), but in the case of an Applet may return a few dialogs as well.

Returns:
all available root windows.

instance

@RunsInEDT
public static WindowMonitor instance()
Returns the singleton instance of this class.

Returns:
the singleton instance of this class.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.