Changeset 1808 for trunk/autoquest-plugin-jfc/src/main/java/de
- Timestamp:
- 10/28/14 13:39:27 (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
r1719 r1808 96 96 public class CMDgenerateJacaretoReplay implements Command { 97 97 private static final int EVENT_DURATION = 150; 98 private static final int DOUBLE_CLICK_DURATION = 50; 99 private static final int STARTUP_DELAY = 10000; 98 100 99 101 private JFCGUIElement currentFocus; … … 210 212 writeLine(writer, "<ComponentMode numberPopupMenues=\"true\" />"); 211 213 writeLine(writer, "<ApplicationStarter " 212 + "procTime=\" 0\" "213 + "duration=\" 0\" "214 + "procTime=\"" + STARTUP_DELAY + "\" " 215 + "duration=\"" + STARTUP_DELAY + "\" " 214 216 + "name=\"Autoquest Replay\" " 215 217 + "class=\"" + classname + "\" " … … 240 242 Event event = eventIter.next(); 241 243 242 /*243 System.out.println(event.getType());244 System.out.println(event.getTarget());245 System.out.println("---");246 */247 248 244 if (event.getType() instanceof MouseButtonDown) { 245 commitFocusEvent(); 249 246 lastKeySequenceEvent = null; 250 247 checkIfMouseDragged(); 251 248 252 249 lastMouseClickEvent = new StructureNode("MouseClick"); 253 writeMouseClickEvent(writer, event, 501);250 writeMouseClickEvent(writer, event, EVENT_DURATION, 501); 254 251 } 255 252 else if (event.getType() instanceof MouseButtonUp) { 256 253 lastKeySequenceEvent = null; 257 254 258 writeMouseClickEvent(writer, event, 502); 255 writeMouseClickEvent(writer, event, EVENT_DURATION, 502); 256 } 257 else if (event.getType() instanceof MouseDoubleClick) { 258 StructureNode multiClick = structure.add("MultipleMouseClick"); 259 260 // first click 261 lastMouseClickEvent = multiClick.add("MouseClick"); 262 writeMouseClickEvent(writer, event, DOUBLE_CLICK_DURATION, 501); 263 writeMouseClickEvent(writer, event, DOUBLE_CLICK_DURATION, 502); 264 writeMouseClickEvent(writer, event, DOUBLE_CLICK_DURATION, 500); 265 // second click 266 lastMouseClickEvent = multiClick.add("MouseClick"); 267 writeMouseClickEvent(writer, event, DOUBLE_CLICK_DURATION, 501); 268 writeMouseClickEvent(writer, event, DOUBLE_CLICK_DURATION, 502); 269 writeMouseClickEvent(writer, event, DOUBLE_CLICK_DURATION, 500); 270 271 lastMouseClickEvent = null; 259 272 } 260 273 else if (event.getType() instanceof MouseClick) { 261 lastKeySequenceEvent = null; 262 263 writeMouseClickEvent(writer, event, 500); 264 // FIXME: don't always write an item action 265 writeItemActionEvent(writer, event); 266 // FIXME: don't write it all here because there 267 // might be no item action at all 268 if (lastFocusChangeEvent == null) { 269 // write structure sequentially 270 structure.children.add(lastMouseClickEvent); 271 structure.children.add(lastItemActionEvent); 272 } 273 else { 274 // with nested structure 275 structure.children.add(lastItemActionEvent); 276 lastItemActionEvent.children.add(0, lastFocusChangeEvent); 277 lastFocusChangeEvent.children.add(0, lastMouseClickEvent); 278 279 lastFocusChangeEvent = null; 280 lastMouseClickEvent = null; 274 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); 286 } 287 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; 295 } 281 296 } 282 297 } … … 287 302 } 288 303 else if (event.getType() instanceof KeyPressed) { 304 commitFocusEvent(); 289 305 // checkIfMouseDragged(); 290 306 … … 296 312 } 297 313 else if (event.getType() instanceof KeyReleased) { 314 commitFocusEvent(); 298 315 // checkIfMouseDragged(); 299 316 … … 301 318 } 302 319 } 320 } 321 } 322 323 private void commitFocusEvent() { 324 if (lastFocusChangeEvent != null) { 325 structure.children.add(lastFocusChangeEvent); 326 lastFocusChangeEvent = null; 303 327 } 304 328 } … … 464 488 } 465 489 466 private void writeMouseClickEvent(BufferedWriter writer, Event event, int jacId)490 private void writeMouseClickEvent(BufferedWriter writer, Event event, int duration, int jacId) 467 491 throws IOException 468 492 { … … 476 500 "<MouseEvent " 477 501 + "procTime=\"0\" " 478 + "duration=\"" + EVENT_DURATION+ "\" "502 + "duration=\"" + duration + "\" " 479 503 + "source=\"" + target.getJacaretoHierarchy() + "\" " 480 504 + "class=\"" + target.getSpecification().getType() + "\" "
Note: See TracChangeset
for help on using the changeset viewer.