|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| FrameFinder.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
package junit.extensions.jfcunit.finder;
|
|
| 2 |
|
|
| 3 |
import java.awt.Component;
|
|
| 4 |
import java.awt.Frame;
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
/**
|
|
| 8 |
* Class for checking if the {@link java.awt.Component} being searched for has been found
|
|
| 9 |
* The pattern syntax can be found at the Jakarta RegExp API Documentation in {@link org.apache.regexp.RE}.
|
|
| 10 |
*
|
|
| 11 |
* @author <a href="mailto:vraravam@thoughtworks.com">Vijay Aravamudhan : ThoughtWorks Inc.</a>
|
|
| 12 |
*/
|
|
| 13 |
public class FrameFinder extends AbstractWindowFinder { |
|
| 14 |
/**
|
|
| 15 |
* Constructor accepting all arguments needed to filter component.
|
|
| 16 |
*
|
|
| 17 |
* @param title The desired pattern for the title of the component.
|
|
| 18 |
*/
|
|
| 19 | 83 |
public FrameFinder(final String title) {
|
| 20 | 83 |
super(title);
|
| 21 |
} |
|
| 22 |
|
|
| 23 |
/**
|
|
| 24 |
* Constructor accepting all arguments needed to filter a component ({@link Frame}).
|
|
| 25 |
* @param title The desired pattern for the title of the component.
|
|
| 26 |
* @param caseIndependent Whether the match should be case independent (true) or not (false)
|
|
| 27 |
*/
|
|
| 28 | 5 |
public FrameFinder(final String title, final boolean caseIndependent) { |
| 29 | 5 |
super(title, caseIndependent);
|
| 30 |
} |
|
| 31 |
|
|
| 32 |
/**
|
|
| 33 |
* Method that returns true if the given {@link Component} matches the search
|
|
| 34 |
* criteria.
|
|
| 35 |
*
|
|
| 36 |
* @param comp The {@link Component} to test
|
|
| 37 |
* @return true if this {@link Component} is a match
|
|
| 38 |
*/
|
|
| 39 | 170 |
public boolean testComponent(final Component comp) { |
| 40 | 170 |
return ((comp != null) && isValidForProcessing(comp, Frame.class) |
| 41 |
&& checkIfTitleMatches(((Frame) comp).getTitle())); |
|
| 42 |
} |
|
| 43 |
} |
|
| 44 |
|
|
||||||||||