Changeset 1315 for trunk/autoquest-htmlmonitor/src/main
- Timestamp:
- 10/07/13 16:10:45 (11 years ago)
- Location:
- trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlGUIElement.java
r1075 r1315 113 113 /** 114 114 * <p> 115 * returns the id of theparent GUI element, if any115 * returns the parent GUI element, if any 116 116 * </p> 117 117 * 118 * @return the id of theparent GUI element, or null, if this element does not have a parent118 * @return the parent GUI element, or null, if this element does not have a parent 119 119 */ 120 String getParentId() { 121 if (parent == null) { 122 return null; 123 } 124 else { 125 return parent.getId(); 126 } 120 HtmlGUIElement getParent() { 121 return parent; 127 122 } 128 123 -
trunk/autoquest-htmlmonitor/src/main/java/de/ugoe/cs/autoquest/htmlmonitor/HtmlMonitorOutputWriter.java
r1268 r1315 204 204 } 205 205 206 if (guiStructure != null) {207 dumpGuiStructure(guiStructure);208 }209 210 206 for (HtmlEvent event : events) { 211 207 dumpEvent(event); … … 226 222 /** 227 223 * <p> 228 * dumps the GUI structure provided by the parameter into the log file. Calls itself229 * recursively to traverse the GUI structure.230 * </p>231 *232 * @param guiStructure the GUI structure to be logged233 */234 private void dumpGuiStructure(HtmlGUIElement guiStructure) {235 if (!loggedGUIElements.contains(guiStructure)) {236 outputWriter.print("<component id=\"");237 outputWriter.print(guiStructure.getId());238 outputWriter.println("\">");239 240 if (guiStructure instanceof HtmlServer) {241 dumpParam("host", ((HtmlServer) guiStructure).getName());242 dumpParam("port", ((HtmlServer) guiStructure).getPort());243 }244 else if (guiStructure instanceof HtmlDocument) {245 dumpParam("path", ((HtmlDocument) guiStructure).getPath());246 dumpParam("query", ((HtmlDocument) guiStructure).getQuery());247 dumpParam("title", ((HtmlDocument) guiStructure).getTitle());248 }249 else if (guiStructure instanceof HtmlPageElement) {250 dumpParam("tagname", ((HtmlPageElement) guiStructure).getTagName());251 dumpParam("htmlid", ((HtmlPageElement) guiStructure).getHtmlId());252 dumpParam("index", ((HtmlPageElement) guiStructure).getIndex());253 }254 255 dumpParam("parent", guiStructure.getParentId());256 257 outputWriter.println("</component>");258 259 loggedGUIElements.add(guiStructure);260 }261 262 if (guiStructure.getChildren() != null) {263 for (HtmlGUIElement child : guiStructure.getChildren()) {264 dumpGuiStructure(child);265 }266 }267 }268 269 /**270 * <p>271 224 * formats a received event and writes it to the log file. One event results in one line 272 225 * in the log file containing all infos of the event. … … 276 229 */ 277 230 private void dumpEvent(HtmlEvent event) { 231 if (event.getTarget() != null) { 232 ensureGuiElementDumped(event.getTarget()); 233 } 234 278 235 outputWriter.print("<event type=\""); 279 236 outputWriter.print(event.getEventType()); … … 304 261 305 262 outputWriter.println("</event>"); 263 } 264 265 /** 266 * <p> 267 * dumps a GUI element starting with its parent GUI elements into the log file. Calls itself 268 * recursively to traverse for dumping the parents first. 269 * </p> 270 * 271 * @param guiStructure the GUI structure to be logged 272 */ 273 private void ensureGuiElementDumped(HtmlGUIElement guiElement) { 274 if (!loggedGUIElements.contains(guiElement)) { 275 276 HtmlGUIElement parent = guiElement.getParent(); 277 String parentId = null; 278 279 if (parent != null) { 280 ensureGuiElementDumped(parent); 281 parentId = parent.getId(); 282 } 283 284 outputWriter.print("<component id=\""); 285 outputWriter.print(guiElement.getId()); 286 outputWriter.println("\">"); 287 288 if (guiElement instanceof HtmlServer) { 289 dumpParam("host", ((HtmlServer) guiElement).getName()); 290 dumpParam("port", ((HtmlServer) guiElement).getPort()); 291 } 292 else if (guiElement instanceof HtmlDocument) { 293 dumpParam("path", ((HtmlDocument) guiElement).getPath()); 294 dumpParam("query", ((HtmlDocument) guiElement).getQuery()); 295 dumpParam("title", ((HtmlDocument) guiElement).getTitle()); 296 } 297 else if (guiElement instanceof HtmlPageElement) { 298 dumpParam("tagname", ((HtmlPageElement) guiElement).getTagName()); 299 dumpParam("htmlid", ((HtmlPageElement) guiElement).getHtmlId()); 300 dumpParam("index", ((HtmlPageElement) guiElement).getIndex()); 301 } 302 303 dumpParam("parent", parentId); 304 305 outputWriter.println("</component>"); 306 307 loggedGUIElements.add(guiElement); 308 } 306 309 } 307 310
Note: See TracChangeset
for help on using the changeset viewer.