Index: /trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java
===================================================================
--- /trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java	(revision 1688)
+++ /trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java	(revision 1689)
@@ -36,19 +36,29 @@
 import de.ugoe.cs.util.console.GlobalDataContainer;
 
-
 // helper class for the tree like structure part within a Jacareto file
 class StructureNode {
+    private static int nextRef = 0;
+
     public String content;
     public ArrayList<StructureNode> children;
 
-    public StructureNode(String content) {
-        this.content = content;
-        this.children = new ArrayList<StructureNode>();
-    }
-
-    public StructureNode add(String content) {
-        StructureNode node = new StructureNode(content);
+    public StructureNode(String type) {
+        content = "<StructureElement class=\"jacareto.struct." + type + "\">";
+        children = new ArrayList<StructureNode>();
+    }
+
+    public StructureNode() {
+        content = "<Recordable ref=\"" + (nextRef++) + "\" />";
+        children = new ArrayList<StructureNode>();
+    }
+
+    public StructureNode add(String type) {
+        StructureNode node = new StructureNode(type);
         children.add(node);
         return node;
+    }
+
+    public void addRecordable() {
+        children.add(new StructureNode());
     }
 
@@ -62,8 +72,7 @@
         }
 
-        if (content.startsWith("<Recordable")) {
+        if (content.endsWith("/>")) {
             return result;
         }
-
         return result + "</StructureElement>" + separator;
     }
@@ -79,8 +88,5 @@
  */
 public class CMDgenerateJacaretoReplay implements Command {
-
-    private int nextRef;
     private JFCGUIElement currentFocus;
-
     private StructureNode structure;
     private StructureNode lastMouseClickEvent;
@@ -160,12 +166,11 @@
         throws IOException
     {
-        structure = new StructureNode("<StructureElement class=\"jacareto.struct.RootElement\">");
+        structure = new StructureNode("RootElement");
         // reference the elements that we included in the header
-        structure.add("<Recordable ref=\"0\" />"); // Calendar
-        structure.add("<Recordable ref=\"1\" />"); // SystemInfo
-        structure.add("<Recordable ref=\"2\" />"); // KeyboardState
-        structure.add("<Recordable ref=\"3\" />"); // ComponentMode
-        structure.add("<Recordable ref=\"4\" />"); // ApplicationStarter
-        nextRef = 5;
+        structure.addRecordable(); // Calendar
+        structure.addRecordable(); // SystemInfo
+        structure.addRecordable(); // KeyboardState
+        structure.addRecordable(); // ComponentMode
+        structure.addRecordable(); // ApplicationStarter
 
         for (List<Event> sequence : sequences) {
@@ -174,6 +179,5 @@
 
                 if (event.getType() instanceof MouseButtonDown) {
-                    lastMouseClickEvent =
-                        new StructureNode("<StructureElement class=\"jacareto.struct.MouseClick\">");
+                    lastMouseClickEvent = new StructureNode("MouseClick");
                     writeMouseClickEvent(writer, event, 501);
                 }
@@ -301,8 +305,7 @@
         );
         //@formatter:on
-        lastItemActionEvent =
-            new StructureNode("<StructureElement class=\"jacareto.struct.ItemStateChange\">");
-        lastItemActionEvent.add("<Recordable ref=\"" + (nextRef++) + "\" />");
-        lastItemActionEvent.add("<Recordable ref=\"" + (nextRef++) + "\" />");
+        lastItemActionEvent = new StructureNode("ItemStateChange");
+        lastItemActionEvent.addRecordable();
+        lastItemActionEvent.addRecordable();
     }
 
@@ -312,6 +315,5 @@
 
         if (currentFocus != null) {
-            lastFocusChangeEvent =
-                new StructureNode("<StructureElement class=\"jacareto.struct.FocusChange\">");
+            lastFocusChangeEvent = new StructureNode("FocusChange");
 
             // focus lost on old target
@@ -352,5 +354,5 @@
         );
         //@formatter:on
-        lastFocusChangeEvent.add("<Recordable ref=\"" + (nextRef++) + "\" />");
+        lastFocusChangeEvent.addRecordable();
     }
 
@@ -394,5 +396,5 @@
         //@formatter:on
 
-        lastMouseClickEvent.add("<Recordable ref=\"" + (nextRef++) + "\" />");
+        lastMouseClickEvent.addRecordable();
     }
 
