- Timestamp:
- 09/20/12 12:03:03 (12 years ago)
- 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 1 2 package de.ugoe.cs.quest.plugin.mfc.eventcore; 2 3 … … 4 5 5 6 import de.ugoe.cs.quest.eventcore.IEventType; 7 import de.ugoe.cs.quest.eventcore.gui.IInteraction; 6 8 import de.ugoe.cs.quest.eventcore.gui.KeyPressed; 7 9 import de.ugoe.cs.quest.eventcore.gui.KeyReleased; … … 14 16 /** 15 17 * <p> 16 * TODO comment18 * Creates the GUI event types (i.e., {@link IInteraction}s) for MFC events. 17 19 * </p> 18 20 * 19 * @version $Revision: $ $Date: 21.08.2012$20 * @author 2012, last modified by $Author: pharms$21 * @version 1.0 22 * @author Patrick Harms 21 23 */ 22 24 public class MFCEventTypeFactory { 23 25 24 26 /** 25 27 * <p> 26 * the instance of the singleton28 * Instance of the singleton 27 29 * </p> 28 30 */ … … 31 33 /** 32 34 * <p> 33 * TODO: comment35 * Constructor. Creates a new MFCEventTypeFactory. Private to preserve singleton property. 34 36 * </p> 35 * 37 * 36 38 */ 37 private MFCEventTypeFactory() { 38 // prevent external instantiation 39 } 39 private MFCEventTypeFactory() {} 40 40 41 41 /** 42 42 * <p> 43 * TODO: comment43 * Returns the instance of the MFCEventTypeFactory. 44 44 * </p> 45 * 46 * @return 45 * 46 * @return the instance 47 47 */ 48 48 public static MFCEventTypeFactory getInstance() { … … 52 52 /** 53 53 * <p> 54 * TODO: comment54 * Returns the event type based on the name and parameters of a MFC event. 55 55 * </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 59 62 */ 60 public IEventType getEventType(String eventName, 61 Map<String, String> messageParameters) 62 { 63 public IEventType getEventType(String eventName, Map<String, String> messageParameters) { 63 64 if ("LeftClickButton".equals(eventName)) { 64 65 return new MouseClick(MouseButtonInteraction.Button.LEFT); … … 136 137 137 138 /** 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 140 149 */ 141 private VirtualKey getKey(Map<String, String> messageParameters) { 150 private VirtualKey getKey(Map<String, String> messageParameters) 151 throws IllegalArgumentException 152 { 142 153 String value = null; 143 154 144 155 if (messageParameters != null) { 145 156 value = messageParameters.get("key"); 146 157 } 147 158 148 159 if (value == null) { 149 160 throw new IllegalArgumentException … … 157 168 /** 158 169 * <p> 159 * TODO: comment 170 * If the message parameters contain information about a scroll position, the respective 171 * position is returned. 160 172 * </p> 161 * 173 * 162 174 * @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 164 180 */ 165 private int getSelectedValue(Map<String, String> messageParameters) { 181 private int getSelectedValue(Map<String, String> messageParameters) 182 throws IllegalArgumentException 183 { 166 184 String value = null; 167 185 168 186 if (messageParameters != null) { 169 187 value = messageParameters.get("scrollPos"); 170 188 } 171 189 172 190 if (value == null) { 173 191 throw new IllegalArgumentException -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/ReplayWindowsMessage.java
r655 r837 200 200 /** 201 201 * <p> 202 * TODO: comment202 * Sets the XML target string. 203 203 * </p> 204 204 * 205 * @param t ermValue205 * @param targetXML the target string 206 206 */ 207 207 public void setTargetXML(String targetXML) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsMessage.java
r774 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.eventcore; 2 3 … … 17 18 * 18 19 */ 19 public class WindowsMessage 20 public class WindowsMessage implements Serializable { 20 21 21 22 /** … … 76 77 * @param type 77 78 * type of the message 78 * @param currentMessageParameters 79 * @param target 80 */ 81 public WindowsMessage(WindowsMessageType 82 MFCGUIElement 79 * @param currentMessageParameters 80 * @param target 81 */ 82 public WindowsMessage(WindowsMessageType type, 83 MFCGUIElement target, 83 84 Map<String, Object> messageParameters) 84 85 { 85 86 this.type = type; 86 87 setTarget(target); 87 88 88 89 for (Map.Entry<String, Object> entry : messageParameters.entrySet()) { 89 90 addParameter(entry.getKey(), entry.getValue()); … … 99 100 * type of the message 100 101 */ 101 public WindowsMessage(WindowsMessageType type) 102 { 102 public WindowsMessage(WindowsMessageType type) { 103 103 this.type = type; 104 104 } … … 137 137 /** 138 138 * <p> 139 * TODO: comment 140 * </p> 141 * 142 * @param target2 139 * Sets the message target. 140 * </p> 141 * 142 * @param target 143 * the target 143 144 */ 144 145 public void setTarget(MFCGUIElement target) { … … 149 150 /** 150 151 * <p> 151 * TODO: comment152 * </p> 153 * 154 * @return 152 * Returns the target of the message. 153 * </p> 154 * 155 * @return the target 155 156 */ 156 157 public MFCGUIElement getTarget() { 157 158 return target; 158 159 } 159 160 160 161 /** 161 162 * <p> … … 189 190 isEqual = 190 191 ((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); 193 194 } 194 195 return isEqual; … … 259 260 /** 260 261 * <p> 261 * TODO: comment262 * </p> 263 * 264 * @return 262 * Returns the parameters associated with this message. 263 * </p> 264 * 265 * @return the parameters 265 266 */ 266 267 protected Map<String, Object> getParameters() { … … 270 271 /** 271 272 * <p> 272 * TODO: comment273 * </p> 274 * 275 * @return 273 * Returns the XML target description of this message. 274 * </p> 275 * 276 * @return the XML target description 276 277 */ 277 278 public String getTargetXML() { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsMessageType.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.eventcore; 2 3 3 4 /** 4 * TODO comment 5 * <p> 6 * Enumeration to deal with MFC message types. 7 * </p> 5 8 * 6 * @version $Revision: $ $Date: $7 * @author 2011, last modified by $Author: $9 * @version 1.0 10 * @author Patrick Harms, Steffen Herbold 8 11 */ 9 12 public 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 */ 174 57 private int mNumber; 175 58 176 59 /** 60 * <p> 61 * Constructor. Creates a new WindowsMessageType. 62 * </p> 63 * 177 64 * @param number 65 * numerical representation of the message type 178 66 */ 179 67 WindowsMessageType(int number) { … … 182 70 183 71 /** 184 * @return Returns the number. 72 * <p> 73 * Returns the numerical representation of the message type. 74 * </p> 75 * 76 * @return the numerical representation 185 77 */ 186 78 public int getNumber() { … … 301 193 302 194 /** 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 { 306 208 try { 307 209 int number = Integer.parseInt(numberString); … … 314 216 315 217 /** 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 { 319 229 for (WindowsMessageType type : WindowsMessageType.values()) { 320 230 if (type.mNumber == number) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsVirtualKey.java
r655 r837 5 5 6 6 /** 7 * TODO comment 7 * <p> 8 * Map of virtual keys for MFC. 9 * </p> 8 10 * 9 * @version $Revision: $ $Date: $10 * @author 2011, last modified by $Author: $11 * @version 1.0 12 * @author Patrick Harms 11 13 */ 12 // ------------------------------------------------------------------------------------------------- 13 14 public enum WindowsVirtualKey 15 { 14 public enum WindowsVirtualKey { 16 15 // VK_LBUTTON (0x01, "Left mouse button"), 17 16 // VK_RBUTTON (0x02, "Right mouse button"), … … 168 167 // VK_OEM_CLEAR (0xFE, "Clear key"); 169 168 170 /** the id of the virtual key */ 169 /** 170 * <p> 171 * Numerical representation of the virtual key. 172 * </p> 173 */ 171 174 private int mNumber; 172 175 173 /** the <code>Key</code> represented by this virtual key */ 176 /** 177 * <p> 178 * {@link VirtualKey} represented by this WindowsVirtualKey 179 * </p> 180 */ 174 181 private VirtualKey mRepresentedKey; 175 182 176 // ----------------------------------------------------------------------------------------------- 177 /** 183 /** 184 * <p> 185 * Constructor. Creates a new WindowsVirtualKey. 186 * </p> 187 * 178 188 * @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) { 183 194 mNumber = number; 184 195 mRepresentedKey = representedKey; 185 196 } 186 197 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() { 194 206 return mNumber; 195 207 } 196 208 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)) { 208 223 return virtualKey; 209 224 } … … 213 228 } 214 229 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) { 226 244 return virtualKey; 227 245 } … … 231 249 } 232 250 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() { 242 259 return mRepresentedKey; 243 260 }
Note: See TracChangeset
for help on using the changeset viewer.