Changeset 1689 for trunk/autoquest-plugin-jfc/src/main
- Timestamp:
- 08/21/14 16:23:23 (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
r1688 r1689 36 36 import de.ugoe.cs.util.console.GlobalDataContainer; 37 37 38 39 38 // helper class for the tree like structure part within a Jacareto file 40 39 class StructureNode { 40 private static int nextRef = 0; 41 41 42 public String content; 42 43 public ArrayList<StructureNode> children; 43 44 44 public StructureNode(String content) { 45 this.content = content; 46 this.children = new ArrayList<StructureNode>(); 47 } 48 49 public StructureNode add(String content) { 50 StructureNode node = new StructureNode(content); 45 public StructureNode(String type) { 46 content = "<StructureElement class=\"jacareto.struct." + type + "\">"; 47 children = new ArrayList<StructureNode>(); 48 } 49 50 public StructureNode() { 51 content = "<Recordable ref=\"" + (nextRef++) + "\" />"; 52 children = new ArrayList<StructureNode>(); 53 } 54 55 public StructureNode add(String type) { 56 StructureNode node = new StructureNode(type); 51 57 children.add(node); 52 58 return node; 59 } 60 61 public void addRecordable() { 62 children.add(new StructureNode()); 53 63 } 54 64 … … 62 72 } 63 73 64 if (content. startsWith("<Recordable")) {74 if (content.endsWith("/>")) { 65 75 return result; 66 76 } 67 68 77 return result + "</StructureElement>" + separator; 69 78 } … … 79 88 */ 80 89 public class CMDgenerateJacaretoReplay implements Command { 81 82 private int nextRef;83 90 private JFCGUIElement currentFocus; 84 85 91 private StructureNode structure; 86 92 private StructureNode lastMouseClickEvent; … … 160 166 throws IOException 161 167 { 162 structure = new StructureNode(" <StructureElement class=\"jacareto.struct.RootElement\">");168 structure = new StructureNode("RootElement"); 163 169 // reference the elements that we included in the header 164 structure.add("<Recordable ref=\"0\" />"); // Calendar 165 structure.add("<Recordable ref=\"1\" />"); // SystemInfo 166 structure.add("<Recordable ref=\"2\" />"); // KeyboardState 167 structure.add("<Recordable ref=\"3\" />"); // ComponentMode 168 structure.add("<Recordable ref=\"4\" />"); // ApplicationStarter 169 nextRef = 5; 170 structure.addRecordable(); // Calendar 171 structure.addRecordable(); // SystemInfo 172 structure.addRecordable(); // KeyboardState 173 structure.addRecordable(); // ComponentMode 174 structure.addRecordable(); // ApplicationStarter 170 175 171 176 for (List<Event> sequence : sequences) { … … 174 179 175 180 if (event.getType() instanceof MouseButtonDown) { 176 lastMouseClickEvent = 177 new StructureNode("<StructureElement class=\"jacareto.struct.MouseClick\">"); 181 lastMouseClickEvent = new StructureNode("MouseClick"); 178 182 writeMouseClickEvent(writer, event, 501); 179 183 } … … 301 305 ); 302 306 //@formatter:on 303 lastItemActionEvent = 304 new StructureNode("<StructureElement class=\"jacareto.struct.ItemStateChange\">"); 305 lastItemActionEvent.add("<Recordable ref=\"" + (nextRef++) + "\" />"); 306 lastItemActionEvent.add("<Recordable ref=\"" + (nextRef++) + "\" />"); 307 lastItemActionEvent = new StructureNode("ItemStateChange"); 308 lastItemActionEvent.addRecordable(); 309 lastItemActionEvent.addRecordable(); 307 310 } 308 311 … … 312 315 313 316 if (currentFocus != null) { 314 lastFocusChangeEvent = 315 new StructureNode("<StructureElement class=\"jacareto.struct.FocusChange\">"); 317 lastFocusChangeEvent = new StructureNode("FocusChange"); 316 318 317 319 // focus lost on old target … … 352 354 ); 353 355 //@formatter:on 354 lastFocusChangeEvent.add ("<Recordable ref=\"" + (nextRef++) + "\" />");356 lastFocusChangeEvent.addRecordable(); 355 357 } 356 358 … … 394 396 //@formatter:on 395 397 396 lastMouseClickEvent.add ("<Recordable ref=\"" + (nextRef++) + "\" />");398 lastMouseClickEvent.addRecordable(); 397 399 } 398 400
Note: See TracChangeset
for help on using the changeset viewer.