Changeset 1678 for trunk/autoquest-plugin-jfc/src/main/java/de
- Timestamp:
- 08/14/14 17:07:17 (10 years ago)
- Location:
- trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/commands/CMDgenerateJacaretoReplay.java
r1673 r1678 24 24 import java.util.Iterator; 25 25 import java.util.List; 26 import java.util.UUID; 26 27 import java.util.logging.Level; 27 28 … … 30 31 import de.ugoe.cs.util.console.Command; 31 32 import de.ugoe.cs.autoquest.eventcore.Event; 33 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 32 34 import de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement; 33 35 import de.ugoe.cs.util.console.Console; … … 43 45 */ 44 46 public class CMDgenerateJacaretoReplay implements Command { 47 48 private int nextRef; 45 49 46 50 /* … … 108 112 writeLine(writer, 109 113 "<KeyboardState procTime=\"0\" duration=\"0\" isNumLockOn=\"false\" isScrollLockOn=\"false\" isCapsLockOn=\"false\" applyIsNumLockOn=\"true\" applyIsScrollLockOn=\"true\" applyIsCapsLockOn=\"true\" uuid=\"28146f79-9fc7-49f9-b4a8-5866a7625683\" />"); 110 writeLine(writer, " ComponentMode numberPopupMenues=\"true\" />");114 writeLine(writer, "<ComponentMode numberPopupMenues=\"true\" />"); 111 115 writeLine(writer, 112 116 "<ApplicationStarter procTime=\"5\" duration=\"5\" name=\"HelloWorldSwing\" class=\"HelloWorldSwing\" initclass=\"\" basepath=\"/home/daniel/project/autoquest-jfcmonitor\" classpathext=\"${basepath}/helloswing.jar;${basepath}/.;\" detectDuration=\"false\" captureparams=\"\" replayparams=\"\" uuid=\"a7b7d7b9-caa9-4d6d-b052-cf74d353275e\" />"); … … 120 124 structure.add("<StructureElement class=\"jacareto.struct.RootElement\">"); 121 125 // reference the elements that we included in the header 122 structure.add("<Recordable ref=\"1\" />"); // Calendar 123 structure.add("<Recordable ref=\"2\" />"); // SystemInfo 124 structure.add("<Recordable ref=\"3\" />"); // KeyboardState 126 structure.add("<Recordable ref=\"0\" />"); // Calendar 127 structure.add("<Recordable ref=\"1\" />"); // SystemInfo 128 structure.add("<Recordable ref=\"2\" />"); // KeyboardState 129 structure.add("<Recordable ref=\"3\" />"); // ComponentMode 125 130 structure.add("<Recordable ref=\"4\" />"); // ApplicationStarter 131 nextRef = 5; 126 132 127 133 for (List<Event> sequence : sequences) { … … 131 137 // TODO: do a mapping file or something to map 132 138 // from autoquest events to jacareto events 133 if (event.getType().getName().equals("KeyboardFocusChange")) { 134 /* 135 writeLine( 136 "<FocusEvent procTime=\"0\" duration=\"0\" source="JFrame_(1).JRootPane_(1).JLayeredPane_(1).JPanel_(1).JPanel_(1).JCheckBox_(1)" +" + 137 " class="javax.swing.JCheckBox" uuid="061bee8f-d8a3-477f-ab8d-bab02f614916" ID="1004" component="null" root="JFrame_(1)" xPos="0" yPos="0" width="0" height="0" isTemporary="false" />"); 138 */ 139 System.out.println(((JFCGUIElement)event.getTarget()).getJacaretoHierarchy()); 140 } 141 else { 142 System.out.println(event.getType()); 143 System.out.println(event.getTarget()); 139 if (event.getType().getName().equals("LeftMouseClick")) { 140 JFCGUIElement target = (JFCGUIElement) event.getTarget(); 141 142 // FIXME: assume that the target is a checkbox for now =) 143 // this is an item event and an action event in jacareto 144 //@formatter:off 145 writeLine(writer, 146 "<ItemEvent " 147 + "procTime=\"1\" " 148 + "duration=\"8\" " 149 + "source=\"" + target.getJacaretoHierarchy() + "\" " 150 + "class=\"" + target.getSpecification().getType() + "\" " 151 + "uuid=\"" + UUID.randomUUID() + "\" " 152 + "ID=\"701\" " 153 + "item=\"\" " 154 + "stateChange=\"1\" />" 155 ); 156 writeLine(writer, 157 "<ActionEvent " 158 + "procTime=\"1\" " 159 + "duration=\"0\" " 160 + "source=\"" + target.getJacaretoHierarchy() + "\" " 161 + "class=\"" + target.getSpecification().getType() + "\" " 162 + "uuid=\"" + UUID.randomUUID() + "\" " 163 + "ID=\"1001\" " 164 + "command=" + target.getName() + " " 165 + "modifiers=\"16\" />" 166 ); 167 //@formatter:on 168 structure.add("<StructureElement class=\"jacareto.struct.ItemStateChange\">"); 169 structure.add("<Recordable ref=\"" + (nextRef++) + "\" />"); 170 structure.add("<Recordable ref=\"" + (nextRef++) + "\" />"); 171 structure.add("</StructureElement>"); 144 172 } 145 173 } … … 159 187 writeLine(writer, element); 160 188 } 189 // close root element 190 writeLine(writer, "</StructureElement>"); 161 191 writeLine(writer, "</Structure>"); 162 192 } … … 169 199 ArrayList<String> structure = writeJacaretoEvents(writer, sequences); 170 200 writeJacaretoTail(writer, structure); 171 writeLine(writer, "< JacaretoStructure>");201 writeLine(writer, "</JacaretoStructure>"); 172 202 173 203 writer.flush(); -
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCGUIElement.java
r1674 r1678 87 87 * @return the name 88 88 */ 89 String getName() {89 public String getName() { 90 90 return specification.getName(); 91 91 } … … 128 128 * 129 129 * @see 130 * de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.autoquest .eventcore131 * . guimodel.IGUIElementSpec)130 * de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.autoquest 131 * .eventcore .guimodel.IGUIElementSpec) 132 132 */ 133 133 @Override … … 152 152 } 153 153 154 /*155 * (non-Javadoc)156 *157 * @see java.lang.Object#toString()158 */159 154 public String getJacaretoHierarchy() { 160 String str = getElementDescriptor() + "_(" + getIndex() + ")"; 155 String str; 156 157 // get the Java classname, ignore the package hierarchy if present 158 String[] parts = getSpecification().getType().split("\\."); 159 String name = parts[parts.length - 1]; 160 161 // find the correct Jacareto index 162 // jacareto indices start at 1 163 int jacIndex = getIndex() + 1; 164 // some class specific hacks 165 if (name.equals("JFrame")) { 166 jacIndex++; 167 } 168 else if (name.equals("JLayeredPane")) { 169 jacIndex--; 170 } 171 172 str = parts[parts.length - 1] + "_(" + jacIndex + ")"; 173 161 174 if (getParent() != null) { 162 175 return ((JFCGUIElement) getParent()).getJacaretoHierarchy() + "." + str; … … 164 177 return str; 165 178 } 166 179 167 180 /* 168 181 * (non-Javadoc) … … 178 191 } 179 192 180 /* (non-Javadoc) 193 /* 194 * (non-Javadoc) 195 * 181 196 * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#getDistanceTo(IGUIElement) 182 197 */
Note: See TracChangeset
for help on using the changeset viewer.