source: trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlEvent.java @ 942

Last change on this file since 942 was 942, checked in by pharms, 12 years ago
  • added support for providing horizontal scroll position
  • added support for selected values in text fields and other form elements
File size: 4.2 KB
Line 
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
15package 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 */
27class 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     * if the event is an on change event, the value to which the changed element is changed
66     */
67    private String selectedValue;
68
69    /**
70     * <p>
71     * initializes the event with all relevantinfos
72     * </p>
73     *
74     * @param clientInfos    infos about the client that caused the event
75     * @param time           the time stamp of the event
76     * @param path           the path in the HTML DOM to the object on which the event was executed
77     * @param eventType      the type of the event, e.g. onclick
78     * @param coordinates    the coordinates of the event, usually an array with two values
79     *                       (x and y)
80     * @param key            if the event is a key event, the key that was pressed or released
81     * @param scrollPosition if the event is a scroll event, the resulting position of the
82     *                       scrolled element
83     * @param selectedValue  if the event is an on change event, the value to which the changed
84     *                       element is changed
85     */
86    HtmlEvent(HtmlClientInfos clientInfos,
87              Long            time,
88              String          path,
89              String          eventType,
90              Integer[]       coordinates,
91              Integer         key,
92              Integer[]       scrollPosition,
93              String          selectedValue)
94    {
95        this.clientInfos = clientInfos;
96        this.time = time;
97        this.path = path;
98        this.eventType = eventType;
99        this.coordinates = coordinates;
100        this.key = key;
101        this.scrollPosition = scrollPosition;
102        this.selectedValue = selectedValue;
103    }
104
105    /**
106     * @return the clientInfos
107     */
108    HtmlClientInfos getClientInfos() {
109        return clientInfos;
110    }
111
112    /**
113     * @return the time
114     */
115    Long getTime() {
116        return time;
117    }
118
119    /**
120     * @return the path
121     */
122    String getPath() {
123        return path;
124    }
125
126    /**
127     * @return the eventType
128     */
129    String getEventType() {
130        return eventType;
131    }
132
133    /**
134     * @return the coordinates
135     */
136    Integer[] getCoordinates() {
137        return coordinates;
138    }
139
140    /**
141     * @return the key
142     */
143    Integer getKey() {
144        return key;
145    }
146
147    /**
148     * @return the scrollPosition
149     */
150    Integer[] getScrollPosition() {
151        return scrollPosition;
152    }
153
154    /**
155     * @return the selectedValue
156     */
157    String getSelectedValue() {
158        return selectedValue;
159    }
160
161}
Note: See TracBrowser for help on using the repository browser.