org.fest.swing.finder
Class WindowFinderTemplate<T extends Window>

java.lang.Object
  extended by org.fest.swing.finder.ComponentFinderTemplate<T>
      extended by org.fest.swing.finder.WindowFinderTemplate<T>
Type Parameters:
T - the type of window this finder can search.
Direct Known Subclasses:
DialogFinder, FrameFinder

public abstract class WindowFinderTemplate<T extends Window>
extends ComponentFinderTemplate<T>

Understands a template for Window finders.

Author:
Yvonne Wang, Alex Ruiz

Constructor Summary
protected WindowFinderTemplate(Class<? extends T> windowType)
          Creates a new WindowFinderTemplate.
protected WindowFinderTemplate(GenericTypeMatcher<? extends T> matcher)
          Creates a new WindowFinderTemplate.
protected WindowFinderTemplate(String windowName, Class<? extends T> windowType)
          Creates a new WindowFinderTemplate.
 
Method Summary
abstract  WindowFixture<T> using(Robot robot)
          Finds a window by name or type using the given robot.
protected  WindowFinderTemplate<T> withTimeout(long timeout)
          Sets the timeout for this finder.
protected  WindowFinderTemplate<T> withTimeout(long timeout, TimeUnit unit)
          Sets the timeout for this finder.
 
Methods inherited from class org.fest.swing.finder.ComponentFinderTemplate
cast, findComponentWith
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowFinderTemplate

protected WindowFinderTemplate(String windowName,
                               Class<? extends T> windowType)
Creates a new WindowFinderTemplate.

Parameters:
windowName - the name of the Window to find.
windowType - the type of the Window to find.

WindowFinderTemplate

protected WindowFinderTemplate(GenericTypeMatcher<? extends T> matcher)
Creates a new WindowFinderTemplate.

Parameters:
matcher - specifies the search criteria to use when looking up a Window.

WindowFinderTemplate

protected WindowFinderTemplate(Class<? extends T> windowType)
Creates a new WindowFinderTemplate.

Parameters:
windowType - the type of the Window to find.
Method Detail

withTimeout

protected WindowFinderTemplate<T> withTimeout(long timeout)
Sets the timeout for this finder. The Window to find should be found within the given time period.

Overrides:
withTimeout in class ComponentFinderTemplate<T extends Window>
Parameters:
timeout - the number of milliseconds before stopping the search.
Returns:
this finder.
Throws:
IllegalArgumentException - if the timeout is a negative number.

withTimeout

protected WindowFinderTemplate<T> withTimeout(long timeout,
                                              TimeUnit unit)
Sets the timeout for this finder. The Window to find should be found within the given time period.

Overrides:
withTimeout in class ComponentFinderTemplate<T extends Window>
Parameters:
timeout - the period of time the search should be performed.
unit - the time unit for timeout.
Returns:
this finder.
Throws:
NullPointerException - if the time unit is null.
IllegalArgumentException - if the timeout is a negative number.

using

public abstract WindowFixture<T> using(Robot robot)
Finds a window by name or type using the given robot.

Specified by:
using in class ComponentFinderTemplate<T extends Window>
Parameters:
robot - contains the underlying finding to delegate the search to.
Returns:
a fixture capable of managing the found window.
Throws:
WaitTimedOutError - if a window with the given name or of the given type could not be found.


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