Changeset 942 for trunk/autoquest-htmlmonitor/src/main/java/de
- Timestamp:
- 10/26/12 09:13:20 (12 years ago)
- Location:
- trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlEvent.java
r927 r942 60 60 * if the event is a scroll event, the resulting position of the scrolled element 61 61 */ 62 private Integer scrollPosition; 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; 63 68 64 69 /** … … 76 81 * @param scrollPosition if the event is a scroll event, the resulting position of the 77 82 * scrolled element 83 * @param selectedValue if the event is an on change event, the value to which the changed 84 * element is changed 78 85 */ 79 86 HtmlEvent(HtmlClientInfos clientInfos, … … 83 90 Integer[] coordinates, 84 91 Integer key, 85 Integer scrollPosition) 92 Integer[] scrollPosition, 93 String selectedValue) 86 94 { 87 95 this.clientInfos = clientInfos; … … 92 100 this.key = key; 93 101 this.scrollPosition = scrollPosition; 102 this.selectedValue = selectedValue; 94 103 } 95 104 … … 139 148 * @return the scrollPosition 140 149 */ 141 Integer getScrollPosition() {150 Integer[] getScrollPosition() { 142 151 return scrollPosition; 143 152 } 144 153 154 /** 155 * @return the selectedValue 156 */ 157 String getSelectedValue() { 158 return selectedValue; 159 } 160 145 161 } -
trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorOutputWriter.java
r927 r942 242 242 if (event.getScrollPosition() != null) { 243 243 outputWriter.print(' '); 244 dumpString(event.getScrollPosition().toString()); 244 245 StringBuffer value = new StringBuffer(); 246 for (int i = 0; i < event.getScrollPosition().length; i++) { 247 if (i > 0) { 248 value.append(','); 249 } 250 value.append(event.getScrollPosition()[i]); 251 } 252 253 dumpString(value.toString()); 254 } 255 256 if (event.getSelectedValue() != null) { 257 outputWriter.print(' '); 258 dumpString(event.getSelectedValue()); 245 259 } 246 260 -
trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorServlet.java
r927 r942 255 255 assertValue(((JSONObject) eventObj), "coordinates", Integer[].class); 256 256 Integer key = assertValue(((JSONObject) eventObj), "key", Integer.class); 257 Integer scrollPosition = 258 assertValue(((JSONObject) eventObj), "scrollPosition", Integer.class); 257 Integer[] scrollPosition = 258 assertValue(((JSONObject) eventObj), "scrollPosition", Integer[].class); 259 String selectedValue = 260 assertValue(((JSONObject) eventObj), "selectedValue", String.class); 259 261 260 262 if (time == null) { … … 271 273 } 272 274 else if (checkEventParameterCombinations 273 (eventType, coordinates, key, scrollPosition ))275 (eventType, coordinates, key, scrollPosition, selectedValue)) 274 276 { 275 277 events.add(new HtmlEvent(clientInfos, time, path, eventType, coordinates, 276 key, scrollPosition ));278 key, scrollPosition, selectedValue)); 277 279 } 278 280 else { … … 295 297 /** 296 298 * <p> 297 * validates if for the given event type the parameter combination of coordinates, key, and298 * scroll position is valid. As an example, an onclick event should usually not have an299 * associated scroll position.299 * validates if for the given event type the parameter combination of coordinates, key, 300 * scroll position, and selected value is valid. As an example, an onclick event should 301 * usually not have an associated scroll position. 300 302 * </p> 301 303 * … … 304 306 * @param key the key of the event 305 307 * @param scrollPosition the scroll position of the event 308 * @param selectedValue the value selected through a specific event 306 309 * 307 310 * @return true, if the combination of the parameters is valid, false else … … 310 313 Integer[] coordinates, 311 314 Integer key, 312 Integer scrollPosition) 315 Integer[] scrollPosition, 316 String selectedValue) 313 317 { 314 318 boolean result = false; 315 319 316 320 if ("onscroll".equals(eventType)) { 317 if ((coordinates == null) && (key == null) && (scrollPosition != null)) { 321 if ((coordinates == null) && (key == null) && 322 (scrollPosition != null) && (selectedValue == null)) 323 { 318 324 result = true; 319 325 } … … 323 329 } 324 330 else if ("onclick".equals(eventType) || "ondblclick".equals(eventType)) { 325 if ((coordinates != null) && (key == null) && (scrollPosition == null)) { 331 if ((coordinates != null) && (key == null) && 332 (scrollPosition == null) && (selectedValue == null)) 333 { 334 result = true; 335 } 336 else { 337 Console.printerrln(eventType + " event has invalid parameters"); 338 } 339 } 340 else if ("onchange".equals(eventType)) { 341 if ((coordinates == null) && (key == null) && 342 (scrollPosition == null) && (selectedValue != null)) 343 { 326 344 result = true; 327 345 } … … 333 351 "onkeyup".equals(eventType)) 334 352 { 335 if ((coordinates == null) && (key != null) && (scrollPosition == null)) { 353 if ((coordinates == null) && (key != null) && 354 (scrollPosition == null) && (selectedValue == null)) 355 { 336 356 result = true; 337 357 } … … 341 361 } 342 362 else if ("onfocus".equals(eventType) || "onmouseout".equals(eventType) || 343 "onmousemove".equals(eventType) || "onunload".equals(eventType)) 363 "onmousemove".equals(eventType) || "onunload".equals(eventType) || 364 "onbeforeunload".equals(eventType) || "onpagehide".equals(eventType) || 365 "onpageshow".equals(eventType)) 344 366 { 345 if ((coordinates == null) && (key == null) && (scrollPosition == null)) { 367 if ((coordinates == null) && (key == null) && 368 (scrollPosition == null) && (selectedValue == null)) 369 { 346 370 result = true; 347 371 }
Note: See TracChangeset
for help on using the changeset viewer.