|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| JInternalFrameFinderTagHandler.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
package junit.extensions.jfcunit.finder;
|
|
| 2 |
|
|
| 3 |
import junit.extensions.xml.IXMLTestCase;
|
|
| 4 |
import junit.extensions.xml.XMLException;
|
|
| 5 |
|
|
| 6 |
import org.w3c.dom.Element;
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
/**
|
|
| 10 |
* This is a extension of the findTagHandler element. Where the
|
|
| 11 |
* finder specified is FrameFinder.
|
|
| 12 |
*
|
|
| 13 |
* <h3>Description</h3>
|
|
| 14 |
* <p>
|
|
| 15 |
* This creates a JInternalFrameFinder and executes the find.
|
|
| 16 |
* </p>
|
|
| 17 |
* <h3>Tag Name</h3>
|
|
| 18 |
* JInternalFrameFinder
|
|
| 19 |
* <h3>Parameters</h3>
|
|
| 20 |
* <table border="1" cellpadding="2" cellspacing="0">
|
|
| 21 |
* <tr>
|
|
| 22 |
* <td valign="top"><b>Attribute</b></td>
|
|
| 23 |
* <td valign="top"><b>Description</b></td>
|
|
| 24 |
* <td align="center" valign="top"><b>Required</b></td>
|
|
| 25 |
* <td valign="top"><b>Default</b></td>
|
|
| 26 |
* <td valign="top"><b>Values</b></td>
|
|
| 27 |
* </tr>
|
|
| 28 |
* <tr>
|
|
| 29 |
* <td valign="top">finder</td>
|
|
| 30 |
* <td valign="top">For this element the type must be set to FrameFinder</td>
|
|
| 31 |
* <td valign="top" align="center">Yes</td>
|
|
| 32 |
* <td valign="top">N/A</td>
|
|
| 33 |
* <td valign="top">N/A</td>
|
|
| 34 |
* </tr>
|
|
| 35 |
* <tr>
|
|
| 36 |
* <td valign="top">id</td>
|
|
| 37 |
* <td valign="top">Id for the object found.</td>
|
|
| 38 |
* <td valign="top" align="center">Yes</td>
|
|
| 39 |
* <td valign="top">N/A</td>
|
|
| 40 |
* <td valign="top">String</td>
|
|
| 41 |
* </tr>
|
|
| 42 |
* <tr>
|
|
| 43 |
* <td valign="top">title</td>
|
|
| 44 |
* <td valign="top">The title of the frame to be found.</td>
|
|
| 45 |
* <td valign="top" align="center">Yes</td>
|
|
| 46 |
* <td valign="top">None</td>
|
|
| 47 |
* <td valign="top">Regular expression defining the title.</td>
|
|
| 48 |
* </tr>
|
|
| 49 |
* <tr>
|
|
| 50 |
* <td valign="top">caseindependent</td>
|
|
| 51 |
* <td valign="top">Ignore the case if true</td>
|
|
| 52 |
* <td valign="top" align="center">No</td>
|
|
| 53 |
* <td valign="top">false</td>
|
|
| 54 |
* <td valign="top">true/false</td>
|
|
| 55 |
* </tr>
|
|
| 56 |
* </table>
|
|
| 57 |
* <h3>Example</h3>
|
|
| 58 |
* <blockquote><pre>
|
|
| 59 |
* <find
|
|
| 60 |
* finder="JInternalFrameFinder"
|
|
| 61 |
* id="MyFrame"
|
|
| 62 |
* title="^My frame$"
|
|
| 63 |
* />
|
|
| 64 |
* </pre></blockquote>
|
|
| 65 |
* <p>
|
|
| 66 |
* The above finds the first frame with
|
|
| 67 |
* a complete title "My frame"
|
|
| 68 |
* </p>
|
|
| 69 |
* @see junit.extensions.jfcunit.finder.JInternalFrameFinder
|
|
| 70 |
* @author Kevin Wilson
|
|
| 71 |
*/
|
|
| 72 |
public class JInternalFrameFinderTagHandler extends BaseFindTagHandler { |
|
| 73 |
/**
|
|
| 74 |
* Constructor for ComponentFinderTagHandler.
|
|
| 75 |
*
|
|
| 76 |
* @param element The element to be processed
|
|
| 77 |
* @param testCase The IXMLTestCase that uses this element
|
|
| 78 |
*/
|
|
| 79 | 0 |
public JInternalFrameFinderTagHandler(final Element element,
|
| 80 |
final IXMLTestCase testCase) {
|
|
| 81 | 0 |
super(element, testCase);
|
| 82 |
} |
|
| 83 |
|
|
| 84 |
/**
|
|
| 85 |
* @see junit.extensions.xml.elements.AbstractTagHandler#processElement()
|
|
| 86 |
*/
|
|
| 87 | 0 |
public void processElement() throws XMLException { |
| 88 | 0 |
validateElement(); |
| 89 |
|
|
| 90 | 0 |
JInternalFrameFinder finder = new JInternalFrameFinder(
|
| 91 |
getTitle(), |
|
| 92 |
getCaseIndependent()); |
|
| 93 | 0 |
finder.setWait(getWait()); |
| 94 | 0 |
finder.setDebug(getXMLTestCase().getDebug()); |
| 95 |
|
|
| 96 | 0 |
String className = getClassName(); |
| 97 | 0 |
Class cls = null;
|
| 98 | 0 |
try {
|
| 99 | 0 |
cls = Class.forName(className); |
| 100 |
} catch (ClassNotFoundException cnfe) {
|
|
| 101 | 0 |
throw new XMLException("Could not locate class:" |
| 102 |
+ className, |
|
| 103 |
cnfe, |
|
| 104 |
getElement(), |
|
| 105 |
getXMLTestCase().getPropertyCache()); |
|
| 106 |
} |
|
| 107 | 0 |
finder.setComponentClass(cls); |
| 108 | 0 |
find(finder); |
| 109 |
} |
|
| 110 |
|
|
| 111 |
/**
|
|
| 112 |
* @see junit.extensions.xml.elements.AbstractTagHandler#validateElement()
|
|
| 113 |
*/
|
|
| 114 | 0 |
public void validateElement() throws XMLException { |
| 115 |
// do the default validations from the super class
|
|
| 116 | 0 |
super.validateElement();
|
| 117 |
|
|
| 118 |
// reqd attribute: class
|
|
| 119 | 0 |
checkRequiredAttribute(TITLE); |
| 120 |
} |
|
| 121 |
} |
|
| 122 |
|
|
||||||||||