1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
2 | // |
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
4 | // you may not use this file except in compliance with the License. |
---|
5 | // You may obtain a copy of the License at |
---|
6 | // |
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
8 | // |
---|
9 | // Unless required by applicable law or agreed to in writing, software |
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
12 | // See the License for the specific language governing permissions and |
---|
13 | // limitations under the License. |
---|
14 | |
---|
15 | package de.ugoe.cs.autoquest.htmlmonitor; |
---|
16 | |
---|
17 | /** |
---|
18 | * <p> |
---|
19 | * represents an event caused by a user on a specific web site. An event contains the infos |
---|
20 | * about the client ({@link HtmlClientInfos}, when ant where the event took place, the type of |
---|
21 | * event and some additional infos such as the event coordinates or the number of the pressed |
---|
22 | * key. |
---|
23 | * </p> |
---|
24 | * |
---|
25 | * @author Patrick Harms |
---|
26 | */ |
---|
27 | class HtmlEvent { |
---|
28 | |
---|
29 | /** |
---|
30 | * infos about the client that caused the event |
---|
31 | */ |
---|
32 | private HtmlClientInfos clientInfos; |
---|
33 | |
---|
34 | /** |
---|
35 | * the time stamp of the event |
---|
36 | */ |
---|
37 | private Long time; |
---|
38 | |
---|
39 | /** |
---|
40 | * the path in the HTML DOM to the object on which the event was executed |
---|
41 | */ |
---|
42 | private String path; |
---|
43 | |
---|
44 | /** |
---|
45 | * the type of the event, e.g. onclick |
---|
46 | */ |
---|
47 | private String eventType; |
---|
48 | |
---|
49 | /** |
---|
50 | * the coordinates of the event, usually an array with two values (x and y) |
---|
51 | */ |
---|
52 | private Integer[] coordinates; |
---|
53 | |
---|
54 | /** |
---|
55 | * if the event is a key event, the key that was pressed or released |
---|
56 | */ |
---|
57 | private Integer key; |
---|
58 | |
---|
59 | /** |
---|
60 | * if the event is a scroll event, the resulting position of the scrolled element |
---|
61 | */ |
---|
62 | private Integer scrollPosition; |
---|
63 | |
---|
64 | /** |
---|
65 | * <p> |
---|
66 | * initializes the event with all relevantinfos |
---|
67 | * </p> |
---|
68 | * |
---|
69 | * @param clientInfos infos about the client that caused the event |
---|
70 | * @param time the time stamp of the event |
---|
71 | * @param path the path in the HTML DOM to the object on which the event was executed |
---|
72 | * @param eventType the type of the event, e.g. onclick |
---|
73 | * @param coordinates the coordinates of the event, usually an array with two values |
---|
74 | * (x and y) |
---|
75 | * @param key if the event is a key event, the key that was pressed or released |
---|
76 | * @param scrollPosition if the event is a scroll event, the resulting position of the |
---|
77 | * scrolled element |
---|
78 | */ |
---|
79 | HtmlEvent(HtmlClientInfos clientInfos, |
---|
80 | Long time, |
---|
81 | String path, |
---|
82 | String eventType, |
---|
83 | Integer[] coordinates, |
---|
84 | Integer key, |
---|
85 | Integer scrollPosition) |
---|
86 | { |
---|
87 | this.clientInfos = clientInfos; |
---|
88 | this.time = time; |
---|
89 | this.path = path; |
---|
90 | this.eventType = eventType; |
---|
91 | this.coordinates = coordinates; |
---|
92 | this.key = key; |
---|
93 | this.scrollPosition = scrollPosition; |
---|
94 | } |
---|
95 | |
---|
96 | /** |
---|
97 | * @return the clientInfos |
---|
98 | */ |
---|
99 | HtmlClientInfos getClientInfos() { |
---|
100 | return clientInfos; |
---|
101 | } |
---|
102 | |
---|
103 | /** |
---|
104 | * @return the time |
---|
105 | */ |
---|
106 | Long getTime() { |
---|
107 | return time; |
---|
108 | } |
---|
109 | |
---|
110 | /** |
---|
111 | * @return the path |
---|
112 | */ |
---|
113 | String getPath() { |
---|
114 | return path; |
---|
115 | } |
---|
116 | |
---|
117 | /** |
---|
118 | * @return the eventType |
---|
119 | */ |
---|
120 | String getEventType() { |
---|
121 | return eventType; |
---|
122 | } |
---|
123 | |
---|
124 | /** |
---|
125 | * @return the coordinates |
---|
126 | */ |
---|
127 | Integer[] getCoordinates() { |
---|
128 | return coordinates; |
---|
129 | } |
---|
130 | |
---|
131 | /** |
---|
132 | * @return the key |
---|
133 | */ |
---|
134 | Integer getKey() { |
---|
135 | return key; |
---|
136 | } |
---|
137 | |
---|
138 | /** |
---|
139 | * @return the scrollPosition |
---|
140 | */ |
---|
141 | Integer getScrollPosition() { |
---|
142 | return scrollPosition; |
---|
143 | } |
---|
144 | |
---|
145 | } |
---|