- Timestamp:
- 09/01/14 16:16:15 (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
r1701 r1704 22 22 import java.util.ArrayList; 23 23 import java.util.Collection; 24 import java.util.HashMap; 24 25 import java.util.Iterator; 25 26 import java.util.List; … … 91 92 private JFCGUIElement currentFocus; 92 93 private StructureNode structure; 94 93 95 private StructureNode lastKeySequenceEvent; 94 96 private StructureNode lastKeyTypedEvent; 97 private int currentKeyModifiers; 98 99 private HashMap<VirtualKey, Integer> modifiers; 100 95 101 private StructureNode lastMouseClickEvent; 96 102 private StructureNode lastFocusChangeEvent; … … 138 144 sequences = (Collection<List<Event>>) dataObject; 139 145 146 // map which maps VirtualKeys back to awt key modifier codes 147 modifiers = new HashMap<>(); 148 modifiers.put(VirtualKey.SHIFT, 1); 149 modifiers.put(VirtualKey.CONTROL, 2); 150 modifiers.put(VirtualKey.ALT, 8); 151 modifiers.put(VirtualKey.ALT_GRAPH, 32); 152 currentKeyModifiers = 0; 153 140 154 writeJacaretoXML(sequences, filename); 141 155 } … … 438 452 KeyInteraction info = (KeyInteraction) event.getType(); 439 453 JFCGUIElement target = (JFCGUIElement) event.getTarget(); 440 454 int keyCode = info.getKey().getVirtualKeyCode(); 455 456 applyKeyModifier(info.getKey(), jacId == 401); 457 441 458 //@formatter:off 442 459 writeLine(writer, … … 459 476 writeLine(writer, 460 477 "<KeyInfo " 461 + "keyCode=\"" + info.getKey().getVirtualKeyCode()+ "\" "462 + "keyChar=\"" + getKeyChar( info.getKey().getVirtualKeyCode()) + "\" "463 + "modifiers=\" 0\" />"478 + "keyCode=\"" + keyCode + "\" " 479 + "keyChar=\"" + getKeyChar(keyCode) + "\" " 480 + "modifiers=\"" + currentKeyModifiers + "\" />" 464 481 ); 465 482 … … 477 494 } 478 495 } 496 497 private void applyKeyModifier (VirtualKey key, boolean set) { 498 Integer modifier = modifiers.get(key); 499 if (modifier != null) { 500 if (set) { 501 currentKeyModifiers |= modifier; 502 } 503 else { 504 currentKeyModifiers &= ~modifier; 505 } 506 } 507 } 479 508 }
Note: See TracChangeset
for help on using the changeset viewer.