Package org.fest.swing.finder
Class ComponentFinderTemplate<T extends Component>
java.lang.Object
org.fest.swing.finder.ComponentFinderTemplate<T>
- Type Parameters:
T- the type of component this finder can search.
- Direct Known Subclasses:
JFileChooserFinder,JOptionPaneFinder,WindowFinderTemplate
Understands a template for
Component finders.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ComponentMatcherprivate final Stringprivate long(package private) static final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedComponentFinderTemplate(Class<? extends T> componentType) Creates a newComponentFinderTemplate.protectedComponentFinderTemplate(String componentName, Class<? extends T> componentType) Creates a newComponentFinderTemplate.privateComponentFinderTemplate(ComponentMatcher matcher) protectedComponentFinderTemplate(GenericTypeMatcher<? extends T> matcher) Creates a newComponentFinderTemplate. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract TCasts the givenComponentto the type supported by this finder.protected final TfindComponentWith(Robot robot) Finds the component using either by name or type.abstract ComponentFixture<T>Finds a component by name or type using the given robot.protected ComponentFinderTemplate<T>withTimeout(long newTimeout) Sets the timeout for this finder.protected ComponentFinderTemplate<T>withTimeout(long newTimeout, TimeUnit unit) Sets the timeout for this finder.
-
Field Details
-
TIMEOUT
static final long TIMEOUT- See Also:
-
timeout
private long timeout -
matcher
-
searchDescription
-
-
Constructor Details
-
ComponentFinderTemplate
Creates a newComponentFinderTemplate.- Parameters:
componentName- the name of theComponentto find.componentType- the type of theComponentto find.
-
ComponentFinderTemplate
Creates a newComponentFinderTemplate.- Parameters:
matcher- specifies the search criteria to use when looking up aComponent.
-
ComponentFinderTemplate
Creates a newComponentFinderTemplate.- Parameters:
componentType- the type of theComponentto find.
-
ComponentFinderTemplate
-
-
Method Details
-
withTimeout
Sets the timeout for this finder. TheComponentto find should be found within the given time period.- Parameters:
newTimeout- the period of time the search should be performed.unit- the time unit fortimeout.- Returns:
- this finder.
- Throws:
NullPointerException- if the time unit isnull.IllegalArgumentException- if the timeout is a negative number.
-
withTimeout
Sets the timeout for this finder. TheComponentto find should be found within the given time period.- Parameters:
newTimeout- the number of milliseconds before stopping the search.- Returns:
- this finder.
- Throws:
IllegalArgumentException- if the timeout is a negative number.
-
using
Finds a component by name or type using the given robot.- Parameters:
robot- contains the underlying finding to delegate the search to.- Returns:
- a fixture capable of managing the found component.
- Throws:
WaitTimedOutError- if a component with the given name or of the given type could not be found.
-
findComponentWith
Finds the component using either by name or type.- Parameters:
robot- contains the underlying finding to delegate the search to.- Returns:
- the found component.
- Throws:
WaitTimedOutError- if a component with the given name or of the given type could not be found.
-
cast
Casts the givenComponentto the type supported by this finder.- Parameters:
c- the givenComponent.- Returns:
- the given
Componentcasted to the type supported by this finder.
-