Changeset 1860 for trunk/autoquest-plugin-jfc/src/main/java
- Timestamp:
- 01/12/15 10:40:41 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/JFCSimplifiedLogParser.java
r1113 r1860 145 145 /** 146 146 * <p> 147 * maps the hashes of GUI elements stored in the logs to unique ids of GUI elements. 148 * This is required, as the same hash may be used for several GUI elements in the log files. 149 * </p> 150 */ 151 private Map<Long, Long> hashToGuiElementIdMapping = new HashMap<>(); 152 153 /** 154 * <p> 155 * counter to get unique GUI element ids 156 * </p> 157 */ 158 private long nextGuiElementId = 0; 159 160 /** 161 * <p> 147 162 * internal handle to the parsed GUI structure, stored in a GUIElementTree 148 163 * </p> … … 326 341 if (qName.equals("sessions")) { 327 342 currentSequence = new LinkedList<Event>(); 328 if (currentGUIElementTree == null) 343 if (currentGUIElementTree == null) { 329 344 currentGUIElementTree = new GUIElementTree<Long>(); 345 } 330 346 } 331 347 if (qName.equals("newsession")) { … … 350 366 } 351 367 else if (qName.equals("componentNameChange")) { 352 long sourceHash = Long.parseLong(atts.getValue("hash"), 16);368 Long sourceHash = Long.parseLong(atts.getValue("hash"), 16); 353 369 String newName = atts.getValue("newName"); 354 370 // int titleSource = Integer.parseInt(atts.getValue("titleSource")); 355 JFCGUIElement sourceElement = (JFCGUIElement) currentGUIElementTree.find(sourceHash); 371 Long guiElementId = hashToGuiElementIdMapping.get(sourceHash); 372 JFCGUIElement sourceElement = (JFCGUIElement) currentGUIElementTree.find(guiElementId); 356 373 JFCGUIElementSpec sourceSpec = (JFCGUIElementSpec) sourceElement.getSpecification(); 357 374 sourceSpec.setName(newName); … … 411 428 } 412 429 else if (qName.equals("component") && currentGUIElementHash != null) { 430 Long guiElementId = nextGuiElementId++; 431 Long parentGuiElementId = hashToGuiElementIdMapping.get(currentParentHash); 432 413 433 try { 414 currentGUIElementTree.add(currentGUIElementHash, currentParentHash, 415 currentGuiElementSpec); 434 // store a mapping of the hash to a unique id and use this id for the GUI element 435 hashToGuiElementIdMapping.put(currentGUIElementHash, guiElementId); 436 currentGUIElementTree.add(guiElementId, parentGuiElementId, currentGuiElementSpec); 416 437 } 417 438 catch (GUIModelException e) { … … 419 440 currentGUIElementHash + ": " + e.getMessage(), e); 420 441 } 442 421 443 List<Event> unhandledEvents = eventsWithoutTargets.get(currentGUIElementHash); 422 444 if (unhandledEvents != null) { 423 JFCGUIElement guiElement = 424 (JFCGUIElement) currentGUIElementTree.find(currentGUIElementHash); 445 JFCGUIElement guiElement = (JFCGUIElement) currentGUIElementTree.find(guiElementId); 425 446 for (Event event : unhandledEvents) { 426 447 event.setTarget(guiElement); … … 429 450 eventsWithoutTargets.remove(currentGUIElementHash); 430 451 } 452 431 453 currentGUIElementHash = null; 432 454 currentParentHash = null; … … 435 457 else if (currentEventId != null) { 436 458 if (qName.equals("event")) { 437 438 IGUIElement currentGUIElement; 439 currentGUIElement = currentGUIElementTree.find(currentEventSource); 459 460 IGUIElement currentGUIElement = null; 461 462 if (hashToGuiElementIdMapping.containsKey(currentEventSource)) { 463 long guiElementId = hashToGuiElementIdMapping.get(currentEventSource); 464 currentGUIElement = currentGUIElementTree.find(guiElementId); 465 } 466 440 467 Event event; 441 468 // in some rare cases the target GUI element of the event is not 442 469 // known yet 443 470 if (currentGUIElement == null) { 444 event = new Event(instantiateInteraction(currentEventId, currentEventParameters)); 471 event = new Event 472 (instantiateInteraction(currentEventId, currentEventParameters)); 473 445 474 List<Event> eventList = eventsWithoutTargets.get(currentEventSource); 475 446 476 if (eventList == null) { 447 477 eventList = new ArrayList<Event>(); 448 478 eventsWithoutTargets.put(currentEventSource, eventList); 449 479 } 480 450 481 eventList.add(event); 451 482 } 452 483 else { 453 484 event = new Event(instantiateInteraction(currentEventId, currentEventParameters), 454 currentGUIElement); 485 currentGUIElement); 486 455 487 JFCGUIElement currentEventTarget = (JFCGUIElement) event.getTarget(); 456 488 currentEventTarget.markUsed(); 457 489 } 490 458 491 event.setTimestamp(currentEventTimestamp); 459 492 currentSequence.add(event);
Note: See TracChangeset
for help on using the changeset viewer.