Changeset 1809 for trunk/autoquest-plugin-jfc/src/main
- Timestamp:
- 10/29/14 21:02:55 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java
r1808 r1809 33 33 import de.ugoe.cs.util.console.Command; 34 34 import de.ugoe.cs.autoquest.eventcore.Event; 35 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 35 36 import de.ugoe.cs.autoquest.eventcore.gui.*; 36 37 import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey; … … 111 112 private StructureNode lastFocusChangeEvent; 112 113 private StructureNode lastItemActionEvent; 114 private IEventTarget lastMouseDownTarget; 113 115 114 116 /* … … 245 247 commitFocusEvent(); 246 248 lastKeySequenceEvent = null; 247 checkIfMouseDragged();248 249 249 250 lastMouseClickEvent = new StructureNode("MouseClick"); 251 lastMouseDownTarget = event.getTarget(); 250 252 writeMouseClickEvent(writer, event, EVENT_DURATION, 501); 251 253 } … … 272 274 } 273 275 else if (event.getType() instanceof MouseClick) { 276 lastKeySequenceEvent = null; 277 274 278 if (lastMouseClickEvent != null) { 275 lastKeySequenceEvent = null; 276 277 writeMouseClickEvent(writer, event, EVENT_DURATION, 500); 278 // FIXME: don't always write an item action 279 writeItemActionEvent(writer, event); 280 // FIXME: don't write it all here because there 281 // might be no item action at all 282 if (lastFocusChangeEvent == null) { 283 // write structure sequentially 284 structure.children.add(lastMouseClickEvent); 285 structure.children.add(lastItemActionEvent); 279 if (lastMouseDownTarget == event.getTarget()) { 280 // this is the standard case: 281 // mouseDown, mouseUp and mouseClick sequence 282 // was triggered on this target 283 284 writeMouseClickEvent(writer, event, EVENT_DURATION, 500); 285 writeItemActionEvent(writer, event); 286 287 if (lastFocusChangeEvent == null) { 288 // write structure sequentially 289 structure.children.add(lastMouseClickEvent); 290 structure.children.add(lastItemActionEvent); 291 } 292 else { 293 // with nested structure 294 structure.children.add(lastItemActionEvent); 295 lastItemActionEvent.children.add(0, lastFocusChangeEvent); 296 lastFocusChangeEvent.children.add(0, lastMouseClickEvent); 297 298 lastFocusChangeEvent = null; 299 lastMouseClickEvent = null; 300 } 286 301 } 287 302 else { 288 // with nested structure 289 structure.children.add(lastItemActionEvent); 290 lastItemActionEvent.children.add(0, lastFocusChangeEvent); 291 lastFocusChangeEvent.children.add(0, lastMouseClickEvent); 292 293 lastFocusChangeEvent = null; 294 lastMouseClickEvent = null; 303 // target of mouseDown and mouseClick are different 304 // -> this is, for example, a click on a menu item 305 // within a condensed sequence 306 commitFocusEvent(); 307 308 // finish the last click on the old target 309 writeMouseClickEvent(writer, event, EVENT_DURATION, 500); 310 structure.children.add(lastMouseClickEvent); 311 312 // and generate a new one 313 generateFullClick(writer, event); 295 314 } 315 } 316 else { 317 // a target was clicked repeatedly: 318 // the condensed sequence contains no mouseDowns or 319 // mouseUps anymore 320 // -> just generate another full click 321 generateFullClick(writer, event); 296 322 } 297 323 } … … 303 329 else if (event.getType() instanceof KeyPressed) { 304 330 commitFocusEvent(); 305 // checkIfMouseDragged();306 331 307 332 if (lastKeySequenceEvent == null) { … … 313 338 else if (event.getType() instanceof KeyReleased) { 314 339 commitFocusEvent(); 315 // checkIfMouseDragged();316 340 317 341 writeKeyEvent(writer, event, 402); … … 328 352 } 329 353 330 private void checkIfMouseDragged() { 331 if (lastMouseClickEvent != null) { 332 // this was not really a click, just a drag 333 lastMouseClickEvent.setContent("MouseDrag"); 334 structure.children.add(lastMouseClickEvent); 335 lastMouseClickEvent = null; 336 } 354 private void generateFullClick(BufferedWriter writer, Event event) throws IOException { 355 lastMouseClickEvent = new StructureNode("MouseClick"); 356 lastMouseDownTarget = event.getTarget(); 357 358 writeMouseClickEvent(writer, event, EVENT_DURATION, 501); 359 writeMouseClickEvent(writer, event, EVENT_DURATION, 502); 360 writeMouseClickEvent(writer, event, EVENT_DURATION, 500); 361 writeItemActionEvent(writer, event); 362 363 structure.children.add(lastMouseClickEvent); 364 structure.children.add(lastItemActionEvent); 365 366 lastMouseDownTarget = null; 367 337 368 } 338 369
Note: See TracChangeset
for help on using the changeset viewer.