Changeset 1006


Ignore:
Timestamp:
12/05/12 12:54:01 (12 years ago)
Author:
fglaser
Message:
  • MFCLogParser and its components updated to work with generalized GUIElementTree
  • NOTE THAT GUIElementTree ADDS ALL COMPONENTS TO GUIModel NOT ONLY THE USED ONES (compare MFCWindowTree).
  • guimapping-MFC-Dummy.txt added to cover newly discovered classes (needs to be updated).
Location:
trunk/autoquest-plugin-mfc
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/EventGenerator.java

    r940 r1006  
    3434import de.ugoe.cs.autoquest.eventcore.Event; 
    3535import de.ugoe.cs.autoquest.eventcore.IEventType; 
     36import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
    3637import de.ugoe.cs.autoquest.plugin.mfc.EventGenerationRule.Term; 
    3738import de.ugoe.cs.autoquest.plugin.mfc.eventcore.MFCEventTypeFactory; 
     
    4041import de.ugoe.cs.autoquest.plugin.mfc.eventcore.WindowsMessageType; 
    4142import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCGUIElement; 
    42 import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree; 
    4343import de.ugoe.cs.util.console.Console; 
    4444 
     
    121121    /** 
    122122     * <p> 
    123      * reference to the window tree created during parsing 
    124      * </p> 
    125      */ 
    126     private MFCWindowTree windowTree; 
     123     * reference to the gui element tree created during parsing 
     124     * </p> 
     125     */ 
     126    private GUIElementTree guiElementTree; 
    127127 
    128128    /** 
     
    131131     * </p> 
    132132     */ 
    133     public EventGenerator(MFCWindowTree windowTree) { 
     133    public EventGenerator(GUIElementTree guiElementTree) { 
    134134        rulesFile = "data/rules.xml"; 
    135         this.windowTree = windowTree; 
     135        this.guiElementTree = guiElementTree; 
    136136    } 
    137137 
     
    477477                String storeParam = resolveElement.getStoreParameterName(); 
    478478                long paramHwnd = (Long) currentMessage.getParameter(param); 
    479                 MFCGUIElement guiElement = windowTree.find(paramHwnd); 
     479                MFCGUIElement guiElement = (MFCGUIElement) guiElementTree.find(paramHwnd); 
    480480                if (guiElement != null) { 
    481481                    currentMessage.addParameter(storeParam, "" + guiElement.toXML()); 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/HandlerCreate.java

    r940 r1006  
    1515package de.ugoe.cs.autoquest.plugin.mfc; 
    1616 
     17import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
     18import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec; 
     19import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCGUIElementSpec; 
    1720import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree; 
    1821 
     
    3235     * </p> 
    3336     *  
    34      * @param windowTree the tree of GUI element specifications to be created and adapted during 
     37     * @param guiElementTree the tree of GUI element specifications to be created and adapted during 
    3538     *                   parsing 
    3639     */ 
    37     public HandlerCreate(MFCWindowTree windowTree) { 
    38         super(windowTree); 
     40    public HandlerCreate(GUIElementTree guiElementTree) { 
     41        super(guiElementTree); 
    3942    } 
    4043 
     
    8992    public void onEndElement() { 
    9093        if (hwnd != 0) { 
    91             super.getWindowTree().add(parentHwnd, hwnd, windowName, resourceId, className, isModal); 
     94                IGUIElementSpec spec = new MFCGUIElementSpec(hwnd, windowName, resourceId, className, isModal); 
     95            super.getGUIElementTree().add(hwnd, parentHwnd, spec); 
    9296        } 
    9397    } 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/HandlerDestroy.java

    r940 r1006  
    1515package de.ugoe.cs.autoquest.plugin.mfc; 
    1616 
    17 import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree; 
     17import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
    1818 
    1919/** 
     
    2323 *  
    2424 * @author Steffen Herbold 
     25 * @author Fabian Glaser 
    2526 * @version 1.0 
    2627 */ 
     
    3233     * </p> 
    3334     *  
    34      * @param windowTree 
     35     * @param guiElementTree 
    3536     *            the tree of GUI element specifications to be created and adapted during parsing 
    3637     */ 
    37     public HandlerDestroy(MFCWindowTree windowTree) { 
    38         super(windowTree); 
     38    public HandlerDestroy(GUIElementTree guiElementTree) { 
     39        super(guiElementTree); 
    3940    } 
    4041 
     
    5455    public void onEndElement() { 
    5556        if (hwnd != 0) { 
    56             super.getWindowTree().remove(hwnd); 
     57            super.getGUIElementTree().remove(hwnd); 
    5758        } 
    5859    } 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/HandlerSetText.java

    r940 r1006  
    1515package de.ugoe.cs.autoquest.plugin.mfc; 
    1616 
     17import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
     18import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCGUIElement; 
     19import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCGUIElementSpec; 
    1720import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree; 
    1821 
     
    2326 *  
    2427 * @author Steffen Herbold 
     28 * @author Fabian Glaser 
    2529 * @version 1.0 
    2630 */ 
     
    3236     * </p> 
    3337     *  
    34      * @param windowTree 
     38     * @param guiElementTree 
    3539     *            the tree of GUI element specifications to be created and adapted during parsing 
    3640     */ 
    37     public HandlerSetText(MFCWindowTree windowTree) { 
    38         super(windowTree); 
     41    public HandlerSetText(GUIElementTree guiElementTree) { 
     42        super(guiElementTree); 
    3943    } 
    4044 
     
    6165    public void onEndElement() { 
    6266        if (hwnd != 0) { 
    63             super.getWindowTree().setName(hwnd, windowName); 
     67                MFCGUIElement element = (MFCGUIElement) super.getGUIElementTree().find(hwnd); 
     68                MFCGUIElementSpec spec = (MFCGUIElementSpec) element.getSpecification(); 
     69            spec.setName(windowName); 
    6470        } 
    6571    } 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/MFCLogParser.java

    r940 r1006  
    4141 
    4242import de.ugoe.cs.autoquest.eventcore.Event; 
     43import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
    4344import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel; 
    4445import de.ugoe.cs.autoquest.plugin.mfc.eventcore.WindowsMessage; 
    4546import de.ugoe.cs.autoquest.plugin.mfc.eventcore.WindowsMessageType; 
    4647import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCGUIElement; 
    47 import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree; 
    4848import de.ugoe.cs.util.StringTools; 
    4949import de.ugoe.cs.util.console.Console; 
     
    5858 *  
    5959 * @author Steffen Herbold 
     60 * @author Fabian Glaser 
    6061 * @version 1.0 
    6162 */ 
     
    7273    /** 
    7374     * <p> 
    74      * internal handle to the current window tree 
    75      * </p> 
    76      */ 
    77     private MFCWindowTree currentWindowTree; 
     75     * internal handle to the gui element tree 
     76     * </p> 
     77     */ 
     78    private GUIElementTree guiElementTree; 
    7879 
    7980    /** 
     
    251252     */ 
    252253    public GUIModel getGuiModel() { 
    253         if( currentWindowTree!=null ) { 
    254             return currentWindowTree.getGUIModel(); 
     254        if( guiElementTree!=null ) { 
     255            return guiElementTree.getGUIModel(); 
    255256        } else { 
    256257            return null; 
     
    272273            // in some logs, the session end may be marked in between the log. This is because 
    273274            // of thread problems. So instead of creating a new GUI model, preserve it. 
    274             if (currentWindowTree == null) { 
    275                 currentWindowTree = new MFCWindowTree(); 
    276             } 
    277             sequenceSplitter = new SequenceSplitter(currentWindowTree); 
     275            if (guiElementTree == null) { 
     276                guiElementTree = new GUIElementTree(); 
     277            } 
     278            sequenceSplitter = new SequenceSplitter(guiElementTree); 
    278279        } 
    279280        else if (qName.equals("msg")) { 
     
    291292 
    292293            if (currentMessageType == WindowsMessageType.WM_CREATE) { 
    293                 currentHandler = new HandlerCreate(currentWindowTree); 
     294                currentHandler = new HandlerCreate(guiElementTree); 
    294295                currentHandler.onStartElement(); 
    295296            } 
    296297            else if (currentMessageType == WindowsMessageType.WM_DESTROY) { 
    297                 currentHandler = new HandlerDestroy(currentWindowTree); 
     298                currentHandler = new HandlerDestroy(guiElementTree); 
    298299                currentHandler.onStartElement(); 
    299300            } 
    300301            else if (currentMessageType == WindowsMessageType.WM_SETTEXT) { 
    301                 currentHandler = new HandlerSetText(currentWindowTree); 
     302                currentHandler = new HandlerSetText(guiElementTree); 
    302303                currentHandler.onStartElement(); 
    303304            } 
     
    343344                try { 
    344345                    long hwnd = (Long) currentMessageParameters.get("window.hwnd"); 
    345                     MFCGUIElement target = currentWindowTree.find(hwnd); 
     346                    MFCGUIElement target = (MFCGUIElement) guiElementTree.find(hwnd); 
    346347                     
    347348                    WindowsMessage message = new WindowsMessage 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/MessageHandler.java

    r940 r1006  
    1515package de.ugoe.cs.autoquest.plugin.mfc; 
    1616 
    17 import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree; 
     17import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
    1818 
    1919/** 
     
    2525 *  
    2626 * @author Steffen Herbold 
     27 * @author Fabian Glaser 
    2728 * @version 1.0 
    2829 */ 
     
    3536     * </p> 
    3637     */ 
    37     private MFCWindowTree windowTree; 
     38    private GUIElementTree guiElementTree; 
    3839 
    3940    /** 
     
    4243     * </p> 
    4344     *  
    44      * @param windowTree the tree of GUI element specifications to be created and adapted during 
     45     * @param guiElementTree the tree of GUI element specifications to be created and adapted during 
    4546     *                   parsing 
    4647     */ 
    47     protected MessageHandler(MFCWindowTree windowTree) { 
    48         this.windowTree = windowTree; 
     48    protected MessageHandler(GUIElementTree guiElementTree) { 
     49        this.guiElementTree = guiElementTree; 
    4950    } 
    5051 
     
    7677 
    7778    /** 
    78      * @return the window tree created and adapted during parsing 
     79     * @return the gui element tree created and adapted during parsing 
    7980     */ 
    80     protected MFCWindowTree getWindowTree() { 
    81         return windowTree; 
     81    protected GUIElementTree getGUIElementTree() { 
     82        return guiElementTree; 
    8283    } 
    8384     
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/SequenceSplitter.java

    r940 r1006  
    2020 
    2121import de.ugoe.cs.autoquest.eventcore.Event; 
     22import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 
    2223import de.ugoe.cs.autoquest.plugin.mfc.eventcore.WindowsMessage; 
    2324import de.ugoe.cs.autoquest.plugin.mfc.eventcore.WindowsMessageType; 
    24 import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree; 
    2525import de.ugoe.cs.util.console.Console; 
    2626 
     
    8585     * </p> 
    8686     */ 
    87     public SequenceSplitter(MFCWindowTree windowTree) { 
     87    public SequenceSplitter(GUIElementTree guiElementTree) { 
    8888        currentSequence = new LinkedList<WindowsMessage>(); 
    8989        openDowns = 0; 
    9090        initMessages = true; 
    91         tokenGenerator = new EventGenerator(windowTree); 
     91        tokenGenerator = new EventGenerator(guiElementTree); 
    9292        actionSequence = new LinkedList<Event>(); 
    9393        prevMsg = null; 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/guimodel/MFCGUIElementSpec.java

    r990 r1006  
    9494    /** 
    9595     * <p> 
    96      * Creates a new WindowTreeNode. 
    97      * </p> 
    98      * <p> 
    99      * The constructor is protected WindowTreeNode may only be created from the MFCWindowTree. 
     96     * Creates a new MFCGUIElementSpec. 
    10097     * </p> 
    10198     *  
    10299     * @param hwnd 
    103100     *            hwnd of the window 
    104      * @param parent 
    105      *            reference to the parent's WindowTreeNode 
    106101     * @param name 
    107102     *            name of the window 
     
    113108     *            modality of the window 
    114109     */ 
    115     protected MFCGUIElementSpec(long hwnd, String name, int resourceId, String type, boolean isModal) 
     110    public MFCGUIElementSpec(long hwnd, String name, int resourceId, String type, boolean isModal) 
    116111    { 
    117112        this.hwnd = hwnd; 
Note: See TracChangeset for help on using the changeset viewer.