- Timestamp:
- 09/20/12 10:36:09 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs/quest/plugin/jfc/eventcore/JFCEventId.java
r655 r835 1 1 2 package de.ugoe.cs.quest.plugin.jfc.eventcore; 2 3 … … 6 7 7 8 /** 8 * TODO comment 9 * <p> 10 * Enumeration to deal with JFC event ids. 11 * </p> 9 12 * 10 * @version $Revision: $ $Date: $11 * @author 2011, last modified by $Author: $13 * @version 1.0 14 * @author Patrick Harms 12 15 */ 13 16 public enum JFCEventId { 14 15 MOUSE_CLICKED(MouseEvent.MOUSE_CLICKED),16 MOUSE_PRESSED(MouseEvent.MOUSE_PRESSED),17 MOUSE_RELEASED(MouseEvent.MOUSE_RELEASED),18 MOUSE_MOVED(MouseEvent.MOUSE_MOVED),19 MOUSE_ENTERED(MouseEvent.MOUSE_ENTERED),20 MOUSE_EXITED(MouseEvent.MOUSE_EXITED),21 MOUSE_DRAGGED(MouseEvent.MOUSE_DRAGGED),22 MOUSE_WHEEL(MouseEvent.MOUSE_WHEEL),23 FOCUS_GAINED(FocusEvent.FOCUS_GAINED),24 FOCUS_LOST(FocusEvent.FOCUS_LOST),25 KEY_TYPED(KeyEvent.KEY_TYPED),26 KEY_PRESSED(KeyEvent.KEY_PRESSED),27 KEY_RELEASED(KeyEvent.KEY_RELEASED);28 17 29 /** the numerical representation of the event type */ 18 MOUSE_CLICKED(MouseEvent.MOUSE_CLICKED), MOUSE_PRESSED(MouseEvent.MOUSE_PRESSED), 19 MOUSE_RELEASED(MouseEvent.MOUSE_RELEASED), MOUSE_MOVED(MouseEvent.MOUSE_MOVED), MOUSE_ENTERED( 20 MouseEvent.MOUSE_ENTERED), MOUSE_EXITED(MouseEvent.MOUSE_EXITED), MOUSE_DRAGGED( 21 MouseEvent.MOUSE_DRAGGED), MOUSE_WHEEL(MouseEvent.MOUSE_WHEEL), FOCUS_GAINED( 22 FocusEvent.FOCUS_GAINED), FOCUS_LOST(FocusEvent.FOCUS_LOST), KEY_TYPED(KeyEvent.KEY_TYPED), 23 KEY_PRESSED(KeyEvent.KEY_PRESSED), KEY_RELEASED(KeyEvent.KEY_RELEASED); 24 25 /** 26 * <p> 27 * Numerical representation of the event type. 28 * </p> 29 */ 30 30 private int mNumber; 31 31 32 32 /** 33 * <p> 34 * Constructor. Creates a new JFCEventId. 35 * </p> 36 * 33 37 * @param number 38 * numerical representation of the event type. 34 39 */ 35 40 JFCEventId(int number) { … … 38 43 39 44 /** 40 * @return Returns the number. 45 * <p> 46 * Returns the numerical representation of the event type. 47 * </p> 48 * 49 * @return the numerical representation 41 50 */ 42 51 public int getNumber() { … … 45 54 46 55 /** 47 * 56 * <p> 57 * Parses an {@link String} and returns the respective JFCEventId if possible. 58 * </p> 59 * 60 * @param numberString 61 * String representation of the event type 62 * @return created JFCEventId 63 * @throws IllegalArgumentException 64 * thrown if there is no JFCEventId that correlates to numberString 48 65 */ 49 public static JFCEventId parseEventId(String numberString) {66 public static JFCEventId parseEventId(String numberString) throws IllegalArgumentException { 50 67 try { 51 68 int number = Integer.parseInt(numberString); … … 58 75 59 76 /** 60 * 77 * <p> 78 * Returns the JFCEventId associated with an integer. 79 * </p> 80 * 81 * @param number 82 * integer to which the according JFCEventId is returned 83 * @return the JFCEventId 84 * @throws IllegalArgumentException 85 * thrown if there is no JFCEventId that correlates to number 61 86 */ 62 public static JFCEventId valueOf(int number) {87 public static JFCEventId valueOf(int number) throws IllegalArgumentException { 63 88 for (JFCEventId type : JFCEventId.values()) { 64 89 if (type.mNumber == number) {
Note: See TracChangeset
for help on using the changeset viewer.