|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| JFCEventManagerTagHandler.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
package junit.extensions.jfcunit.eventdata;
|
|
| 2 |
|
|
| 3 |
import junit.extensions.jfcunit.xml.JFCXMLConstants;
|
|
| 4 |
|
|
| 5 |
import junit.extensions.xml.IXMLTestCase;
|
|
| 6 |
import junit.extensions.xml.XMLException;
|
|
| 7 |
import junit.extensions.xml.elements.AbstractTagHandler;
|
|
| 8 |
|
|
| 9 |
import org.w3c.dom.Element;
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
/**
|
|
| 13 |
* This element controls the JFCEventManager.
|
|
| 14 |
*
|
|
| 15 |
* <h3>Description</h3>
|
|
| 16 |
* <p>
|
|
| 17 |
* This class can enable and disable recording and debugging.
|
|
| 18 |
* As can the JFCEventManager. The API for adding recording listeners
|
|
| 19 |
* is not exposed via the XML and must be performed via code.
|
|
| 20 |
* However, the recording and debugging combination allows for the
|
|
| 21 |
* events received to be displayed to standard out.
|
|
| 22 |
* </p>
|
|
| 23 |
* <p>
|
|
| 24 |
* In the future, XML script generation will be enabled via this class.
|
|
| 25 |
* </p>
|
|
| 26 |
*
|
|
| 27 |
* <h3>Parameters</h3>
|
|
| 28 |
* <table border="1" cellpadding="2" cellspacing="0">
|
|
| 29 |
* <tr>
|
|
| 30 |
* <td valign="top"><b>Attribute</b></td>
|
|
| 31 |
* <td valign="top"><b>Description</b></td>
|
|
| 32 |
* <td align="center" valign="top"><b>Required</b></td>
|
|
| 33 |
* <td valign="top"><b>Default</b></td>
|
|
| 34 |
* <td valign="top"><b>Values</b></td>
|
|
| 35 |
* </tr>
|
|
| 36 |
* <tr>
|
|
| 37 |
* <td valign="top">debug</td>
|
|
| 38 |
* <td valign="top">Enable debugging for the test runs.</td>
|
|
| 39 |
* <td valign="top" align="center">No</td>
|
|
| 40 |
* <td valign="top">false</td>
|
|
| 41 |
* <td valign="top">true false</td>
|
|
| 42 |
* </tr>
|
|
| 43 |
* <tr>
|
|
| 44 |
* <td valign="top">recording</td>
|
|
| 45 |
* <td valign="top">Enable recording for the test runs.</td>
|
|
| 46 |
* <td valign="top" align="center">No</td>
|
|
| 47 |
* <td valign="top">false</td>
|
|
| 48 |
* <td valign="top">true false</td>
|
|
| 49 |
* </tr>
|
|
| 50 |
*
|
|
| 51 |
* </table>
|
|
| 52 |
* <h3>Example</h3>
|
|
| 53 |
* <blockquote><pre>
|
|
| 54 |
* <manager
|
|
| 55 |
* debug="true"
|
|
| 56 |
* recording="true"
|
|
| 57 |
* />
|
|
| 58 |
* </pre></blockquote>
|
|
| 59 |
* <p>
|
|
| 60 |
* The above line truns on recording and debugging to produce the
|
|
| 61 |
* events being sent through the AWTEventQueue. It can be used to
|
|
| 62 |
* analyze direct input via the mouse and keyboard. Or it can be
|
|
| 63 |
* used when pumping events via jfcUnit.
|
|
| 64 |
* </p>
|
|
| 65 |
* @see junit.extensions.jfcunit.eventdata.JFCEventManager
|
|
| 66 |
* @author Kevin Wilson
|
|
| 67 |
*/
|
|
| 68 |
public class JFCEventManagerTagHandler extends AbstractTagHandler |
|
| 69 |
implements JFCXMLConstants {
|
|
| 70 |
/**
|
|
| 71 |
* Constructor for AWTThreadTagHandler.
|
|
| 72 |
*
|
|
| 73 |
* @param element The element to be processed
|
|
| 74 |
* @param testCase The IXMLTestCase that uses this element
|
|
| 75 |
*/
|
|
| 76 | 1 |
public JFCEventManagerTagHandler(final Element element,
|
| 77 |
final IXMLTestCase testCase) {
|
|
| 78 | 1 |
super(element, testCase);
|
| 79 |
} |
|
| 80 |
|
|
| 81 |
/**
|
|
| 82 |
* @see junit.extensions.xml.elements.AbstractTagHandler#processElement()
|
|
| 83 |
* @throws XMLException provided by contract only.
|
|
| 84 |
*/
|
|
| 85 | 1 |
public void processElement() throws XMLException { |
| 86 | 1 |
validateElement(); |
| 87 |
|
|
| 88 | 1 |
JFCEventManager.getEventManager().setDebug(getBoolean(DEBUG)); |
| 89 | 1 |
JFCEventManager.getEventManager().setRecording(getBoolean(RECORDING)); |
| 90 |
} |
|
| 91 |
|
|
| 92 |
/**
|
|
| 93 |
* @see junit.extensions.xml.elements.AbstractTagHandler#validateElement()
|
|
| 94 |
* @throws XMLException provided by contract only.
|
|
| 95 |
*/
|
|
| 96 | 1 |
public void validateElement() throws XMLException { |
| 97 |
// do the default validations from the super class
|
|
| 98 | 1 |
super.validateElement();
|
| 99 |
} |
|
| 100 |
} |
|
| 101 |
|
|
||||||||||