org.fest.swing.finder
Class WindowFinder

java.lang.Object
  extended by org.fest.swing.finder.WindowFinder

public final class WindowFinder
extends Object

Understands lookup of Frames and Dialogs. Lookups are performed till the window of interest is found, or until the given time to perform the lookup is over. The default lookup time is 5 seconds.

WindowFinder is the "entry point" of a fluent interface to look up frames and dialogs. This example illustrates finding a Frame by name, using the default lookup time (5 seconds):

 FrameFixture frame = WindowFinder.findFrame("someFrame").using(robot);
 

Where robot is an instance of Robot.

This example shows how to find a Dialog by type using a lookup time of 10 seconds:

 DialogFixture dialog = WindowFinder.findDialog(MyDialog.class).withTimeout(10000).using(robot);
 
We can also specify the time unit:
 DialogFixture dialog = WindowFinder.findDialog(MyDialog.class).withTimeout(10, SECONDS).using(robot);
 

This example shows how to use a GenericTypeMatcher to find a Frame with title "Hello":

 GenericTypeMatcher<JFrame> matcher = new GenericTypeMatcher<JFrame>() {
   protected boolean isMatching(JFrame frame) {
     return "hello".equals(frame.getTitle());
   }
 };
 FrameFixture frame = WindowFinder.findFrame(matcher).using(robot);
 

Author:
Alex Ruiz, Yvonne Wang

Method Summary
static DialogFinder findDialog(Class<? extends Dialog> dialogType)
          Creates a new DialogFinder capable of looking up a Dialog by type.
static DialogFinder findDialog(GenericTypeMatcher<? extends Dialog> matcher)
          Creates a new DialogFinder capable of looking up a Dialog using the provided matcher.
static DialogFinder findDialog(String dialogName)
          Creates a new DialogFinder capable of looking up a Dialog by name.
static FrameFinder findFrame(Class<? extends Frame> frameType)
          Creates a new FrameFinder capable of looking up a Frame by type.
static FrameFinder findFrame(GenericTypeMatcher<? extends Frame> matcher)
          Creates a new FrameFinder capable of looking up a Frame using the provided matcher.
static FrameFinder findFrame(String frameName)
          Creates a new FrameFinder capable of looking up a Frame by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findFrame

public static FrameFinder findFrame(String frameName)
Creates a new FrameFinder capable of looking up a Frame by name.

Parameters:
frameName - the name of the frame to find.
Returns:
the created finder.

findFrame

public static FrameFinder findFrame(Class<? extends Frame> frameType)
Creates a new FrameFinder capable of looking up a Frame by type.

Parameters:
frameType - the type of the frame to find.
Returns:
the created finder.

findFrame

public static FrameFinder findFrame(GenericTypeMatcher<? extends Frame> matcher)
Creates a new FrameFinder capable of looking up a Frame using the provided matcher.

Parameters:
matcher - the matcher to use to find a frame.
Returns:
the created finder.

findDialog

public static DialogFinder findDialog(String dialogName)
Creates a new DialogFinder capable of looking up a Dialog by name.

Parameters:
dialogName - the name of the dialog to find.
Returns:
the created finder.

findDialog

public static DialogFinder findDialog(Class<? extends Dialog> dialogType)
Creates a new DialogFinder capable of looking up a Dialog by type.

Parameters:
dialogType - the type of the dialog to find.
Returns:
the created finder.

findDialog

public static DialogFinder findDialog(GenericTypeMatcher<? extends Dialog> matcher)
Creates a new DialogFinder capable of looking up a Dialog using the provided matcher.

Parameters:
matcher - the matcher to use to find a dialog.
Returns:
the created finder.


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