1 | |
---|
2 | package de.ugoe.cs.quest.eventcore.gui; |
---|
3 | |
---|
4 | import de.ugoe.cs.tasktree.keyboardmaps.VirtualKey; |
---|
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 | */ |
---|
14 | public class KeyTyped extends KeyInteraction { |
---|
15 | |
---|
16 | /** |
---|
17 | * <p> |
---|
18 | * Id for object serialization. |
---|
19 | * </p> |
---|
20 | */ |
---|
21 | private static final long serialVersionUID = 1L; |
---|
22 | |
---|
23 | /** |
---|
24 | * <p> |
---|
25 | * Constructor. Creates a new {@link KeyTyped} event type. |
---|
26 | * </p> |
---|
27 | * |
---|
28 | * @see KeyInteraction#KeyInteraction(VirtualKey) |
---|
29 | */ |
---|
30 | public KeyTyped(VirtualKey key) { |
---|
31 | super(key); |
---|
32 | } |
---|
33 | |
---|
34 | /* |
---|
35 | * (non-Javadoc) |
---|
36 | * |
---|
37 | * @see de.harms.attef.userinteraction.Interaction#getName() |
---|
38 | */ |
---|
39 | public String getName() { |
---|
40 | return "KeyTyped " + super.getKey(); |
---|
41 | } |
---|
42 | |
---|
43 | /* |
---|
44 | * (non-Javadoc) |
---|
45 | * |
---|
46 | * @see java.lang.Object#toString() |
---|
47 | */ |
---|
48 | @Override |
---|
49 | public String toString() { |
---|
50 | return "typed key " + super.getKey(); |
---|
51 | } |
---|
52 | |
---|
53 | /* |
---|
54 | * (non-Javadoc) |
---|
55 | * |
---|
56 | * @see de.harms.attef.userinteraction.Interaction#startsLogicalSequence() |
---|
57 | */ |
---|
58 | public boolean startsLogicalSequence() { |
---|
59 | // TODO handle lock keys correctly |
---|
60 | return super.getKey().isCombinationKey(); |
---|
61 | } |
---|
62 | |
---|
63 | /* |
---|
64 | * (non-Javadoc) |
---|
65 | * |
---|
66 | * @see de.harms.attef.userinteraction.Interaction#finishesLogicalSequence() |
---|
67 | */ |
---|
68 | public boolean finishesLogicalSequence() { |
---|
69 | // TODO handle lock keys correctly |
---|
70 | return super.getKey().isCombinationKey(); |
---|
71 | } |
---|
72 | |
---|
73 | /* |
---|
74 | * (non-Javadoc) |
---|
75 | * |
---|
76 | * @see java.lang.Object#equals(java.lang.Object) |
---|
77 | */ |
---|
78 | @Override |
---|
79 | public boolean equals(Object other) { |
---|
80 | if (other instanceof KeyTyped) { |
---|
81 | return (super.getKey() == ((KeyTyped) other).getKey()); |
---|
82 | } |
---|
83 | else { |
---|
84 | return false; |
---|
85 | } |
---|
86 | } |
---|
87 | |
---|
88 | /* |
---|
89 | * (non-Javadoc) |
---|
90 | * |
---|
91 | * @see java.lang.Object#hashCode() |
---|
92 | */ |
---|
93 | @Override |
---|
94 | public int hashCode() { |
---|
95 | return super.getKey().hashCode(); |
---|
96 | } |
---|
97 | |
---|
98 | } |
---|