Ignore:
Timestamp:
09/20/12 12:03:03 (12 years ago)
Author:
sherbold
Message:
  • code documentation and clean-up
Location:
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore
Files:
1 deleted
5 edited

Legend:

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

    r655 r837  
     1 
    12package de.ugoe.cs.quest.plugin.mfc.eventcore; 
    23 
     
    45 
    56import de.ugoe.cs.quest.eventcore.IEventType; 
     7import de.ugoe.cs.quest.eventcore.gui.IInteraction; 
    68import de.ugoe.cs.quest.eventcore.gui.KeyPressed; 
    79import de.ugoe.cs.quest.eventcore.gui.KeyReleased; 
     
    1416/** 
    1517 * <p> 
    16  * TODO comment 
     18 * Creates the GUI event types (i.e., {@link IInteraction}s) for MFC events. 
    1719 * </p> 
    1820 *  
    19  * @version $Revision: $ $Date: 21.08.2012$ 
    20  * @author 2012, last modified by $Author: pharms$ 
     21 * @version 1.0 
     22 * @author Patrick Harms 
    2123 */ 
    2224public class MFCEventTypeFactory { 
    23      
     25 
    2426    /** 
    2527     * <p> 
    26      * the instance of the singleton 
     28     * Instance of the singleton 
    2729     * </p> 
    2830     */ 
     
    3133    /** 
    3234     * <p> 
    33      * TODO: comment 
     35     * Constructor. Creates a new MFCEventTypeFactory. Private to preserve singleton property. 
    3436     * </p> 
    35      * 
     37     *  
    3638     */ 
    37     private MFCEventTypeFactory() { 
    38         // prevent external instantiation 
    39     } 
     39    private MFCEventTypeFactory() {} 
    4040 
    4141    /** 
    4242     * <p> 
    43      * TODO: comment 
     43     * Returns the instance of the MFCEventTypeFactory. 
    4444     * </p> 
    45      * 
    46      * @return 
     45     *  
     46     * @return the instance 
    4747     */ 
    4848    public static MFCEventTypeFactory getInstance() { 
     
    5252    /** 
    5353     * <p> 
    54      * TODO: comment 
     54     * Returns the event type based on the name and parameters of a MFC event. 
    5555     * </p> 
    56      * 
    57      * @param currentRuleName 
    58      * @return 
     56     *  
     57     * @param eventName 
     58     *            name of the MFC event 
     59     * @param messageParameters 
     60     *            parameters of the MFC event 
     61     * @return the event type 
    5962     */ 
    60     public IEventType getEventType(String              eventName, 
    61                                    Map<String, String> messageParameters) 
    62     { 
     63    public IEventType getEventType(String eventName, Map<String, String> messageParameters) { 
    6364        if ("LeftClickButton".equals(eventName)) { 
    6465            return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     
    136137 
    137138    /** 
    138      * @param message 
    139      * @return 
     139     * <p> 
     140     * If the message parameters contain information about a key that has been pressed, the 
     141     * associated {@link VirtualKey} is returned. 
     142     * </p> 
     143     *  
     144     * @param messageParameters 
     145     *            the message parameters 
     146     * @return key extracted from the message parameters 
     147     * @throws IllegalArgumentException 
     148     *             thrown if the messageParameters do not contain information about a key 
    140149     */ 
    141     private VirtualKey getKey(Map<String, String> messageParameters) { 
     150    private VirtualKey getKey(Map<String, String> messageParameters) 
     151        throws IllegalArgumentException 
     152    { 
    142153        String value = null; 
    143          
     154 
    144155        if (messageParameters != null) { 
    145156            value = messageParameters.get("key"); 
    146157        } 
    147          
     158 
    148159        if (value == null) { 
    149160            throw new IllegalArgumentException 
     
    157168    /** 
    158169     * <p> 
    159      * TODO: comment 
     170     * If the message parameters contain information about a scroll position, the respective 
     171     * position is returned. 
    160172     * </p> 
    161      * 
     173     *  
    162174     * @param messageParameters 
    163      * @return 
     175     *            the message parameters 
     176     * @return the scroll position 
     177     * @throws IllegalArgumentException 
     178     *             thrown if the messageParameters do not contain information about a scroll 
     179     *             position 
    164180     */ 
    165     private int getSelectedValue(Map<String, String> messageParameters) { 
     181    private int getSelectedValue(Map<String, String> messageParameters) 
     182        throws IllegalArgumentException 
     183    { 
    166184        String value = null; 
    167          
     185 
    168186        if (messageParameters != null) { 
    169187            value = messageParameters.get("scrollPos"); 
    170188        } 
    171          
     189 
    172190        if (value == null) { 
    173191            throw new IllegalArgumentException 
  • trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/ReplayWindowsMessage.java

    r655 r837  
    200200    /** 
    201201     * <p> 
    202      * TODO: comment 
     202     * Sets the XML target string. 
    203203     * </p> 
    204204     * 
    205      * @param termValue 
     205     * @param targetXML the target string 
    206206     */ 
    207207    public void setTargetXML(String targetXML) { 
  • trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsMessage.java

    r774 r837  
     1 
    12package de.ugoe.cs.quest.plugin.mfc.eventcore; 
    23 
     
    1718 *  
    1819 */ 
    19 public class WindowsMessage  implements Serializable { 
     20public class WindowsMessage implements Serializable { 
    2021 
    2122    /** 
     
    7677     * @param type 
    7778     *            type of the message 
    78      * @param currentMessageParameters  
    79      * @param target  
    80      */ 
    81     public WindowsMessage(WindowsMessageType  type, 
    82                           MFCGUIElement       target, 
     79     * @param currentMessageParameters 
     80     * @param target 
     81     */ 
     82    public WindowsMessage(WindowsMessageType type, 
     83                          MFCGUIElement target, 
    8384                          Map<String, Object> messageParameters) 
    8485    { 
    8586        this.type = type; 
    8687        setTarget(target); 
    87          
     88 
    8889        for (Map.Entry<String, Object> entry : messageParameters.entrySet()) { 
    8990            addParameter(entry.getKey(), entry.getValue()); 
     
    99100     *            type of the message 
    100101     */ 
    101     public WindowsMessage(WindowsMessageType type) 
    102     { 
     102    public WindowsMessage(WindowsMessageType type) { 
    103103        this.type = type; 
    104104    } 
     
    137137    /** 
    138138     * <p> 
    139      * TODO: comment 
    140      * </p> 
    141      * 
    142      * @param target2 
     139     * Sets the message target. 
     140     * </p> 
     141     *  
     142     * @param target 
     143     *            the target 
    143144     */ 
    144145    public void setTarget(MFCGUIElement target) { 
     
    149150    /** 
    150151     * <p> 
    151      * TODO: comment 
    152      * </p> 
    153      * 
    154      * @return 
     152     * Returns the target of the message. 
     153     * </p> 
     154     *  
     155     * @return the target 
    155156     */ 
    156157    public MFCGUIElement getTarget() { 
    157158        return target; 
    158159    } 
    159      
     160 
    160161    /** 
    161162     * <p> 
     
    189190            isEqual = 
    190191                ((WindowsMessage) other).type == this.type && 
    191                 ((WindowsMessage) other).target.equals(this.target) && 
    192                 ((WindowsMessage) other).params.equals(this.params); 
     192                    ((WindowsMessage) other).target.equals(this.target) && 
     193                    ((WindowsMessage) other).params.equals(this.params); 
    193194        } 
    194195        return isEqual; 
     
    259260    /** 
    260261     * <p> 
    261      * TODO: comment 
    262      * </p> 
    263      * 
    264      * @return 
     262     * Returns the parameters associated with this message. 
     263     * </p> 
     264     *  
     265     * @return the parameters 
    265266     */ 
    266267    protected Map<String, Object> getParameters() { 
     
    270271    /** 
    271272     * <p> 
    272      * TODO: comment 
    273      * </p> 
    274      * 
    275      * @return 
     273     * Returns the XML target description of this message. 
     274     * </p> 
     275     *  
     276     * @return the XML target description 
    276277     */ 
    277278    public String getTargetXML() { 
  • trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsMessageType.java

    r655 r837  
     1 
    12package de.ugoe.cs.quest.plugin.mfc.eventcore; 
    23 
    34/** 
    4  * TODO comment 
     5 * <p> 
     6 * Enumeration to deal with MFC message types. 
     7 * </p> 
    58 *  
    6  * @version $Revision: $ $Date: $ 
    7  * @author 2011, last modified by $Author: $ 
     9 * @version 1.0 
     10 * @author Patrick Harms, Steffen Herbold 
    811 */ 
    912public enum WindowsMessageType { 
    10      
    11     WM_NULL(0), 
    12     WM_CREATE(1), 
    13     WM_DESTROY(2), 
    14     WM_MOVE(3), 
    15     WM_SIZE(5), 
    16     WM_ACTIVATE(6), 
    17     WM_SETFOCUS(7), 
    18     WM_KILLFOCUS(8), 
    19     WM_ENABLE(10), 
    20     WM_SETREDRAW(11), 
    21     WM_SETTEXT(12), 
    22     WM_GETTEXT(13), 
    23     WM_GETTEXTLENGTH(14), 
    24     WM_PAINT(15), 
    25     WM_CLOSE(16), 
    26     WM_QUERYENDSESSION(17), 
    27     WM_QUIT(18), 
    28     WM_QUERYOPEN(19), 
    29     WM_ERASEBKGND(20), 
    30     WM_SYSCOLORCHANGE(21), 
    31     WM_ENDSESSION(22), 
    32     WM_SHOWWINDOW(24), 
    33     WM_CTLCOLOR(25), 
    34     WM_WININICHANGE(26), 
    35     WM_DEVMODECHANGE(27), 
    36     WM_ACTIVATEAPP(28), 
    37     WM_FONTCHANGE(29), 
    38     WM_TIMECHANGE(30), 
    39     WM_CANCELMODE(31), 
    40     WM_SETCURSOR(32), 
    41     WM_MOUSEACTIVATE(33), 
    42     WM_CHILDACTIVATE(34), 
    43     WM_QUEUESYNC(35), 
    44     WM_GETMINMAXINFO(36), 
    45     WM_PAINTICON(38), 
    46     WM_ICONERASEBKGND(39), 
    47     WM_NEXTDLGCTL(40), 
    48     WM_SPOOLERSTATUS(42), 
    49     WM_DRAWITEM(43), 
    50     WM_MEASUREITEM(44), 
    51     WM_DELETEITEM(45), 
    52     WM_VKEYTOITEM(46), 
    53     WM_CHARTOITEM(47), 
    54     WM_SETFONT(48), 
    55     WM_GETFONT(49), 
    56     WM_SETHOTKEY(50), 
    57     WM_GETHOTKEY(51), 
    58     WM_QUERYDRAGICON(55), 
    59     WM_COMPAREITEM(57), 
    60     WM_GETOBJECT(61), 
    61     WM_COMPACTING(65), 
    62     WM_COMMNOTIFY(68), 
    63     WM_WINDOWPOSCHANGING(70), 
    64     WM_WINDOWPOSCHANGED(71), 
    65     WM_POWER(72), 
    66     WM_COPYDATA(74), 
    67     WM_CANCELJOURNAL(75), 
    68     WM_NOTIFY(78), 
    69     WM_INPUTLANGCHANGEREQUEST(80), 
    70     WM_INPUTLANGCHANGE(81), 
    71     WM_TCARD(82), 
    72     WM_HELP(83), 
    73     WM_USERCHANGED(84), 
    74     WM_NOTIFYFORMAT(85), 
    75     WM_CONTEXTMENU(123), 
    76     WM_STYLECHANGING(124), 
    77     WM_STYLECHANGED(125), 
    78     WM_DISPLAYCHANGE(126), 
    79     WM_GETICON(127), 
    80     WM_SETICON(128), 
    81     WM_NCCREATE(129), 
    82     WM_NCDESTROY(130), 
    83     WM_NCCALCSIZE(131), 
    84     WM_NCHITTEST(132), 
    85     WM_NCPAINT(133), 
    86     WM_NCACTIVATE(134), 
    87     WM_GETDLGCODE(135), 
    88     WM_SYNCPAINT(136), 
    89     WM_NCMOUSEMOVE(160), 
    90     WM_NCLBUTTONDOWN(161), 
    91     WM_NCLBUTTONUP(162), 
    92     WM_NCLBUTTONDBLCLK(163), 
    93     WM_NCRBUTTONDOWN(164), 
    94     WM_NCRBUTTONUP(165), 
    95     WM_NCRBUTTONDBLCLK(166), 
    96     WM_NCMBUTTONDOWN(167), 
    97     WM_NCMBUTTONUP(168), 
    98     WM_NCMBUTTONDBLCLK(169), 
    99     WM_NCXBUTTONDOWN(171), 
    100     WM_NCXBUTTONUP(172), 
    101     WM_NCXBUTTONDBLCLK(173), 
    102     SBM_SETPOS(224), 
    103     BM_CLICK(245), 
    104     WM_INPUT(255), 
    105     WM_KEYDOWN(256), 
    106     WM_KEYFIRST(256), 
    107     WM_KEYUP(257), 
    108     WM_CHAR(258), 
    109     WM_DEADCHAR(259), 
    110     WM_SYSKEYDOWN(260), 
    111     WM_SYSKEYUP(261), 
    112     WM_SYSCHAR(262), 
    113     WM_SYSDEADCHAR(263), 
    114     WM_KEYLAST(264), 
    115     WM_WNT_CONVERTREQUESTEX(265), 
    116     WM_CONVERTREQUEST(266), 
    117     WM_CONVERTRESULT(267), 
    118     WM_INTERIM(268), 
    119     WM_IME_STARTCOMPOSITION(269), 
    120     WM_IME_ENDCOMPOSITION(270), 
    121     WM_IME_COMPOSITION(271), 
    122     WM_IME_KEYLAST(271), 
    123     WM_INITDIALOG(272), 
    124     WM_COMMAND(273), 
    125     WM_SYSCOMMAND(274), 
    126     WM_TIMER(275), 
    127     WM_HSCROLL(276), 
    128     WM_VSCROLL(277), 
    129     WM_INITMENU(278), 
    130     WM_INITMENUPOPUP(279), 
    131     WM_MENUSELECT(287), 
    132     WM_MENUCHAR(288), 
    133     WM_ENTERIDLE(289), 
    134     WM_MENURBUTTONUP(290), 
    135     WM_MENUDRAG(291), 
    136     WM_MENUGETOBJECT(292), 
    137     WM_UNINTMENUPOPUP(293), 
    138     WM_MENUCOMMAND(294), 
    139     WM_CHANGEUISTATE(295), 
    140     WM_UPDATEUISTATE(296), 
    141     WM_QUERYUISTATE(297), 
    142     WM_CTLCOLORMSGBOX(306), 
    143     WM_CTLCOLOREDIT(307), 
    144     WM_CTLCOLORLISTBOX(308), 
    145     WM_CTLCOLORBTN(309), 
    146     WM_CTLCOLORDLG(310), 
    147     WM_CTLCOLORSCROLLBAR(311), 
    148     WM_CTLCOLORSTATIC(312), 
    149     CB_SHOWDROPDOWN(335), 
    150     LB_SETCURSEL(390), 
    151     WM_MOUSEFIRST(512), 
    152     WM_MOUSEMOVE(512), 
    153     WM_LBUTTONDOWN(513), 
    154     WM_LBUTTONUP(514), 
    155     WM_LBUTTONDBLCLK(515), 
    156     WM_RBUTTONDOWN(516), 
    157     WM_RBUTTONUP(517), 
    158     WM_RBUTTONDBLCLK(518), 
    159     WM_MBUTTONDOWN(519), 
    160     WM_MBUTTONUP(520), 
    161     WM_MBUTTONDBLCLK(521), 
    162     WM_MOUSELAST(521), 
    163     WM_MOUSEWHEEL(522), 
    164     WM_XBUTTONDOWN(523), 
    165     WM_XBUTTONUP(524), 
    166     WM_XBUTTONDBLCLK(525), 
    167     WM_USER(1024), 
    168     CB_SETCURSEL(334), 
    169     TBM_SETPOS(1029), 
    170     UDM_SETRANGE(1125), 
    171     TCM_SETCURSEL(4876); 
    172  
    173     /** the numerical representation of the message type */ 
     13 
     14    WM_NULL(0), WM_CREATE(1), WM_DESTROY(2), WM_MOVE(3), WM_SIZE(5), WM_ACTIVATE(6), 
     15    WM_SETFOCUS(7), WM_KILLFOCUS(8), WM_ENABLE(10), WM_SETREDRAW(11), WM_SETTEXT(12), 
     16    WM_GETTEXT(13), WM_GETTEXTLENGTH(14), WM_PAINT(15), WM_CLOSE(16), WM_QUERYENDSESSION(17), 
     17    WM_QUIT(18), WM_QUERYOPEN(19), WM_ERASEBKGND(20), WM_SYSCOLORCHANGE(21), WM_ENDSESSION(22), 
     18    WM_SHOWWINDOW(24), WM_CTLCOLOR(25), WM_WININICHANGE(26), WM_DEVMODECHANGE(27), WM_ACTIVATEAPP( 
     19        28), WM_FONTCHANGE(29), WM_TIMECHANGE(30), WM_CANCELMODE(31), WM_SETCURSOR(32), 
     20    WM_MOUSEACTIVATE(33), WM_CHILDACTIVATE(34), WM_QUEUESYNC(35), WM_GETMINMAXINFO(36), 
     21    WM_PAINTICON(38), WM_ICONERASEBKGND(39), WM_NEXTDLGCTL(40), WM_SPOOLERSTATUS(42), WM_DRAWITEM( 
     22        43), WM_MEASUREITEM(44), WM_DELETEITEM(45), WM_VKEYTOITEM(46), WM_CHARTOITEM(47), 
     23    WM_SETFONT(48), WM_GETFONT(49), WM_SETHOTKEY(50), WM_GETHOTKEY(51), WM_QUERYDRAGICON(55), 
     24    WM_COMPAREITEM(57), WM_GETOBJECT(61), WM_COMPACTING(65), WM_COMMNOTIFY(68), 
     25    WM_WINDOWPOSCHANGING(70), WM_WINDOWPOSCHANGED(71), WM_POWER(72), WM_COPYDATA(74), 
     26    WM_CANCELJOURNAL(75), WM_NOTIFY(78), WM_INPUTLANGCHANGEREQUEST(80), WM_INPUTLANGCHANGE(81), 
     27    WM_TCARD(82), WM_HELP(83), WM_USERCHANGED(84), WM_NOTIFYFORMAT(85), WM_CONTEXTMENU(123), 
     28    WM_STYLECHANGING(124), WM_STYLECHANGED(125), WM_DISPLAYCHANGE(126), WM_GETICON(127), 
     29    WM_SETICON(128), WM_NCCREATE(129), WM_NCDESTROY(130), WM_NCCALCSIZE(131), WM_NCHITTEST(132), 
     30    WM_NCPAINT(133), WM_NCACTIVATE(134), WM_GETDLGCODE(135), WM_SYNCPAINT(136), 
     31    WM_NCMOUSEMOVE(160), WM_NCLBUTTONDOWN(161), WM_NCLBUTTONUP(162), WM_NCLBUTTONDBLCLK(163), 
     32    WM_NCRBUTTONDOWN(164), WM_NCRBUTTONUP(165), WM_NCRBUTTONDBLCLK(166), WM_NCMBUTTONDOWN(167), 
     33    WM_NCMBUTTONUP(168), WM_NCMBUTTONDBLCLK(169), WM_NCXBUTTONDOWN(171), WM_NCXBUTTONUP(172), 
     34    WM_NCXBUTTONDBLCLK(173), SBM_SETPOS(224), BM_CLICK(245), WM_INPUT(255), WM_KEYDOWN(256), 
     35    WM_KEYFIRST(256), WM_KEYUP(257), WM_CHAR(258), WM_DEADCHAR(259), WM_SYSKEYDOWN(260), 
     36    WM_SYSKEYUP(261), WM_SYSCHAR(262), WM_SYSDEADCHAR(263), WM_KEYLAST(264), 
     37    WM_WNT_CONVERTREQUESTEX(265), WM_CONVERTREQUEST(266), WM_CONVERTRESULT(267), WM_INTERIM(268), 
     38    WM_IME_STARTCOMPOSITION(269), WM_IME_ENDCOMPOSITION(270), WM_IME_COMPOSITION(271), 
     39    WM_IME_KEYLAST(271), WM_INITDIALOG(272), WM_COMMAND(273), WM_SYSCOMMAND(274), WM_TIMER(275), 
     40    WM_HSCROLL(276), WM_VSCROLL(277), WM_INITMENU(278), WM_INITMENUPOPUP(279), WM_MENUSELECT(287), 
     41    WM_MENUCHAR(288), WM_ENTERIDLE(289), WM_MENURBUTTONUP(290), WM_MENUDRAG(291), WM_MENUGETOBJECT( 
     42        292), WM_UNINTMENUPOPUP(293), WM_MENUCOMMAND(294), WM_CHANGEUISTATE(295), WM_UPDATEUISTATE( 
     43        296), WM_QUERYUISTATE(297), WM_CTLCOLORMSGBOX(306), WM_CTLCOLOREDIT(307), 
     44    WM_CTLCOLORLISTBOX(308), WM_CTLCOLORBTN(309), WM_CTLCOLORDLG(310), WM_CTLCOLORSCROLLBAR(311), 
     45    WM_CTLCOLORSTATIC(312), CB_SHOWDROPDOWN(335), LB_SETCURSEL(390), WM_MOUSEFIRST(512), 
     46    WM_MOUSEMOVE(512), WM_LBUTTONDOWN(513), WM_LBUTTONUP(514), WM_LBUTTONDBLCLK(515), 
     47    WM_RBUTTONDOWN(516), WM_RBUTTONUP(517), WM_RBUTTONDBLCLK(518), WM_MBUTTONDOWN(519), 
     48    WM_MBUTTONUP(520), WM_MBUTTONDBLCLK(521), WM_MOUSELAST(521), WM_MOUSEWHEEL(522), 
     49    WM_XBUTTONDOWN(523), WM_XBUTTONUP(524), WM_XBUTTONDBLCLK(525), WM_USER(1024), 
     50    CB_SETCURSEL(334), TBM_SETPOS(1029), UDM_SETRANGE(1125), TCM_SETCURSEL(4876); 
     51 
     52    /** 
     53     * <p> 
     54     * Numerical representation of the message type. 
     55     * </p> 
     56     */ 
    17457    private int mNumber; 
    17558 
    17659    /** 
     60     * <p> 
     61     * Constructor. Creates a new WindowsMessageType. 
     62     * </p> 
     63     *  
    17764     * @param number 
     65     *            numerical representation of the message type 
    17866     */ 
    17967    WindowsMessageType(int number) { 
     
    18270 
    18371    /** 
    184      * @return Returns the number. 
     72     * <p> 
     73     * Returns the numerical representation of the message type. 
     74     * </p> 
     75     *  
     76     * @return the numerical representation 
    18577     */ 
    18678    public int getNumber() { 
     
    301193 
    302194    /** 
    303      * 
    304      */ 
    305     public static WindowsMessageType parseMessageType(String numberString) { 
     195     * <p> 
     196     * Parses an {@link String} and returns the respective WindowsMessageType if possible. 
     197     * </p> 
     198     *  
     199     * @param numberString 
     200     *            String representation of the event type 
     201     * @return created WindowsMessageType 
     202     * @throws IllegalArgumentException 
     203     *             thrown if there is no WindowsMessageType that correlates to numberString 
     204     */ 
     205    public static WindowsMessageType parseMessageType(String numberString) 
     206        throws IllegalArgumentException 
     207    { 
    306208        try { 
    307209            int number = Integer.parseInt(numberString); 
     
    314216 
    315217    /** 
    316      * 
    317      */ 
    318     public static WindowsMessageType valueOf(int number) { 
     218     * <p> 
     219     * Returns the WindowsMessageType associated with an integer. 
     220     * </p> 
     221     *  
     222     * @param number 
     223     *            integer to which the according WindowsMessageType is returned 
     224     * @return the WindowsMessageType 
     225     * @throws IllegalArgumentException 
     226     *             thrown if there is no WindowsMessageType that correlates to number 
     227     */ 
     228    public static WindowsMessageType valueOf(int number) throws IllegalArgumentException { 
    319229        for (WindowsMessageType type : WindowsMessageType.values()) { 
    320230            if (type.mNumber == number) { 
  • trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsVirtualKey.java

    r655 r837  
    55 
    66/** 
    7  * TODO comment 
     7 * <p> 
     8 * Map of virtual keys for MFC. 
     9 * </p> 
    810 *  
    9  * @version $Revision: $ $Date: $ 
    10  * @author 2011, last modified by $Author: $ 
     11 * @version 1.0 
     12 * @author Patrick Harms 
    1113 */ 
    12 // ------------------------------------------------------------------------------------------------- 
    13  
    14 public enum WindowsVirtualKey 
    15 { 
     14public enum WindowsVirtualKey { 
    1615    // VK_LBUTTON (0x01, "Left mouse button"), 
    1716    // VK_RBUTTON (0x02, "Right mouse button"), 
     
    168167    // VK_OEM_CLEAR (0xFE, "Clear key"); 
    169168 
    170     /** the id of the virtual key */ 
     169    /** 
     170     * <p> 
     171     * Numerical representation of the virtual key. 
     172     * </p> 
     173     */ 
    171174    private int mNumber; 
    172175 
    173     /** the <code>Key</code> represented by this virtual key */ 
     176    /** 
     177     * <p> 
     178     * {@link VirtualKey} represented by this WindowsVirtualKey 
     179     * </p> 
     180     */ 
    174181    private VirtualKey mRepresentedKey; 
    175182 
    176     // ----------------------------------------------------------------------------------------------- 
    177     /** 
     183    /** 
     184     * <p> 
     185     * Constructor. Creates a new WindowsVirtualKey. 
     186     * </p> 
     187     *  
    178188     * @param number 
    179      */ 
    180     // ----------------------------------------------------------------------------------------------- 
    181     WindowsVirtualKey(int number, VirtualKey representedKey) 
    182     { 
     189     *            numerical representation of the virtual key 
     190     * @param representedKey 
     191     *            virtual key that is represented 
     192     */ 
     193    WindowsVirtualKey(int number, VirtualKey representedKey) { 
    183194        mNumber = number; 
    184195        mRepresentedKey = representedKey; 
    185196    } 
    186197 
    187     // ----------------------------------------------------------------------------------------------- 
    188     /** 
    189      * @return Returns the number. 
    190      */ 
    191     // ----------------------------------------------------------------------------------------------- 
    192     int getNumber() 
    193     { 
     198    /** 
     199     * <p> 
     200     * Returns the numerical representation of the virtual key. 
     201     * </p> 
     202     *  
     203     * @return the numerical representation 
     204     */ 
     205    int getNumber() { 
    194206        return mNumber; 
    195207    } 
    196208 
    197     // ----------------------------------------------------------------------------------------------- 
    198     /** 
    199    * 
    200    */ 
    201     // ----------------------------------------------------------------------------------------------- 
    202     public static WindowsVirtualKey parseVirtualKey(String string) 
    203     { 
    204         for (WindowsVirtualKey virtualKey : WindowsVirtualKey.values()) 
    205         { 
    206             if (virtualKey.mNumber == Integer.parseInt(string)) 
    207             { 
     209    /** 
     210     * <p> 
     211     * Parses an {@link String} and returns the respective WindowsVirtualKey if possible. 
     212     * </p> 
     213     *  
     214     * @param string 
     215     *            String representation of the event type 
     216     * @return created WindowsVirtualKey 
     217     * @throws IllegalArgumentException 
     218     *             thrown if there is no WindowsVirtualKey that correlates to string 
     219     */ 
     220    public static WindowsVirtualKey parseVirtualKey(String string) throws IllegalArgumentException { 
     221        for (WindowsVirtualKey virtualKey : WindowsVirtualKey.values()) { 
     222            if (virtualKey.mNumber == Integer.parseInt(string)) { 
    208223                return virtualKey; 
    209224            } 
     
    213228    } 
    214229 
    215     // ----------------------------------------------------------------------------------------------- 
    216     /** 
    217    * 
    218    */ 
    219     // ----------------------------------------------------------------------------------------------- 
    220     public static WindowsVirtualKey valueOf(int number) 
    221     { 
    222         for (WindowsVirtualKey virtualKey : WindowsVirtualKey.values()) 
    223         { 
    224             if (virtualKey.mNumber == number) 
    225             { 
     230    /** 
     231     * <p> 
     232     * Returns the WindowsVirtualKey associated with an integer. 
     233     * </p> 
     234     *  
     235     * @param number 
     236     *            integer to which the according WindowsVirtualKey is returned 
     237     * @return the WindowsVirtualKey 
     238     * @throws IllegalArgumentException 
     239     *             thrown if there is no WindowsVirtualKey that correlates to number 
     240     */ 
     241    public static WindowsVirtualKey valueOf(int number) throws IllegalArgumentException { 
     242        for (WindowsVirtualKey virtualKey : WindowsVirtualKey.values()) { 
     243            if (virtualKey.mNumber == number) { 
    226244                return virtualKey; 
    227245            } 
     
    231249    } 
    232250 
    233     // ----------------------------------------------------------------------------------------------- 
    234     /** 
    235      * TODO: comment 
    236      *  
    237      * @return 
    238      */ 
    239     // ----------------------------------------------------------------------------------------------- 
    240     public VirtualKey getKey() 
    241     { 
     251    /** 
     252     * <p> 
     253     * Returns the {@link VirtualKey} associated with this WindowsVirtualKey. 
     254     * </p> 
     255     *  
     256     * @return the virtual key 
     257     */ 
     258    public VirtualKey getKey() { 
    242259        return mRepresentedKey; 
    243260    } 
Note: See TracChangeset for help on using the changeset viewer.