1 | package de.ugoe.cs.quest.eventcore.gui;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 |
|
---|
5 | import de.ugoe.cs.quest.eventcore.Event;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * <p>
|
---|
9 | * A text input represents a list of key events that together represent entering text into a
|
---|
10 | * text field or text area.
|
---|
11 | * </p>
|
---|
12 | *
|
---|
13 | * @version $Revision: $ $Date: $
|
---|
14 | * @author 2011, last modified by $Author: $
|
---|
15 | */
|
---|
16 | public class TextInput implements IInteraction {
|
---|
17 |
|
---|
18 | /** */
|
---|
19 | private static final long serialVersionUID = 1L;
|
---|
20 |
|
---|
21 | /** the text resulting from the text input events */
|
---|
22 | private String enteredText;
|
---|
23 |
|
---|
24 | /** the text input events that caused the entering of the text */
|
---|
25 | private List<Event> textInputEvents;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * <p>
|
---|
29 | * TODO: comment
|
---|
30 | * </p>
|
---|
31 | *
|
---|
32 | * @param enteredText
|
---|
33 | * @param textInputEvents
|
---|
34 | */
|
---|
35 | public TextInput(String enteredText, List<Event> textInputEvents) {
|
---|
36 | this.enteredText = enteredText;
|
---|
37 | this.textInputEvents = textInputEvents;
|
---|
38 | }
|
---|
39 |
|
---|
40 | /*
|
---|
41 | * (non-Javadoc)
|
---|
42 | *
|
---|
43 | * @see de.harms.attef.userinteraction.Interaction#getName()
|
---|
44 | */
|
---|
45 | public String getName() {
|
---|
46 | return "TextInput(\"" + enteredText + "\")";
|
---|
47 | }
|
---|
48 |
|
---|
49 | /*
|
---|
50 | * (non-Javadoc)
|
---|
51 | *
|
---|
52 | * @see java.lang.Object#toString()
|
---|
53 | */
|
---|
54 | @Override
|
---|
55 | public String toString() {
|
---|
56 | return "text input \"" + enteredText + "\"";
|
---|
57 | }
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * @return the enteredText
|
---|
61 | */
|
---|
62 | public String getEnteredText() {
|
---|
63 | return enteredText;
|
---|
64 | }
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * @return the textInputEvents
|
---|
68 | */
|
---|
69 | public List<Event> getTextInputEvents() {
|
---|
70 | return textInputEvents;
|
---|
71 | }
|
---|
72 |
|
---|
73 | /*
|
---|
74 | * (non-Javadoc)
|
---|
75 | *
|
---|
76 | * @see de.harms.attef.userinteraction.Interaction#startsLogicalSequence()
|
---|
77 | */
|
---|
78 | public boolean startsLogicalSequence() {
|
---|
79 | return false;
|
---|
80 | }
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * (non-Javadoc)
|
---|
84 | *
|
---|
85 | * @see de.harms.attef.userinteraction.Interaction#finishesLogicalSequence()
|
---|
86 | */
|
---|
87 | public boolean finishesLogicalSequence() {
|
---|
88 | return false;
|
---|
89 | }
|
---|
90 |
|
---|
91 | /*
|
---|
92 | * (non-Javadoc)
|
---|
93 | *
|
---|
94 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
95 | */
|
---|
96 | @Override
|
---|
97 | public boolean equals(Object obj) {
|
---|
98 | if (this == obj) {
|
---|
99 | return true;
|
---|
100 | }
|
---|
101 | else if (obj instanceof TextInput) {
|
---|
102 | return
|
---|
103 | enteredText.equals(((TextInput) obj).enteredText) &&
|
---|
104 | textInputEvents.equals(((TextInput) obj).textInputEvents);
|
---|
105 | }
|
---|
106 | return false;
|
---|
107 | }
|
---|
108 |
|
---|
109 | /*
|
---|
110 | * (non-Javadoc)
|
---|
111 | *
|
---|
112 | * @see java.lang.Object#hashCode()
|
---|
113 | */
|
---|
114 | @Override
|
---|
115 | public int hashCode() {
|
---|
116 | return getClass().hashCode() + enteredText.hashCode() + textInputEvents.size();
|
---|
117 | }
|
---|
118 |
|
---|
119 | }
|
---|