Changeset 837 for trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsVirtualKey.java
- Timestamp:
- 09/20/12 12:03:03 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.