Changeset 786


Ignore:
Timestamp:
09/06/12 16:47:00 (12 years ago)
Author:
sherbold
Message:
  • code documentation
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 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
     
    56/** 
    67 * <p> 
    7  * An interaction is a special event type which represents the interaction of a user with an 
    8  * element of 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. 
    910 * </p> 
    1011 *  
    11  * @version $Revision: $ $Date: $ 
    12  * @author 2011, last modified by $Author: $ 
     12 * @version 1.0 
     13 * @author Patrick Harms 
    1314 */ 
    14 public interface IInteraction extends IEventType 
    15 { 
     15public interface IInteraction extends IEventType { 
    1616    /** 
    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 
    1822     */ 
    1923    public boolean startsLogicalSequence(); 
    2024 
    2125    /** 
    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 
    2331     */ 
    2432    public boolean finishesLogicalSequence(); 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyInteraction.java

    r655 r786  
     1 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
     
    45 
    56/** 
    6  * TODO comment 
     7 * <p> 
     8 * Base class for all keyboard interaction event types. 
     9 * </p> 
    710 *  
    8  * @version $Revision: $ $Date: $ 
    9  * @author 2011, last modified by $Author: $ 
     11 * @version 1.0 
     12 * @author Patrick Harms 
    1013 */ 
    1114public abstract class KeyInteraction implements IInteraction { 
    1215 
    13     /**  */ 
     16    /** 
     17     * <p> 
     18     * Id for object serialization. 
     19     * </p> 
     20     */ 
    1421    private static final long serialVersionUID = 1L; 
    1522 
    16     /** the key, that was actually pressed */ 
     23    /** 
     24     * <p> 
     25     * the key associated with the interaction 
     26     * </p> 
     27     */ 
    1728    private VirtualKey key; 
    1829 
    1930    /** 
     31     * <p> 
     32     * Constructor. Creates a new KeyInteraction. 
     33     * </p> 
     34     *  
    2035     * @param key 
     36     *            key associated with the interaction 
    2137     */ 
    2238    public KeyInteraction(VirtualKey key) { 
     
    2642 
    2743    /** 
     44     * <p> 
     45     * Returns the key associated with the interaction. 
     46     * </p> 
    2847     *  
     48     * @return the key 
    2949     */ 
    3050    public VirtualKey getKey() { 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyPressed.java

    r655 r786  
     1 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
     
    45 
    56/** 
    6  * TODO comment 
     7 * <p> 
     8 * Event type for pressing down a key. 
     9 * </p> 
    710 *  
    8  * @version $Revision: $ $Date: $ 
    9  * @author 2011, last modified by $Author: $ 
     11 * @version 1.0 
     12 * @author Patrick Harms 
    1013 */ 
    1114public class KeyPressed extends KeyInteraction { 
    1215 
    13     /**  */ 
     16    /** 
     17     * <p> 
     18     * Id for object serialization. 
     19     * </p> 
     20     */ 
    1421    private static final long serialVersionUID = 1L; 
    1522 
    1623    /** 
    17      * @param key 
     24     * <p> 
     25     * Constructor. Creates a new {@link KeyPressed} event type. 
     26     * </p> 
     27     *  
     28     * @see KeyInteraction#KeyInteraction(VirtualKey) 
    1829     */ 
    1930    public KeyPressed(VirtualKey key) { 
     
    7485    } 
    7586 
    76     /* (non-Javadoc) 
     87    /* 
     88     * (non-Javadoc) 
     89     *  
    7790     * @see java.lang.Object#hashCode() 
    7891     */ 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyReleased.java

    r655 r786  
    44 
    55/** 
    6  * TODO comment 
     6 * <p> 
     7 * Event type for releasing a key. 
     8 * </p> 
    79 *  
    8  * @version $Revision: $ $Date: $ 
    9  * @author 2011, last modified by $Author: $ 
     10 * @version 1.0 
     11 * @author Steffen Herbold 
    1012 */ 
    1113public class KeyReleased extends KeyInteraction { 
    1214 
    13     /**  */ 
     15    /** 
     16     * <p> 
     17     * Id for object serialization. 
     18     * </p> 
     19     */ 
    1420    private static final long serialVersionUID = 1L; 
    1521 
    1622    /** 
    17      * @param key 
     23     * <p> 
     24     * Constructor. Creates a new {@link KeyReleased} event type. 
     25     * </p> 
     26     *  
     27     * @see KeyInteraction#KeyInteraction(VirtualKey) 
    1828     */ 
    1929    public KeyReleased(VirtualKey key) { 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyTyped.java

    r765 r786  
    44import de.ugoe.cs.tasktree.keyboardmaps.VirtualKey; 
    55 
     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 */ 
    614public class KeyTyped extends KeyInteraction { 
    715 
    8     /**  */ 
     16    /** 
     17     * <p> 
     18     * Id for object serialization. 
     19     * </p> 
     20     */ 
    921    private static final long serialVersionUID = 1L; 
    1022 
    1123    /** 
    12      * @param key 
     24     * <p> 
     25     * Constructor. Creates a new {@link KeyTyped} event type. 
     26     * </p> 
     27     *  
     28     * @see KeyInteraction#KeyInteraction(VirtualKey) 
    1329     */ 
    1430    public KeyTyped(VirtualKey key) { 
     
    5167     */ 
    5268    public boolean finishesLogicalSequence() { 
    53         return false; 
     69        // TODO handle lock keys correctly 
     70        return super.getKey().isCombinationKey(); 
    5471    } 
    5572 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/KeyboardFocusChange.java

    r681 r786  
    33 
    44/** 
    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> 
    69 *  
    7  * @version $Revision: $ $Date: $ 
    8  * @author 2011, last modified by $Author: $ 
     10 * @version 1.0 
     11 * @author Patrick Harms 
    912 */ 
    1013public class KeyboardFocusChange implements IInteraction { 
    1114 
    12     /**  */ 
     15    /** 
     16     * <p> 
     17     * Id for object serialization. 
     18     * </p> 
     19     */ 
    1320    private static final long serialVersionUID = 1L; 
    1421 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseButtonDown.java

    r681 r786  
     1 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
    34/** 
    4  * TODO comment 
     5 * <p> 
     6 * Event type for pressing a mouse button. 
     7 * </p> 
    58 *  
    6  * @version $Revision: $ $Date: $ 
    7  * @author 2011, last modified by $Author: $ 
     9 * @version 1.0 
     10 * @author Patrick Harms 
    811 */ 
    912public class MouseButtonDown extends MouseButtonInteraction { 
    1013 
    11     /**  */ 
     14    /** 
     15     * <p> 
     16     * Id for object serialization. 
     17     * </p> 
     18     */ 
    1219    private static final long serialVersionUID = 1L; 
    1320 
    1421    /** 
    15      * @param button 
     22     * <p> 
     23     * Constructor. Creates a new {@link MouseButtonDown} event type. 
     24     * </p> 
     25     *  
     26     * @see MouseButtonInteraction#MouseButtonInteraction(Button) 
    1627     */ 
    1728    public MouseButtonDown(Button button) { 
     
    7788        return false; 
    7889    } 
    79      
     90 
    8091    /* 
    8192     * (non-Javadoc) 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseButtonInteraction.java

    r681 r786  
     1 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
    34/** 
    4  * TODO comment 
     5 * <p> 
     6 * Base class for all mouse interaction event types. 
     7 * </p> 
    58 *  
    6  * @version $Revision: $ $Date: $ 
    7  * @author 2011, last modified by $Author: $ 
     9 * @version 1.0 
     10 * @author Patrick Harms 
    811 */ 
    912public abstract class MouseButtonInteraction extends MouseInteraction { 
    1013 
    11     /**  */ 
     14    /** 
     15     * <p> 
     16     * Id for object serialization. 
     17     * </p> 
     18     */ 
    1219    private static final long serialVersionUID = 1L; 
    1320 
    14     /** */ 
     21    /** 
     22     * <p> 
     23     * Describes the pressed mouse button. 
     24     * </p> 
     25     *  
     26     * @version 1.0 
     27     * @author Patrick Harms 
     28     */ 
    1529    public static enum Button { 
    1630        LEFT, MIDDLE, RIGHT, X; 
    1731    } 
    1832 
    19     /** the button used for mouse interaction */ 
     33    /** 
     34     * <p> 
     35     * The button used for mouse interaction 
     36     * </p> 
     37     */ 
    2038    private Button button; 
    2139 
    2240    /** 
     41     * <p> 
     42     * Constructor. Creates a new {@link MouseButtonInteraction} 
     43     * </p> 
    2344     *  
     45     * @param button 
     46     *            the button associated with the interaction 
    2447     */ 
    2548    public MouseButtonInteraction(Button button) { 
     
    2851 
    2952    /** 
    30      * @return Returns the button. 
     53     * <p> 
     54     * Returns the button associated with the interaction. 
     55     * </p> 
     56     *  
     57     * @return the button 
    3158     */ 
    3259    public Button getButton() { 
    3360        return button; 
    3461    } 
    35      
     62 
    3663    /* 
    3764     * (non-Javadoc) 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseButtonUp.java

    r681 r786  
     1 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
    34/** 
    4  * TODO comment 
     5 * <p> 
     6 * Event type for releasing a mouse button. 
     7 * </p> 
    58 *  
    6  * @version $Revision: $ $Date: $ 
    7  * @author 2011, last modified by $Author: $ 
     9 * @version 1.0 
     10 * @author Patrick Harms 
    811 */ 
    912public class MouseButtonUp extends MouseButtonInteraction { 
    1013 
    11     /**  */ 
     14    /** 
     15     * <p> 
     16     * Id for object serialization. 
     17     * </p> 
     18     */ 
    1219    private static final long serialVersionUID = 1L; 
    1320 
    1421    /** 
    15      * @param button 
     22     * <p> 
     23     * Constructor. Creates a new {@link MouseButtonUp} event type. 
     24     * </p> 
     25     *  
     26     * @see MouseButtonInteraction#MouseButtonInteraction(Button) 
    1627     */ 
    1728    public MouseButtonUp(Button button) { 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseClick.java

    r681 r786  
     1 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
    34/** 
    4  * TODO comment 
     5 * <p> 
     6 * Event type for a mouse click, i.e., pressing and releasing it right away. 
     7 * </p> 
    58 *  
    6  * @version $Revision: $ $Date: $ 
    7  * @author 2011, last modified by $Author: $ 
     9 * @version 1.0 
     10 * @author Patrick Harms 
    811 */ 
    912public class MouseClick extends MouseButtonInteraction { 
    1013 
    11     /**  */ 
     14    /** 
     15     * <p> 
     16     * Id for object serialization. 
     17     * </p> 
     18     */ 
    1219    private static final long serialVersionUID = 1L; 
    1320 
    1421    /** 
    15      * @param button 
     22     * <p> 
     23     * Constructor. Creates a new {@link MouseClick} event type. 
     24     * </p> 
     25     *  
     26     * @see MouseButtonInteraction#MouseButtonInteraction(Button) 
    1627     */ 
    1728    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 
    62package de.ugoe.cs.quest.eventcore.gui; 
    73 
     
    1410/** 
    1511 * <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 single 
    18  * mouse click with that button on that target. The mouse button down and mouse button up events 
    19  * are discarded. For this, it iterates the provided sequence and identifies any match of the named 
    20  * event sequence pattern. 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. 
    2117 * </p> 
    2218 *  
    23  * @version $Revision: $ $Date: 31.08.2012$ 
    24  * @author 2012, last modified by $Author: pharms$ 
     19 * @version 1.0 
     20 * @author Patrick Harms 
    2521 */ 
    2622public class MouseClickCondenser { 
     
    2925     * <p> 
    3026     * 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 events 
    33      * which are followed 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. 
    3430     * </p> 
    3531     *  
    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 
    3734     *  
    3835     * @return the resulting sequence, in which mouse clicks are condensed to single mouse click 
     
    4138    public List<Event> condenseMouseClicks(List<Event> sequence) { 
    4239        List<Event> resultingSequence = new LinkedList<Event>(); 
    43          
     40 
    4441        int index = 0; 
    4542        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 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
    34/** 
    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> 
    59 *  
    6  * @version $Revision: $ $Date: $ 
    7  * @author 2011, last modified by $Author: $ 
     10 * @version 1.0 
     11 * @author Patrick Harms 
    812 */ 
    913public class MouseDoubleClick extends MouseButtonInteraction { 
    1014 
    11     /**  */ 
     15    /** 
     16     * <p> 
     17     * Id for object serialization. 
     18     * </p> 
     19     */ 
    1220    private static final long serialVersionUID = 1L; 
    1321 
    1422    /** 
    15      * @param button 
     23     * <p> 
     24     * Constructor. Creates a new {@link MouseDoubleClick} event type. 
     25     * </p> 
     26     *  
     27     * @see MouseButtonInteraction#MouseButtonInteraction(Button) 
    1628     */ 
    1729    public MouseDoubleClick(Button button) { 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/MouseInteraction.java

    r655 r786  
    22 
    33/** 
    4  * TODO comment 
     4 * <p> 
     5 * Base class for all mouse interaction event types. 
     6 * </p> 
    57 *  
    6  * @version $Revision: $ $Date: $ 
    7  * @author 2011, last modified by $Author: $ 
     8 * @version 1.0 
     9 * @author Patrick Harms 
    810 */ 
    911public abstract class MouseInteraction implements IInteraction { 
    1012 
    11     /**  */ 
     13    /** 
     14     * <p> 
     15     * Id for object serialization. 
     16     * </p> 
     17     */ 
    1218    private static final long serialVersionUID = 1L; 
    1319 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/TextInput.java

    r751 r786  
     1 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
     
    78/** 
    89 * <p> 
    9  * A text input represents a list of key events that together represent entering text into a 
    10  * text field 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. 
    1112 * </p> 
    1213 *  
    13  * @version $Revision: $ $Date: $ 
    14  * @author 2011, last modified by $Author: $ 
     14 * @version 1.0 
     15 * @author Patrick Harms, Steffen Herbold 
    1516 */ 
    1617public 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     */ 
    2153    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     */ 
    2460    private String enteredText; 
    2561 
    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     */ 
    2767    private List<Event> textInputEvents; 
    28      
     68 
     69    /** 
     70     * <p> 
     71     * Defines how this TextInput event evaluates the equality. 
     72     * </p> 
     73     */ 
    2974    private final TextEquality equalityType; 
    3075 
    3176    /** 
    3277     * <p> 
    33      * TODO: comment 
    34      * </p> 
    35      * 
     78     * Constructor. Creates a new {@link TextInput} with {@link TextEquality#LEXICAL} equality. 
     79     * </p> 
     80     *  
    3681     * @param enteredText 
     82     *            text resulting from the inputs 
    3783     * @param textInputEvents 
     84     *            text input events of which this input consists 
    3885     */ 
    3986    public TextInput(String enteredText, List<Event> textInputEvents) { 
    4087        this(enteredText, textInputEvents, TextEquality.LEXICAL); 
    4188    } 
    42      
    43     /** 
    44      * <p> 
    45      * TODO: comment 
    46      * </p> 
    47      * 
     89 
     90    /** 
     91     * <p> 
     92     * Constructor. Creates a new {@link TextInput}.. 
     93     * </p> 
     94     *  
    4895     * @param enteredText 
     96     *            text resulting from the inputs 
    4997     * @param textInputEvents 
     98     *            text input events of which this input consists 
    5099     * @param equalityType 
     100     *            defines how this event evaluates the equality (@see {@link TextEquality}) 
    51101     */ 
    52102    public TextInput(String enteredText, List<Event> textInputEvents, TextEquality equalityType) { 
     
    76126 
    77127    /** 
    78      * @return the enteredText 
     128     * <p> 
     129     * Returns the entered text. 
     130     * </p> 
     131     *  
     132     * @return the entered text 
    79133     */ 
    80134    public String getEnteredText() { 
     
    83137 
    84138    /** 
     139     * <p> 
     140     * Returns the events of which this {@link TextInput} consists. 
     141     * </p> 
     142     *  
    85143     * @return the textInputEvents 
    86144     */ 
    87145    public List<Event> getTextInputEvents() { 
     146        // TODO should return an immutable view on the list 
    88147        return textInputEvents; 
    89148    } 
     
    106165        return false; 
    107166    } 
    108      
     167 
    109168    /* 
    110169     * (non-Javadoc) 
     
    141200    public int hashCode() { 
    142201        int hashCode = getClass().hashCode(); 
    143         if( equalityType==TextEquality.LEXICAL) { 
     202        if (equalityType == TextEquality.LEXICAL) { 
    144203            hashCode += enteredText.hashCode() + textInputEvents.size(); 
    145204        } 
    146         else if( equalityType==TextEquality.SYNTACTICAL) { 
     205        else if (equalityType == TextEquality.SYNTACTICAL) { 
    147206            hashCode += enteredText.hashCode(); 
    148207        } 
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/TextInputDetector.java

    r765 r786  
    3838    private final TextEquality textEqualityType; 
    3939     
     40    /** 
     41     * <p> 
     42     * TODO: comment 
     43     * </p> 
     44     * 
     45     */ 
    4046    public TextInputDetector() { 
    4147        this(TextEquality.LEXICAL); 
Note: See TracChangeset for help on using the changeset viewer.