Changeset 1683 for trunk/autoquest-plugin-jfc/src/main/java/de/ugoe
- Timestamp:
- 08/15/14 16:10:56 (10 years ago)
- Location:
- trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java
r1678 r1683 31 31 import de.ugoe.cs.util.console.Command; 32 32 import de.ugoe.cs.autoquest.eventcore.Event; 33 import de.ugoe.cs.autoquest.eventcore.IEventTarget;34 33 import de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement; 35 34 import de.ugoe.cs.util.console.Console; … … 114 113 writeLine(writer, "<ComponentMode numberPopupMenues=\"true\" />"); 115 114 writeLine(writer, 116 "<ApplicationStarter procTime=\" 5\" duration=\"5\" name=\"HelloWorldSwing\" class=\"HelloWorldSwing\" initclass=\"\" basepath=\"/home/daniel/project/autoquest-jfcmonitor\" classpathext=\"${basepath}/helloswing.jar;${basepath}/.;\" detectDuration=\"false\" captureparams=\"\" replayparams=\"\" uuid=\"a7b7d7b9-caa9-4d6d-b052-cf74d353275e\" />");115 "<ApplicationStarter procTime=\"0\" duration=\"0\" name=\"HelloWorldSwing\" class=\"HelloWorldSwing\" initclass=\"\" basepath=\"/home/daniel/project/autoquest-jfcmonitor\" classpathext=\"${basepath}/helloswing.jar;${basepath}/.;\" detectDuration=\"false\" captureparams=\"\" replayparams=\"\" uuid=\"a7b7d7b9-caa9-4d6d-b052-cf74d353275e\" />"); 117 116 } 118 117 … … 134 133 for (Iterator<Event> eventIter = sequence.iterator(); eventIter.hasNext();) { 135 134 Event event = eventIter.next(); 136 137 // TODO: do a mapping file or something to map 138 // from autoquest events to jacareto events 135 JFCGUIElement target = (JFCGUIElement) event.getTarget(); 136 139 137 if (event.getType().getName().equals("LeftMouseClick")) { 140 JFCGUIElement target = (JFCGUIElement) event.getTarget();138 generateMouseClick(writer, structure, event.getTimestamp(), target); 141 139 142 140 // FIXME: assume that the target is a checkbox for now =) … … 145 143 writeLine(writer, 146 144 "<ItemEvent " 147 + "procTime=\" 1\" "148 + "duration=\" 8\" "145 + "procTime=\"0\" " 146 + "duration=\"0\" " 149 147 + "source=\"" + target.getJacaretoHierarchy() + "\" " 150 148 + "class=\"" + target.getSpecification().getType() + "\" " … … 156 154 writeLine(writer, 157 155 "<ActionEvent " 158 + "procTime=\" 1\" "156 + "procTime=\"0\" " 159 157 + "duration=\"0\" " 160 158 + "source=\"" + target.getJacaretoHierarchy() + "\" " … … 246 244 return writer; 247 245 } 246 247 private void writeMouseClickEvent(BufferedWriter writer, 248 ArrayList<String> structure, 249 long timestamp, 250 JFCGUIElement target, 251 int jacId) throws IOException 252 { 253 // Note, that all position related attributes appear to be meaningless 254 // for our purposes. 255 // TODO: change procTime and duration to adequate values 256 //@formatter:off 257 writeLine(writer, 258 "<MouseEvent " 259 + "procTime=\"0\" " 260 + "duration=\"150\" " 261 + "source=\"" + target.getJacaretoHierarchy() + "\" " 262 + "class=\"" + target.getSpecification().getType() + "\" " 263 + "uuid=\"" + UUID.randomUUID() + "\" " 264 + "ID=\"" + jacId + "\" " 265 + "component=\"null\" " 266 + "root=\"" + target.getJacaretoRoot() + "\" " 267 + "xPos=\"0\" " 268 + "yPos=\"0\" " 269 + "width=\"0\" " 270 + "height=\"0\" " 271 + "when=\"" + timestamp + "\" " 272 + "isConsumed=\"false\">" 273 ); 274 writeLine(writer, 275 "<MouseInfo " 276 + "xPosition=\"0\" " 277 + "yPosition=\"0\" " 278 + "rootX=\"0\" " 279 + "rootY=\"0\" " 280 + "clickCount=\"1\" " 281 + "modifiers=\"16\" " 282 + "isPopupTrigger=\"false\" />" 283 ); 284 writeLine(writer, "</MouseEvent>"); 285 //@formatter:on 286 287 structure.add("<Recordable ref=\"" + (nextRef++) + "\" />"); 288 } 289 290 private void generateMouseClick(BufferedWriter writer, 291 ArrayList<String> structure, 292 long timestamp, 293 JFCGUIElement target) throws IOException 294 { 295 structure.add("<StructureElement class=\"jacareto.struct.MouseClick\">"); 296 297 writeMouseClickEvent(writer, structure, timestamp, target, 501); 298 writeMouseClickEvent(writer, structure, timestamp, target, 502); 299 writeMouseClickEvent(writer, structure, timestamp, target, 500); 300 301 structure.add("</StructureElement>"); 302 } 248 303 } -
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCGUIElement.java
r1678 r1683 178 178 } 179 179 180 public String getJacaretoRoot() { 181 return getJacaretoHierarchy().split("\\.")[0]; 182 } 183 180 184 /* 181 185 * (non-Javadoc)
Note: See TracChangeset
for help on using the changeset viewer.