Changeset 713 for trunk/quest-plugin-jfc/src/main
- Timestamp:
- 08/30/12 14:07:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs/quest/plugin/jfc/JFCLogParser.java
r704 r713 12 12 import java.util.Collection; 13 13 import java.util.HashMap; 14 import java.util.HashSet;15 14 import java.util.LinkedList; 16 15 import java.util.List; … … 149 148 * </p> 150 149 */ 151 ParamSource paramSource = null;150 private ParamSource paramSource = null; 152 151 153 152 /** … … 167 166 sequences = new LinkedList<List<Event>>(); 168 167 currentSequence = null; 169 setupDefaultEventFilter();168 //setupDefaultEventFilter(); 170 169 } 171 170 … … 340 339 } 341 340 else if ("hash".equals(atts.getValue("name"))) { 342 currentGuiElementSpec.setElementHash(atts.getValue("value")); 341 currentGuiElementSpec.setElementHash 342 (Integer.parseInt(atts.getValue("value"), 16)); 343 343 } 344 344 } … … 386 386 IGUIElement currentGUIElement; 387 387 try { 388 // TODO right now, there is null pointer exception possible, if the factory cannot create a the GUIElement. We need to devise where and how this should be handled best389 388 currentGUIElement = guiModel.integratePath 390 389 (currentGuiElementPath, GUIElementFactory.getInstance()); … … 628 627 try 629 628 { 630 String pattern = "([\\w$\\.]*)\\[.*\\]";631 632 Matcher matcher 1= Pattern.compile(pattern).matcher(toStringValue);633 634 if (!matcher 1.find())629 // match the following: <type>[<parameters>] 630 String pattern = "([\\w$\\.]*)\\[(.*)\\]"; 631 Matcher matcher = Pattern.compile(pattern).matcher(toStringValue); 632 633 if (!matcher.find()) 635 634 { 636 635 throw new IllegalArgumentException … … 638 637 } 639 638 640 String type = matcher1.group(1); 641 642 currentGuiElementSpec.setName("unknown"); 639 String type = matcher.group(1); 640 641 // match the following: <parameter>|, 642 // where <parameter> := <digitValue>|<value>|<key>"="<value> 643 pattern = "([\\w$@=\\.]*)|,"; 644 645 matcher = Pattern.compile(pattern).matcher(matcher.group(2)); 646 647 float elementHash = -1; 648 649 pattern = "(([\\d]*)|([\\w$]*)|(([\\w$@\\.]*)=([\\w$@\\.]*)))\\z"; 650 Pattern valuePattern = Pattern.compile(pattern); 651 652 while (matcher.find()) { 653 Matcher valueMatcher = valuePattern.matcher(matcher.group(1)); 654 if (valueMatcher.find()) { 655 if ((valueMatcher.group(2) != null) && (!"".equals(valueMatcher.group(2)))) { 656 // found digit value. Those in combination usually denote the position 657 // of the GUI element. So calculate an element has out of them 658 elementHash += Integer.parseInt(valueMatcher.group(2)); 659 } 660 else if ((valueMatcher.group(5) != null) && 661 (!"".equals(valueMatcher.group(5))) && 662 (valueMatcher.group(6) != null) && 663 (!"".equals(valueMatcher.group(6)))) 664 { 665 // found a key value pair. Get some of them and integrate them into the hash 666 String key = valueMatcher.group(5); 667 668 if ("alignmentX".equals(key) || "alignmentY".equals(key)) { 669 elementHash += Float.parseFloat(valueMatcher.group(6)); 670 } 671 } 672 } 673 } 674 675 currentGuiElementSpec.setName("unknown(" + ((int) elementHash) + ")"); 643 676 currentGuiElementSpec.setType(type); 644 currentGuiElementSpec.setIcon("unknown");645 677 currentGuiElementSpec.setIndex(-1); 646 currentGuiElementSpec.setElementHash( "-1");678 currentGuiElementSpec.setElementHash((int) elementHash); 647 679 } 648 680 catch (Exception e) … … 651 683 } 652 684 } 653 685 654 686 /** 655 687 * <p> … … 658 690 * </p> 659 691 */ 660 private void setupDefaultEventFilter() {692 /*private void setupDefaultEventFilter() { 661 693 eventFilter = new HashSet<JFCEventId>(); 662 694 eventFilter.add(JFCEventId.MOUSE_PRESSED); 663 695 eventFilter.add(JFCEventId.MOUSE_RELEASED); 664 696 eventFilter.add(JFCEventId.FOCUS_GAINED); 665 } 697 }*/ 666 698 667 699 }
Note: See TracChangeset
for help on using the changeset viewer.