Ignore:
Timestamp:
08/27/12 11:45:09 (12 years ago)
Author:
pharms
Message:
  • adapted implementation to now generate a full GUI model as well as concrete GUI interaction events
File:
1 edited

Legend:

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

    r581 r619  
     1 
    12package de.ugoe.cs.quest.plugin.mfc; 
    23 
    3 import de.ugoe.cs.quest.plugin.mfc.eventcore.WindowTree; 
     4import de.ugoe.cs.quest.plugin.mfc.guimodel.WindowTree; 
    45 
    56/** 
    67 * <p> 
    7  * Message handler for {@code WM_CREATE} messages. The handler maintains the 
    8  * {@link WindowTree}. 
     8 * Message handler for {@code WM_CREATE} messages. The handler maintains the {@link WindowTree}. 
    99 * </p> 
    1010 *  
     
    1414public class HandlerCreate extends MessageHandler { 
    1515 
    16         /** 
    17          * <p> 
    18          * Constructor. Creates a new HandlerCreate. 
    19          * </p> 
    20          */ 
    21         public HandlerCreate() { 
    22                 super(); 
    23         } 
     16    /** 
     17     * <p> 
     18     * Constructor. Creates a new HandlerCreate. 
     19     * </p> 
     20     *  
     21     * @param windowTree the tree of GUI element specifications to be created and adapted during 
     22     *                   parsing 
     23     */ 
     24    public HandlerCreate(WindowTree windowTree) { 
     25        super(windowTree); 
     26    } 
    2427 
    25         /** 
    26         * <p> 
    27         * Name of the created window. 
    28         * </p> 
    29         */ 
    30         private String windowName; 
     28    /** 
     29    * <p> 
     30    * Name of the created window. 
     31    * </p> 
     32    */ 
     33    private String windowName; 
    3134 
    32         /** 
    33         * <p> 
    34         * HWND of the created window. 
    35         * </p> 
    36         */ 
    37         private int hwnd; 
     35    /** 
     36    * <p> 
     37    * HWND of the created window. 
     38    * </p> 
     39    */ 
     40    private long hwnd; 
    3841 
    39         /** 
    40         * <p> 
    41         * HWND of the created window's parent. 
    42         * </p> 
    43         */ 
    44         private int parentHwnd; 
     42    /** 
     43    * <p> 
     44    * HWND of the created window's parent. 
     45    * </p> 
     46    */ 
     47    private long parentHwnd; 
    4548 
    46         /** 
    47         * <p> 
    48         * Resource Id of the created window. 
    49         * </p> 
    50         */ 
    51         private int resourceId; 
     49    /** 
     50    * <p> 
     51    * Resource Id of the created window. 
     52    * </p> 
     53    */ 
     54    private int resourceId; 
    5255 
    53         /** 
    54         * <p> 
    55         * Window class of the created window. 
    56         * </p> 
    57         */ 
    58         private String className; 
     56    /** 
     57    * <p> 
     58    * Window class of the created window. 
     59    * </p> 
     60    */ 
     61    private String className; 
    5962 
    60         /** 
    61         * <p> 
    62         * Modality of the created window. 
    63         * </p> 
    64         */ 
    65         private boolean isModal; 
     63    /** 
     64    * <p> 
     65    * Modality of the created window. 
     66    * </p> 
     67    */ 
     68    private boolean isModal; 
    6669 
    67         /* 
    68          * (non-Javadoc) 
    69          *  
    70          * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onEndElement() 
    71          */ 
    72         @Override 
    73         public void onEndElement() { 
    74                 if (hwnd != 0) { 
    75                         WindowTree.getInstance().add(parentHwnd, hwnd, windowName, 
    76                                         resourceId, className, isModal); 
    77                 } 
    78         } 
     70    /* 
     71     * (non-Javadoc) 
     72     *  
     73     * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onEndElement() 
     74     */ 
     75    @Override 
     76    public void onEndElement() { 
     77        if (hwnd != 0) { 
     78            super.getWindowTree().add(parentHwnd, hwnd, windowName, resourceId, className, isModal); 
     79        } 
     80    } 
    7981 
    80         /* 
    81          * (non-Javadoc) 
    82          *  
    83          * @see 
    84          * de.ugoe.cs.quest.plugin.mfc.MessageHandler#onParameter(java.lang.String 
    85          * , java.lang.String) 
    86          */ 
    87         @Override 
    88         public void onParameter(String name, String value) { 
    89                 if (name.equals("window.hwnd")) { 
    90                         hwnd = Integer.parseInt(value); 
    91                 } else if (name.equals("window.name")) { 
    92                         windowName = value; 
    93                 } else if (name.equals("window.parent.hwnd")) { 
    94                         parentHwnd = Integer.parseInt(value); 
    95                 } else if (name.equals("window.resourceId")) { 
    96                         resourceId = Integer.parseInt(value); 
    97                 } else if (name.equals("window.class")) { 
    98                         if (value.startsWith("Afx:")) { 
    99                                 className = "Afx:"; 
    100                         } else { 
    101                                 className = value; 
    102                         } 
    103                 } else if (name.equals("window.ismodal")) { 
    104                         if (value.equals("true") || value.equals("1")) { 
    105                                 isModal = true; 
    106                         } 
    107                 } 
    108         } 
     82    /* 
     83     * (non-Javadoc) 
     84     *  
     85     * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onParameter(java.lang.String , 
     86     * java.lang.String) 
     87     */ 
     88    @Override 
     89    public void onParameter(String name, String value) { 
     90        if (name.equals("window.hwnd")) { 
     91            hwnd = Long.parseLong(value); 
     92        } 
     93        else if (name.equals("window.name")) { 
     94            windowName = value; 
     95        } 
     96        else if (name.equals("window.parent.hwnd")) { 
     97            parentHwnd = Long.parseLong(value); 
     98        } 
     99        else if (name.equals("window.resourceId")) { 
     100            resourceId = Integer.parseInt(value); 
     101        } 
     102        else if (name.equals("window.class")) { 
     103            if (value.startsWith("Afx:")) { 
     104                className = "Afx:"; 
     105            } 
     106            else { 
     107                className = value; 
     108            } 
     109        } 
     110        else if (name.equals("window.ismodal")) { 
     111            if (value.equals("true") || value.equals("1")) { 
     112                isModal = true; 
     113            } 
     114        } 
     115    } 
    109116 
    110         /* 
    111         * (non-Javadoc) 
    112         *  
    113         * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onStartElement() 
    114         */ 
    115         @Override 
    116         public void onStartElement() { 
    117                 windowName = ""; 
    118                 hwnd = 0; 
    119                 parentHwnd = 0; 
    120                 resourceId = 0; 
    121                 className = ""; 
    122                 isModal = false; 
    123         } 
     117    /* 
     118    * (non-Javadoc) 
     119    *  
     120    * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onStartElement() 
     121    */ 
     122    @Override 
     123    public void onStartElement() { 
     124        windowName = ""; 
     125        hwnd = 0; 
     126        parentHwnd = 0; 
     127        resourceId = 0; 
     128        className = ""; 
     129        isModal = false; 
     130    } 
    124131 
    125132} 
Note: See TracChangeset for help on using the changeset viewer.