Changeset 1683


Ignore:
Timestamp:
08/15/14 16:10:56 (10 years ago)
Author:
dmay
Message:

more progress for mouse clicks, also start introducing timing

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

    r1678 r1683  
    3131import de.ugoe.cs.util.console.Command; 
    3232import de.ugoe.cs.autoquest.eventcore.Event; 
    33 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    3433import de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement; 
    3534import de.ugoe.cs.util.console.Console; 
     
    114113        writeLine(writer, "<ComponentMode numberPopupMenues=\"true\" />"); 
    115114        writeLine(writer, 
    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\" />"); 
     115                  "<ApplicationStarter procTime=\"0\" duration=\"0\" 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\" />"); 
    117116    } 
    118117 
     
    134133            for (Iterator<Event> eventIter = sequence.iterator(); eventIter.hasNext();) { 
    135134                Event event = eventIter.next(); 
    136  
    137                 // TODO: do a mapping file or something to map 
    138                 // from autoquest events to jacareto events 
     135                JFCGUIElement target = (JFCGUIElement) event.getTarget(); 
     136 
    139137                if (event.getType().getName().equals("LeftMouseClick")) { 
    140                     JFCGUIElement target = (JFCGUIElement) event.getTarget(); 
     138                    generateMouseClick(writer, structure, event.getTimestamp(), target); 
    141139 
    142140                    // FIXME: assume that the target is a checkbox for now =) 
     
    145143                    writeLine(writer, 
    146144                        "<ItemEvent " 
    147                         + "procTime=\"1\" " 
    148                         + "duration=\"8\" " 
     145                        + "procTime=\"0\" " 
     146                        + "duration=\"0\" " 
    149147                        + "source=\"" + target.getJacaretoHierarchy() + "\" " 
    150148                        + "class=\"" + target.getSpecification().getType() + "\" " 
     
    156154                    writeLine(writer, 
    157155                        "<ActionEvent " 
    158                         + "procTime=\"1\" " 
     156                        + "procTime=\"0\" " 
    159157                        + "duration=\"0\" " 
    160158                        + "source=\"" + target.getJacaretoHierarchy() + "\" " 
     
    246244        return writer; 
    247245    } 
     246 
     247    private void writeMouseClickEvent(BufferedWriter writer, 
     248                                      ArrayList<String> structure, 
     249                                      long timestamp, 
     250                                      JFCGUIElement target, 
     251                                      int jacId) throws IOException 
     252    { 
     253        // Note, that all position related attributes appear to be meaningless 
     254        // for our purposes. 
     255        // TODO: change procTime and duration to adequate values 
     256        //@formatter:off 
     257        writeLine(writer, 
     258            "<MouseEvent " 
     259            + "procTime=\"0\" " 
     260            + "duration=\"150\" " 
     261            + "source=\"" + target.getJacaretoHierarchy() + "\" " 
     262            + "class=\"" + target.getSpecification().getType() + "\" " 
     263            + "uuid=\"" + UUID.randomUUID() + "\" " 
     264            + "ID=\"" + jacId + "\" " 
     265            + "component=\"null\" " 
     266            + "root=\"" + target.getJacaretoRoot() + "\" " 
     267            + "xPos=\"0\" " 
     268            + "yPos=\"0\" " 
     269            + "width=\"0\" " 
     270            + "height=\"0\" " 
     271            + "when=\"" + timestamp + "\" "  
     272            + "isConsumed=\"false\">"  
     273        ); 
     274        writeLine(writer, 
     275            "<MouseInfo " 
     276            + "xPosition=\"0\" " 
     277            + "yPosition=\"0\" " 
     278            + "rootX=\"0\" " 
     279            + "rootY=\"0\" " 
     280            + "clickCount=\"1\" " 
     281            + "modifiers=\"16\" " 
     282            + "isPopupTrigger=\"false\" />" 
     283        ); 
     284        writeLine(writer, "</MouseEvent>"); 
     285        //@formatter:on 
     286 
     287        structure.add("<Recordable ref=\"" + (nextRef++) + "\" />"); 
     288    } 
     289 
     290    private void generateMouseClick(BufferedWriter writer, 
     291                                    ArrayList<String> structure, 
     292                                    long timestamp, 
     293                                    JFCGUIElement target) throws IOException 
     294    { 
     295        structure.add("<StructureElement class=\"jacareto.struct.MouseClick\">"); 
     296 
     297        writeMouseClickEvent(writer, structure, timestamp, target, 501); 
     298        writeMouseClickEvent(writer, structure, timestamp, target, 502); 
     299        writeMouseClickEvent(writer, structure, timestamp, target, 500); 
     300 
     301        structure.add("</StructureElement>"); 
     302    } 
    248303} 
  • trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCGUIElement.java

    r1678 r1683  
    178178    } 
    179179 
     180    public String getJacaretoRoot() { 
     181        return getJacaretoHierarchy().split("\\.")[0]; 
     182    } 
     183 
    180184    /* 
    181185     * (non-Javadoc) 
Note: See TracChangeset for help on using the changeset viewer.