Changeset 786
- Timestamp:
- 09/06/12 16:47:00 (12 years ago)
- Location:
- trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/IInteraction.java
r655 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 … … 5 6 /** 6 7 * <p> 7 * An interaction is a special event type which represents the interaction of a user with an 8 * elementof a GUI. An example is a mouse click on a button.8 * An interaction is a special event type which represents the interaction of a user with an element 9 * of a GUI. An example is a mouse click on a button. 9 10 * </p> 10 11 * 11 * @version $Revision: $ $Date: $12 * @author 2011, last modified by $Author: $12 * @version 1.0 13 * @author Patrick Harms 13 14 */ 14 public interface IInteraction extends IEventType 15 { 15 public interface IInteraction extends IEventType { 16 16 /** 17 * @return 17 * <p> 18 * Determines whether an event type starts a logical sequence, i.e., a task. 19 * </p> 20 * 21 * @return true if a logical sequence is started; false otherwise 18 22 */ 19 23 public boolean startsLogicalSequence(); 20 24 21 25 /** 22 * @return 26 * <p> 27 * Determines whether an event type finishes a logical sequence, i.e., a task. 28 * </p> 29 * 30 * @return true if a logical sequence is finished; false otherwise 23 31 */ 24 32 public boolean finishesLogicalSequence(); -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyInteraction.java
r655 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 … … 4 5 5 6 /** 6 * TODO comment 7 * <p> 8 * Base class for all keyboard interaction event types. 9 * </p> 7 10 * 8 * @version $Revision: $ $Date: $9 * @author 2011, last modified by $Author: $11 * @version 1.0 12 * @author Patrick Harms 10 13 */ 11 14 public abstract class KeyInteraction implements IInteraction { 12 15 13 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 14 21 private static final long serialVersionUID = 1L; 15 22 16 /** the key, that was actually pressed */ 23 /** 24 * <p> 25 * the key associated with the interaction 26 * </p> 27 */ 17 28 private VirtualKey key; 18 29 19 30 /** 31 * <p> 32 * Constructor. Creates a new KeyInteraction. 33 * </p> 34 * 20 35 * @param key 36 * key associated with the interaction 21 37 */ 22 38 public KeyInteraction(VirtualKey key) { … … 26 42 27 43 /** 44 * <p> 45 * Returns the key associated with the interaction. 46 * </p> 28 47 * 48 * @return the key 29 49 */ 30 50 public VirtualKey getKey() { -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyPressed.java
r655 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 … … 4 5 5 6 /** 6 * TODO comment 7 * <p> 8 * Event type for pressing down a key. 9 * </p> 7 10 * 8 * @version $Revision: $ $Date: $9 * @author 2011, last modified by $Author: $11 * @version 1.0 12 * @author Patrick Harms 10 13 */ 11 14 public class KeyPressed extends KeyInteraction { 12 15 13 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 14 21 private static final long serialVersionUID = 1L; 15 22 16 23 /** 17 * @param key 24 * <p> 25 * Constructor. Creates a new {@link KeyPressed} event type. 26 * </p> 27 * 28 * @see KeyInteraction#KeyInteraction(VirtualKey) 18 29 */ 19 30 public KeyPressed(VirtualKey key) { … … 74 85 } 75 86 76 /* (non-Javadoc) 87 /* 88 * (non-Javadoc) 89 * 77 90 * @see java.lang.Object#hashCode() 78 91 */ -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyReleased.java
r655 r786 4 4 5 5 /** 6 * TODO comment 6 * <p> 7 * Event type for releasing a key. 8 * </p> 7 9 * 8 * @version $Revision: $ $Date: $9 * @author 2011, last modified by $Author: $10 * @version 1.0 11 * @author Steffen Herbold 10 12 */ 11 13 public class KeyReleased extends KeyInteraction { 12 14 13 /** */ 15 /** 16 * <p> 17 * Id for object serialization. 18 * </p> 19 */ 14 20 private static final long serialVersionUID = 1L; 15 21 16 22 /** 17 * @param key 23 * <p> 24 * Constructor. Creates a new {@link KeyReleased} event type. 25 * </p> 26 * 27 * @see KeyInteraction#KeyInteraction(VirtualKey) 18 28 */ 19 29 public KeyReleased(VirtualKey key) { -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyTyped.java
r765 r786 4 4 import de.ugoe.cs.tasktree.keyboardmaps.VirtualKey; 5 5 6 /** 7 * <p> 8 * Event type for typing a key, i.e., pressing and releasing it right away. 9 * </p> 10 * 11 * @version 1.0 12 * @author Steffen Herbold 13 */ 6 14 public class KeyTyped extends KeyInteraction { 7 15 8 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 9 21 private static final long serialVersionUID = 1L; 10 22 11 23 /** 12 * @param key 24 * <p> 25 * Constructor. Creates a new {@link KeyTyped} event type. 26 * </p> 27 * 28 * @see KeyInteraction#KeyInteraction(VirtualKey) 13 29 */ 14 30 public KeyTyped(VirtualKey key) { … … 51 67 */ 52 68 public boolean finishesLogicalSequence() { 53 return false; 69 // TODO handle lock keys correctly 70 return super.getKey().isCombinationKey(); 54 71 } 55 72 -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyboardFocusChange.java
r681 r786 3 3 4 4 /** 5 * TODO comment 5 * <p> 6 * Event type for keyboard focus changes. The target of the respective event has obtained the 7 * keyboard focus of the application. 8 * </p> 6 9 * 7 * @version $Revision: $ $Date: $8 * @author 2011, last modified by $Author: $10 * @version 1.0 11 * @author Patrick Harms 9 12 */ 10 13 public class KeyboardFocusChange implements IInteraction { 11 14 12 /** */ 15 /** 16 * <p> 17 * Id for object serialization. 18 * </p> 19 */ 13 20 private static final long serialVersionUID = 1L; 14 21 -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseButtonDown.java
r681 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 3 4 /** 4 * TODO comment 5 * <p> 6 * Event type for pressing a mouse button. 7 * </p> 5 8 * 6 * @version $Revision: $ $Date: $7 * @author 2011, last modified by $Author: $9 * @version 1.0 10 * @author Patrick Harms 8 11 */ 9 12 public class MouseButtonDown extends MouseButtonInteraction { 10 13 11 /** */ 14 /** 15 * <p> 16 * Id for object serialization. 17 * </p> 18 */ 12 19 private static final long serialVersionUID = 1L; 13 20 14 21 /** 15 * @param button 22 * <p> 23 * Constructor. Creates a new {@link MouseButtonDown} event type. 24 * </p> 25 * 26 * @see MouseButtonInteraction#MouseButtonInteraction(Button) 16 27 */ 17 28 public MouseButtonDown(Button button) { … … 77 88 return false; 78 89 } 79 90 80 91 /* 81 92 * (non-Javadoc) -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseButtonInteraction.java
r681 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 3 4 /** 4 * TODO comment 5 * <p> 6 * Base class for all mouse interaction event types. 7 * </p> 5 8 * 6 * @version $Revision: $ $Date: $7 * @author 2011, last modified by $Author: $9 * @version 1.0 10 * @author Patrick Harms 8 11 */ 9 12 public abstract class MouseButtonInteraction extends MouseInteraction { 10 13 11 /** */ 14 /** 15 * <p> 16 * Id for object serialization. 17 * </p> 18 */ 12 19 private static final long serialVersionUID = 1L; 13 20 14 /** */ 21 /** 22 * <p> 23 * Describes the pressed mouse button. 24 * </p> 25 * 26 * @version 1.0 27 * @author Patrick Harms 28 */ 15 29 public static enum Button { 16 30 LEFT, MIDDLE, RIGHT, X; 17 31 } 18 32 19 /** the button used for mouse interaction */ 33 /** 34 * <p> 35 * The button used for mouse interaction 36 * </p> 37 */ 20 38 private Button button; 21 39 22 40 /** 41 * <p> 42 * Constructor. Creates a new {@link MouseButtonInteraction} 43 * </p> 23 44 * 45 * @param button 46 * the button associated with the interaction 24 47 */ 25 48 public MouseButtonInteraction(Button button) { … … 28 51 29 52 /** 30 * @return Returns the button. 53 * <p> 54 * Returns the button associated with the interaction. 55 * </p> 56 * 57 * @return the button 31 58 */ 32 59 public Button getButton() { 33 60 return button; 34 61 } 35 62 36 63 /* 37 64 * (non-Javadoc) -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseButtonUp.java
r681 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 3 4 /** 4 * TODO comment 5 * <p> 6 * Event type for releasing a mouse button. 7 * </p> 5 8 * 6 * @version $Revision: $ $Date: $7 * @author 2011, last modified by $Author: $9 * @version 1.0 10 * @author Patrick Harms 8 11 */ 9 12 public class MouseButtonUp extends MouseButtonInteraction { 10 13 11 /** */ 14 /** 15 * <p> 16 * Id for object serialization. 17 * </p> 18 */ 12 19 private static final long serialVersionUID = 1L; 13 20 14 21 /** 15 * @param button 22 * <p> 23 * Constructor. Creates a new {@link MouseButtonUp} event type. 24 * </p> 25 * 26 * @see MouseButtonInteraction#MouseButtonInteraction(Button) 16 27 */ 17 28 public MouseButtonUp(Button button) { -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseClick.java
r681 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 3 4 /** 4 * TODO comment 5 * <p> 6 * Event type for a mouse click, i.e., pressing and releasing it right away. 7 * </p> 5 8 * 6 * @version $Revision: $ $Date: $7 * @author 2011, last modified by $Author: $9 * @version 1.0 10 * @author Patrick Harms 8 11 */ 9 12 public class MouseClick extends MouseButtonInteraction { 10 13 11 /** */ 14 /** 15 * <p> 16 * Id for object serialization. 17 * </p> 18 */ 12 19 private static final long serialVersionUID = 1L; 13 20 14 21 /** 15 * @param button 22 * <p> 23 * Constructor. Creates a new {@link MouseClick} event type. 24 * </p> 25 * 26 * @see MouseButtonInteraction#MouseButtonInteraction(Button) 16 27 */ 17 28 public MouseClick(Button button) { -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseClickCondenser.java
r721 r786 1 // Module : $RCSfile: MouseClickCondenser.java,v $ 2 // Version : $Revision: 0.0 $ $Author: pharms $ $Date: 31.08.2012 $ 3 // Project : quest-core-events 4 // Creation : 2012 by pharms 5 // Copyright : Patrick Harms, 2012 1 6 2 package de.ugoe.cs.quest.eventcore.gui; 7 3 … … 14 10 /** 15 11 * <p> 16 * This class condenses mouse clicks, i.e. it reduces a sequence of mouse button down, 17 * mouse button up and mouse click with the same button on the same event target to a single18 * mouse click with that button on that target. The mouse button down and mouse button up events19 * are discarded. For this, it iterates the provided sequence and identifies any match of the named20 * event sequencepattern. This match is condensed to the mouse click event.12 * This class condenses mouse clicks, i.e. it reduces a sequence of mouse button down, mouse button 13 * up and mouse click with the same button on the same event target to a single mouse click with 14 * that button on that target. The mouse button down and mouse button up events are discarded. For 15 * this, it iterates the provided sequence and identifies any match of the named event sequence 16 * pattern. This match is condensed to the mouse click event. 21 17 * </p> 22 18 * 23 * @version $Revision: $ $Date: 31.08.2012$24 * @author 2012, last modified by $Author: pharms$19 * @version 1.0 20 * @author Patrick Harms 25 21 */ 26 22 public class MouseClickCondenser { … … 29 25 * <p> 30 26 * This method performs the work described in the description of the class. A new list is 31 * instantiated and returned. This list is filled with the events provided by the sequence 32 * being the parameter of the method except for mouse button down and mouse button up events33 * which arefollowed by a mouse click event with the same button on the same target.27 * instantiated and returned. This list is filled with the events provided by the sequence being 28 * the parameter of the method except for mouse button down and mouse button up events which are 29 * followed by a mouse click event with the same button on the same target. 34 30 * </p> 35 31 * 36 * @param sequence the event sequence to condense the mouse clicks in 32 * @param sequence 33 * the event sequence to condense the mouse clicks in 37 34 * 38 35 * @return the resulting sequence, in which mouse clicks are condensed to single mouse click … … 41 38 public List<Event> condenseMouseClicks(List<Event> sequence) { 42 39 List<Event> resultingSequence = new LinkedList<Event>(); 43 40 44 41 int index = 0; 45 42 while (index < sequence.size()) // -2 because we don't need to go to the end -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseDoubleClick.java
r681 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 3 4 /** 4 * TODO comment 5 * <p> 6 * Event type for a double click, i.e., pressing the mouse, releasing it, pressing it, and releasing 7 * it again right away. 8 * </p> 5 9 * 6 * @version $Revision: $ $Date: $7 * @author 2011, last modified by $Author: $10 * @version 1.0 11 * @author Patrick Harms 8 12 */ 9 13 public class MouseDoubleClick extends MouseButtonInteraction { 10 14 11 /** */ 15 /** 16 * <p> 17 * Id for object serialization. 18 * </p> 19 */ 12 20 private static final long serialVersionUID = 1L; 13 21 14 22 /** 15 * @param button 23 * <p> 24 * Constructor. Creates a new {@link MouseDoubleClick} event type. 25 * </p> 26 * 27 * @see MouseButtonInteraction#MouseButtonInteraction(Button) 16 28 */ 17 29 public MouseDoubleClick(Button button) { -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseInteraction.java
r655 r786 2 2 3 3 /** 4 * TODO comment 4 * <p> 5 * Base class for all mouse interaction event types. 6 * </p> 5 7 * 6 * @version $Revision: $ $Date: $7 * @author 2011, last modified by $Author: $8 * @version 1.0 9 * @author Patrick Harms 8 10 */ 9 11 public abstract class MouseInteraction implements IInteraction { 10 12 11 /** */ 13 /** 14 * <p> 15 * Id for object serialization. 16 * </p> 17 */ 12 18 private static final long serialVersionUID = 1L; 13 19 -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/TextInput.java
r751 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 … … 7 8 /** 8 9 * <p> 9 * A text input represents a list of key events that together represent entering text into a 10 * textfield or text area.10 * A text input represents a list of key events that together represent entering text into a text 11 * field or text area. 11 12 * </p> 12 13 * 13 * @version $Revision: $ $Date: $14 * @author 2011, last modified by $Author: $14 * @version 1.0 15 * @author Patrick Harms, Steffen Herbold 15 16 */ 16 17 public class TextInput implements IInteraction { 17 18 public enum TextEquality {LEXICAL, SYNTACTICAL, SEMANTICAL}; 19 20 /** */ 18 19 /** 20 * <p> 21 * Defines how the {@link TextInput}s are evaluated as equal. 22 * </p> 23 * 24 * @version 1.0 25 * @author Steffen Herbold 26 */ 27 public enum TextEquality { 28 /** 29 * <p> 30 * Two text inputs are equal if their {@link TextInput#textInputEvents} are equal. 31 * </p> 32 */ 33 LEXICAL, 34 /** 35 * <p> 36 * Two text inputs are equal if their {@link TextInput#enteredText}s are equal. 37 * </p> 38 */ 39 SYNTACTICAL, 40 /** 41 * <p> 42 * All text inputs are equal. 43 * </p> 44 */ 45 SEMANTICAL 46 }; 47 48 /** 49 * <p> 50 * Id for object serialization. 51 * </p> 52 */ 21 53 private static final long serialVersionUID = 1L; 22 23 /** the text resulting from the text input events */ 54 55 /** 56 * <p> 57 * The text resulting from the text input events. 58 * </p> 59 */ 24 60 private String enteredText; 25 61 26 /** the text input events that caused the entering of the text */ 62 /** 63 * <p> 64 * The text input events that caused the entering of the text. 65 * </p> 66 */ 27 67 private List<Event> textInputEvents; 28 68 69 /** 70 * <p> 71 * Defines how this TextInput event evaluates the equality. 72 * </p> 73 */ 29 74 private final TextEquality equalityType; 30 75 31 76 /** 32 77 * <p> 33 * TODO: comment34 * </p> 35 * 78 * Constructor. Creates a new {@link TextInput} with {@link TextEquality#LEXICAL} equality. 79 * </p> 80 * 36 81 * @param enteredText 82 * text resulting from the inputs 37 83 * @param textInputEvents 84 * text input events of which this input consists 38 85 */ 39 86 public TextInput(String enteredText, List<Event> textInputEvents) { 40 87 this(enteredText, textInputEvents, TextEquality.LEXICAL); 41 88 } 42 43 /** 44 * <p> 45 * TODO: comment46 * </p> 47 * 89 90 /** 91 * <p> 92 * Constructor. Creates a new {@link TextInput}.. 93 * </p> 94 * 48 95 * @param enteredText 96 * text resulting from the inputs 49 97 * @param textInputEvents 98 * text input events of which this input consists 50 99 * @param equalityType 100 * defines how this event evaluates the equality (@see {@link TextEquality}) 51 101 */ 52 102 public TextInput(String enteredText, List<Event> textInputEvents, TextEquality equalityType) { … … 76 126 77 127 /** 78 * @return the enteredText 128 * <p> 129 * Returns the entered text. 130 * </p> 131 * 132 * @return the entered text 79 133 */ 80 134 public String getEnteredText() { … … 83 137 84 138 /** 139 * <p> 140 * Returns the events of which this {@link TextInput} consists. 141 * </p> 142 * 85 143 * @return the textInputEvents 86 144 */ 87 145 public List<Event> getTextInputEvents() { 146 // TODO should return an immutable view on the list 88 147 return textInputEvents; 89 148 } … … 106 165 return false; 107 166 } 108 167 109 168 /* 110 169 * (non-Javadoc) … … 141 200 public int hashCode() { 142 201 int hashCode = getClass().hashCode(); 143 if ( equalityType==TextEquality.LEXICAL) {202 if (equalityType == TextEquality.LEXICAL) { 144 203 hashCode += enteredText.hashCode() + textInputEvents.size(); 145 204 } 146 else if ( equalityType==TextEquality.SYNTACTICAL) {205 else if (equalityType == TextEquality.SYNTACTICAL) { 147 206 hashCode += enteredText.hashCode(); 148 207 } -
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/TextInputDetector.java
r765 r786 38 38 private final TextEquality textEqualityType; 39 39 40 /** 41 * <p> 42 * TODO: comment 43 * </p> 44 * 45 */ 40 46 public TextInputDetector() { 41 47 this(TextEquality.LEXICAL);
Note: See TracChangeset
for help on using the changeset viewer.