Changeset 1701 for trunk/autoquest-plugin-jfc/src/main/java/de/ugoe
- Timestamp:
- 09/01/14 15:12:45 (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
r1691 r1701 91 91 private JFCGUIElement currentFocus; 92 92 private StructureNode structure; 93 private StructureNode lastKeySequenceEvent; 94 private StructureNode lastKeyTypedEvent; 93 95 private StructureNode lastMouseClickEvent; 94 96 private StructureNode lastFocusChangeEvent; … … 180 182 181 183 if (event.getType() instanceof MouseButtonDown) { 184 lastKeySequenceEvent = null; 185 182 186 lastMouseClickEvent = new StructureNode("MouseClick"); 183 187 writeMouseClickEvent(writer, event, 501); 184 188 } 185 189 else if (event.getType() instanceof MouseButtonUp) { 190 lastKeySequenceEvent = null; 191 186 192 writeMouseClickEvent(writer, event, 502); 187 193 } 188 194 else if (event.getType() instanceof MouseClick) { 195 lastKeySequenceEvent = null; 196 189 197 writeMouseClickEvent(writer, event, 500); 190 198 // FIXME: don't always write an item action … … 207 215 } 208 216 else if (event.getType() instanceof KeyboardFocusChange) { 217 lastKeySequenceEvent = null; 218 209 219 writeFocusChangeEvent(writer, event); 210 220 } 211 221 else if (event.getType() instanceof KeyPressed) { 212 // writeKeyEvent(writer, event, 401); 222 if (lastKeySequenceEvent == null) { 223 lastKeySequenceEvent = structure.add("KeySequence"); 224 } 225 lastKeyTypedEvent = lastKeySequenceEvent.add("KeyTyped"); 226 writeKeyEvent(writer, event, 401); 213 227 } 214 228 else if (event.getType() instanceof KeyReleased) { 215 //writeKeyEvent(writer, event, 402);229 writeKeyEvent(writer, event, 402); 216 230 } 217 231 } … … 445 459 writeLine(writer, 446 460 "<KeyInfo " 447 + "keyCode=\"" + getKeyCode(info.getKey()) + "\" "448 + "keyChar=\"" + getKeyChar(info.getKey() ) + "\" "461 + "keyCode=\"" + info.getKey().getVirtualKeyCode() + "\" " 462 + "keyChar=\"" + getKeyChar(info.getKey().getVirtualKeyCode()) + "\" " 449 463 + "modifiers=\"0\" />" 450 464 ); … … 452 466 writeLine(writer, "</KeyEvent>"); 453 467 454 // TODO: keyevent structure part468 lastKeyTypedEvent.addRecordable(); 455 469 } 456 470 457 private String getKeyChar (VirtualKey key) { 458 // TODO 459 return ""; 460 } 461 462 private int getKeyCode (VirtualKey key) { 463 // TODO 464 return -1; 471 private String getKeyChar (int keyCode) { 472 if (keyCode >= 32 && keyCode < 127) { 473 return String.valueOf((char)keyCode); 474 } 475 else { 476 return "_NO_LEGAL_XML_CHAR"; 477 } 465 478 } 466 479 }
Note: See TracChangeset
for help on using the changeset viewer.