|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| DialogFinder.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
package junit.extensions.jfcunit.finder;
|
|
| 2 |
|
|
| 3 |
import java.awt.Component;
|
|
| 4 |
import java.awt.Dialog;
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
/**
|
|
| 8 |
* Class for checking if the ({@link java.awt.Dialog}) 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 DialogFinder 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 | 249 |
public DialogFinder(final String title) {
|
| 20 | 249 |
super(title);
|
| 21 |
} |
|
| 22 |
|
|
| 23 |
/**
|
|
| 24 |
* Constructor accepting all arguments needed to filter {@link java.awt.Component}.
|
|
| 25 |
*
|
|
| 26 |
* @param title The desired pattern for the title of the component.
|
|
| 27 |
* @param caseIndependent Whether the match should be case independent (true) or not (false)
|
|
| 28 |
*/
|
|
| 29 | 5 |
public DialogFinder(final String title, final boolean caseIndependent) { |
| 30 | 5 |
super(title, caseIndependent);
|
| 31 |
} |
|
| 32 |
|
|
| 33 |
/**
|
|
| 34 |
* Method that returns true if the given {@link java.awt.Component} matches the search
|
|
| 35 |
* criteria.
|
|
| 36 |
*
|
|
| 37 |
* @param comp The component to test
|
|
| 38 |
* @return true if this component is a match
|
|
| 39 |
*/
|
|
| 40 | 424 |
public boolean testComponent(final Component comp) { |
| 41 | 424 |
return ((comp != null) && isValidForProcessing(comp, Dialog.class) |
| 42 |
&& checkIfTitleMatches(((Dialog) comp).getTitle())); |
|
| 43 |
} |
|
| 44 |
} |
|
| 45 |
|
|
||||||||||