|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
MouseEventDataTagHandler.java | - | 100% | 100% | 100% |
|
1 |
package junit.extensions.jfcunit.eventdata;
|
|
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 click and drag elements. Where the
|
|
11 |
* type specified is MouseEventData.
|
|
12 |
*
|
|
13 |
* <h3>Description</h3>
|
|
14 |
* <p>
|
|
15 |
* Nothing is invoked directly by this tag handler. The click and drag elements
|
|
16 |
* use this tag handler to customize the data specificly for the type specified.
|
|
17 |
* </p>
|
|
18 |
*
|
|
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">type</td>
|
|
30 |
* <td valign="top">For this element the type must be set to MouseEventData</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">refid</td>
|
|
37 |
* <td valign="top">Id of a object reference which has been previously found.</td>
|
|
38 |
* <td valign="top" align="center">Yes</td>
|
|
39 |
* <td valign="top">N/A</td>
|
|
40 |
* <td valign="top">N/A</td>
|
|
41 |
* </tr>
|
|
42 |
* <tr>
|
|
43 |
* <td valign="top">clicks</td>
|
|
44 |
* <td valign="top">The number of clicks to be executed.</td>
|
|
45 |
* <td valign="top" align="center">No</td>
|
|
46 |
* <td valign="top">1</td>
|
|
47 |
* <td valign="top">Positive Integer</td>
|
|
48 |
* </tr>
|
|
49 |
* <tr>
|
|
50 |
* <td valign="top">modifiers</td>
|
|
51 |
* <td valign="top">The modifiers to be used for this event.</td>
|
|
52 |
* <td valign="top" align="center">No</td>
|
|
53 |
* <td valign="top">Button1 if popup is false otherwise Button3</td>
|
|
54 |
* <td valign="top">alt altgr control meta shift button1 button2 button3</td>
|
|
55 |
* </tr>
|
|
56 |
* <tr>
|
|
57 |
* <td valign="top">popup</td>
|
|
58 |
* <td valign="top">True if this is event is using the popup button.</td>
|
|
59 |
* <td valign="top" align="center">No</td>
|
|
60 |
* <td valign="top">false</td>
|
|
61 |
* <td valign="top">true false</td>
|
|
62 |
* </tr>
|
|
63 |
* <tr>
|
|
64 |
* <td valign="top">sleeptime</td>
|
|
65 |
* <td valign="top">Maximum sleep time</td>
|
|
66 |
* <td valign="top" align="center">No</td>
|
|
67 |
* <td valign="top">500</td>
|
|
68 |
* <td valign="top">Positive Integer representing the milli-seconds</td>
|
|
69 |
* </tr>
|
|
70 |
* <tr>
|
|
71 |
* <td valign="top">position</td>
|
|
72 |
* <td valign="top">Positioning of the mouse within the bounds of the component.</td>
|
|
73 |
* <td valign="top" align="center">No</td>
|
|
74 |
* <td valign="top">center</td>
|
|
75 |
* <td valign="top">center north northeast east southeast south southwest west northwest custom percentage</td>
|
|
76 |
* </tr>
|
|
77 |
* <tr>
|
|
78 |
* <td valign="top">reference</td>
|
|
79 |
* <td valign="top">Reference point or number for position calculation.</td>
|
|
80 |
* <td valign="top" align="center">No</td>
|
|
81 |
* <td valign="top">null</td>
|
|
82 |
* <td valign="top">integers "x,y"</td>
|
|
83 |
* </tr>
|
|
84 |
*
|
|
85 |
* </table>
|
|
86 |
* <h3>Example</h3>
|
|
87 |
* <blockquote><pre>
|
|
88 |
* <click
|
|
89 |
* type="MouseEventData"
|
|
90 |
* refid="FileMenuItem"
|
|
91 |
* />
|
|
92 |
* </pre></blockquote>
|
|
93 |
* <p>
|
|
94 |
* The above clicks once on the center of the component identified by
|
|
95 |
* FileMenuItem.
|
|
96 |
* </p>
|
|
97 |
* @see junit.extensions.jfcunit.eventdata.MouseEventData
|
|
98 |
* @author Kevin Wilson
|
|
99 |
*/
|
|
100 |
public class MouseEventDataTagHandler extends BaseEventDataTagHandler { |
|
101 |
/**
|
|
102 |
* Constructor for MouseEventDataTagHandler.
|
|
103 |
*
|
|
104 |
* @param element The element to be processed
|
|
105 |
* @param testCase The IXMLTestCase that uses this element
|
|
106 |
*/
|
|
107 | 151 |
public MouseEventDataTagHandler(final Element element,
|
108 |
final IXMLTestCase testCase) { |
|
109 | 151 |
super(element, testCase);
|
110 |
} |
|
111 |
|
|
112 |
/**
|
|
113 |
* @see junit.extensions.xml.elements.AbstractTagHandler#processElement()
|
|
114 |
*/
|
|
115 | 151 |
public void processElement() throws XMLException { |
116 | 151 |
validateElement(); |
117 |
|
|
118 | 151 |
setEventData( |
119 |
new MouseEventData(
|
|
120 |
getJFCTestCase(), |
|
121 |
getComponent(), |
|
122 |
getClicks(), |
|
123 |
getModifiers(), |
|
124 |
getPopupTrigger(), |
|
125 |
getSleepTime(), |
|
126 |
getPosition(), |
|
127 |
getReference())); |
|
128 |
} |
|
129 |
|
|
130 |
/**
|
|
131 |
* @see junit.extensions.xml.elements.AbstractTagHandler#validateElement()
|
|
132 |
*/
|
|
133 | 151 |
public void validateElement() throws XMLException { |
134 |
// do the default validations from the super class
|
|
135 | 151 |
super.validateElement();
|
136 |
} |
|
137 |
} |
|
138 |
|
|