Changeset 780 for trunk/quest-core-events/src/main/java/de/ugoe
- Timestamp:
- 09/06/12 13:14:24 (12 years ago)
- Location:
- trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/IEventTarget.java
r681 r780 1 1 2 package de.ugoe.cs.quest.eventcore; 2 3 … … 4 5 5 6 /** 6 *7 7 * <p> 8 * TODO comment 8 * Common interface for event targets. An event target can, e.g., be an element of a GUI or Web 9 * server. A concrete event-driven software platform can define its event targets through the 10 * implementation of this interface. 9 11 * </p> 10 12 * 11 * @version $Revision: $ $Date: Aug 16, 2012$12 * @author 2012, last modified by $Author: sherbold$13 * @version 1.0 14 * @author Steffen Herbold 13 15 */ 14 16 public interface IEventTarget extends Serializable { 15 17 18 /** 19 * <p> 20 * Returns the name of event-driven software platform to which the target belongs. 21 * </p> 22 * 23 * @return name of the platform 24 */ 16 25 public String getPlatform(); 17 26 27 /** 28 * <p> 29 * Returns a string identifier of the target. This is very convenient for visualizations of 30 * events. 31 * </p> 32 * 33 * @return target identifier 34 */ 18 35 public String getStringIdentifier(); 19 36 } -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/IEventType.java
r543 r780 1 1 2 package de.ugoe.cs.quest.eventcore; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment 8 * Common interface for event types. An event type can be, e.g., a mouse click, a keyboard 9 * interactions in case of GUI platforms or a HTTP request in case of a Web application. 8 10 * </p> 9 11 * 10 * @version $Revision: $ $Date: Aug 16, 2012$11 * @author 2012, last modified by $Author: sherbold$12 * @version 1.0 13 * @author Steffen Herbold 12 14 */ 13 15 public interface IEventType extends Serializable { 14 16 15 17 /** 16 * @return 18 * <p> 19 * Returns the name of the event type. 20 * </p> 21 * 22 * @return name of the event type 17 23 */ 18 24 public String getName(); -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyInteractionSorter.java
r765 r780 14 14 15 15 /** 16 *17 16 * <p> 18 * TODO comment 17 * This class provides the functionality to sort and clean up all key interactions in a log. In 18 * particular: 19 * <ol> 20 * <li>In case a combination key (e.g., shift, alt, control) is held down, multiple 21 * {@link KeyPressed} events are logged, even though only the first one is of importance. This class 22 * removes all {@link KeyPressed} events for combination keys except the first.</li> 23 * <li>In case a normal key is held down, multiple {@link KeyPressed} events are logged, but there 24 * is only one {@link KeyReleased} event. This class adds a {@link KeyReleased} event for all such 25 * {@link KeyPressed} events.</li> 26 * <li>Due to message filtering of applications, it is possible that a {@link KeyReleased} event 27 * without a preceding {@link KeyPressed} event is logged. This class either adds the missing 28 * {@link KeyPressed} right in front of the {@link KeyReleased} or removes the {@link KeyReleased} 29 * depending on the {@link #mode}. 30 * <li>As a result of steps 2-3, we have always a matching {@link KeyPressed}/{@link KeyReleased} 31 * pairs for all normal keys. This class replaces these pairs with a {@link KeyTyped} event at the 32 * position of the {@link KeyPressed} event.</li> 33 * <li>Sometimes combination keys are not released in the same order they have been pressed. This 34 * class ensures that the {@link KeyReleased} are in the opposite order of the {@link KeyPressed} 35 * events for all combination keys.</li> 36 * </ol> 19 37 * </p> 20 38 * 21 * @version $Revision: $ $Date: Sep 4, 2012$22 * @author 2012, last modified by $Author: sherbold$39 * @version 1.0 40 * @author Steffen Herbold 23 41 */ 24 42 public class KeyInteractionSorter { … … 29 47 * </p> 30 48 * 31 * @version $Revision: $ $Date: Sep 3, 2012$32 * @author 2012, last modified by $Author: sherbold$49 * @version 1.0 50 * @author Steffen Herbold 33 51 */ 34 52 public static enum CleanupMode { 35 REMOVAL, ADDITION 53 /** 54 * <p> 55 * Single {@link KeyReleased} are removed from the sequence. 56 * </p> 57 */ 58 REMOVAL, 59 60 /** 61 * <p> 62 * {@link KeyPressed} events are added to single {@link KeyReleased} events 63 * </p> 64 */ 65 ADDITION 36 66 }; 37 67 68 /** 69 * <p> 70 * 71 * </p> 72 */ 38 73 private final CleanupMode mode; 39 74 75 /** 76 * <p> 77 * Constructor. Creates a new {@link KeyInteractionSorter} with {@link #mode}= 78 * {@link CleanupMode#ADDITION}. 79 * </p> 80 */ 40 81 public KeyInteractionSorter() { 41 82 this(CleanupMode.ADDITION); 42 83 } 43 84 85 /** 86 * <p> 87 * Constructor. Creates a new {@link KeyInteractionSorter}. 88 * </p> 89 * 90 * @param mode 91 * {@link #mode} of the instance 92 */ 44 93 public KeyInteractionSorter(CleanupMode mode) { 45 94 this.mode = mode; 46 95 } 47 96 97 /** 98 * <p> 99 * Sorts and cleans up key interactions according to the class specification (@see 100 * {@link KeyInteractionSorter} class comment). 101 * </p> 102 * <p> 103 * This method returns a sorted copy of a sequence, the sequence itself is not changed. 104 * </p> 105 * 106 * @param sequence 107 * sequence which is sorted 108 * @return sorted copy of sequence 109 */ 48 110 public List<Event> sortKeyInteractions(final List<Event> sequence) { 49 111 List<Event> sortedSequence = new LinkedList<Event>(sequence); … … 55 117 } 56 118 119 /** 120 * <p> 121 * Performs tasks 1-4 defined in the class description. Operations are performed in-place on the 122 * passed sequence. 123 * </p> 124 * 125 * @param sequence 126 * sequence which is sorted 127 */ 57 128 private void sortCombinationKeyPairs(List<Event> sequence) { 58 129 LinkedList<VirtualKey> pressedCombinationKeys = new LinkedList<VirtualKey>(); … … 99 170 } 100 171 172 /** 173 * <p> 174 * Performs task 5 defined in the class description. Operations are performed in-place on the 175 * passed sequence. 176 * </p> 177 * 178 * @param sequence 179 * sequence which is sorted 180 */ 101 181 private void handleIncompleteKeyPairs(List<Event> sequence) { 102 182 Set<VirtualKey> pressedKeys = new HashSet<VirtualKey>();
Note: See TracChangeset
for help on using the changeset viewer.