Changeset 837 for trunk/quest-plugin-mfc/src/main/java/de
- Timestamp:
- 09/20/12 12:03:03 (12 years ago)
- Location:
- trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc
- Files:
-
- 1 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/EventGenerationRule.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc; 2 3 … … 11 12 /** 12 13 * <p> 13 * T ODO comment14 * This class defines rules for the generation of MFC events. 14 15 * </p> 15 16 * 16 * @version $Revision: $ $Date: 22.08.2012$17 * @author 2012, last modified by $Author: patrick$17 * @version 1.0 18 * @author Steffen Herbold, Patrick Harms 18 19 */ 19 20 class EventGenerationRule { … … 21 22 /** 22 23 * <p> 23 * the namespace used for parsing the rule24 * Namespace used for parsing the rule. 24 25 * </p> 25 26 */ … … 28 29 /** 29 30 * <p> 30 * the name of the rule31 * Name of the rule. 31 32 * </p> 32 33 */ … … 35 36 /** 36 37 * <p> 37 * the list of conditions for the rule to be matched38 * List of conditions for the rule to be matched. 38 39 * </p> 39 40 */ … … 42 43 /** 43 44 * <p> 44 * the list of parameters to be provided to the generated event45 * List of parameters to be provided to the generated event. 45 46 * </p> 46 47 */ … … 49 50 /** 50 51 * <p> 51 * the list of replay message generation rules52 * List of replay message generation rules. 52 53 * </p> 53 54 */ … … 56 57 /** 57 58 * <p> 58 * TODO: comment59 * </p> 60 * 59 * Constructor. Creates a new EventGenerationRule. 60 * </p> 61 * 61 62 * @param ruleElement 62 * @param rulesNamespace 63 * the JDOM element that descripes the rule 64 * @param rulesNamespace 65 * the XML namespace the rule is defined in 63 66 */ 64 67 @SuppressWarnings("unchecked") 65 68 EventGenerationRule(Element ruleElement, Namespace rulesNamespace) { 66 69 this.namespace = rulesNamespace; 67 70 68 71 this.name = ruleElement.getAttributeValue("name"); 69 72 70 73 this.messageConditions = new ArrayList<MessageCondition>(); 71 74 this.eventParameters = new ArrayList<Term>(); 72 75 this.replayMessageSpecifications = new ArrayList<ReplayMessageSpec>(); 73 76 74 77 for (Element child : (List<Element>) ruleElement.getChildren()) { 75 78 if ("msg".equals(child.getName()) && namespace.equals(child.getNamespace())) { … … 84 87 replayMessageSpecifications.add(new ReplayMessageSpec(child)); 85 88 } 86 else if ("genMsgSeq".equals(child.getName()) && namespace.equals(child.getNamespace())) { 89 else if ("genMsgSeq".equals(child.getName()) && namespace.equals(child.getNamespace())) 90 { 87 91 replayMessageSpecifications.add(new ReplayMessageSpec(child)); 88 92 } 89 93 else { 90 throw new IllegalArgumentException 91 ("the provided rules can not be parsed: unknown element " + child.getName()); 94 throw new IllegalArgumentException( 95 "the provided rules can not be parsed: unknown element " + 96 child.getName()); 92 97 } 93 98 } … … 95 100 96 101 /** 102 * <p> 103 * Returns the name of the rule. 104 * </p> 105 * 97 106 * @return the name 98 107 */ … … 103 112 /** 104 113 * <p> 105 * TODO: comment106 * </p> 107 * 108 * @return 114 * Returns the conditions on the matched messages defined by this rule. 115 * </p> 116 * 117 * @return the message conditions 109 118 */ 110 119 List<MessageCondition> getMessageConditions() { … … 114 123 /** 115 124 * <p> 116 * TODO: comment117 * </p> 118 * 119 * @return 125 * Returns the parameters of the event generated by this rule. 126 * </p> 127 * 128 * @return the event parameters 120 129 */ 121 130 List<Term> getEventParameters() { … … 125 134 /** 126 135 * <p> 127 * TODO: comment128 * </p> 129 * 130 * @return 136 * Returns the replay specification defined by this rule. 137 * </p> 138 * 139 * @return the replay specification 131 140 */ 132 141 List<ReplayMessageSpec> getReplayMessageSpecifications() { … … 136 145 /** 137 146 * <p> 138 * TODO comment147 * Helper class that describes conditions on the message sequence when matching this rule. 139 148 * </p> 140 149 * 141 * @version $Revision: $ $Date: 22.08.2012$142 * @author 2012, last modified by $Author: patrick$150 * @version 1.0 151 * @author Steffen Herbold, Patrick Harms 143 152 */ 144 153 class MessageCondition { … … 146 155 /** 147 156 * <p> 148 * true, if the condition defines to match several conditions157 * True, if the condition defines to match several conditions 149 158 * </p> 150 159 */ 151 160 private boolean matchMultiple; 152 153 /** 154 * <p> 155 * the type of the message matched by the condition161 162 /** 163 * <p> 164 * Type of the message matched by the condition 156 165 * </p> 157 166 */ … … 160 169 /** 161 170 * <p> 162 * the term conditions associatewith the rule condition171 * Term conditions associated with the rule condition 163 172 * </p> 164 173 */ … … 167 176 /** 168 177 * <p> 169 * the list of messages to be stored, if the message matches, for continuing the170 * ruleapplication178 * List of messages to be stored, if the message matches, for continuing the rule 179 * application 171 180 * </p> 172 181 */ … … 175 184 /** 176 185 * <p> 177 * TODO: comment178 * </p> 179 * 186 * Constructor. Creates a new MessageCondition. 187 * </p> 188 * 180 189 * @param msgChild 190 * JDOM element that describes the message condition 181 191 */ 182 192 @SuppressWarnings("unchecked") … … 185 195 this.messageType = 186 196 WindowsMessageType.parseMessageType(msgChild.getAttributeValue("type")); 187 197 188 198 this.attributeConditions = new ArrayList<AttributeCondition>(); 189 199 for (Element childElement : (List<Element>) msgChild.getChildren("equals", namespace)) { 190 200 attributeConditions.add(new AttributeCondition(childElement)); 191 201 } 192 202 193 203 this.messagesToStore = new ArrayList<Term>(); 194 204 for (Element childElement : (List<Element>) msgChild.getChildren("store", namespace)) { 195 205 messagesToStore.add(new Term(childElement)); 196 206 } 197 for (Element childElement : 198 (List<Element>) msgChild.getChildren("storeSeq", namespace)) 207 for (Element childElement : (List<Element>) msgChild.getChildren("storeSeq", namespace)) 199 208 { 200 209 messagesToStore.add(new Term(childElement)); … … 203 212 204 213 /** 205 * @return the matchMultiple 214 * <p> 215 * Returns whether a single message is matched to the condition or a whole sequence can be 216 * matched. 217 * </p> 218 * 219 * @return true if multiple message shall be matched, false if only a single message is 220 * matched 206 221 */ 207 222 boolean matchMultiple() { … … 211 226 /** 212 227 * <p> 213 * TODO: comment214 * </p> 215 * 216 * @return 228 * Returns the type of the matched messages. 229 * </p> 230 * 231 * @return the message type 217 232 */ 218 233 WindowsMessageType getMessageType() { … … 222 237 /** 223 238 * <p> 224 * TODO: comment225 * </p> 226 * 227 * @return 239 * Returns the attribute conditions of the message condition. 240 * </p> 241 * 242 * @return the attribute conditions 228 243 */ 229 244 List<AttributeCondition> getAttributeConditions() { … … 232 247 233 248 /** 234 * @return the valuesToStore 249 * <p> 250 * Returns messages, that have eventually been stored as part of the condition. 251 * </p> 252 * 253 * @return the stored messages 235 254 */ 236 255 ArrayList<Term> getMessagesToStore() { … … 242 261 /** 243 262 * <p> 244 * TODO comment263 * Helper class that defines attribute conditions for matching messages. 245 264 * </p> 246 265 * 247 * @version $Revision: $ $Date: 22.08.2012$248 * @author 2012, last modified by $Author: patrick$266 * @version 1.0 267 * @author Steffen Herbold, Patrick Harms 249 268 */ 250 269 class AttributeCondition { … … 252 271 /** 253 272 * <p> 254 * the left hand side of the condition273 * Left hand side of the condition. 255 274 * </p> 256 275 */ 257 276 private Term leftHandSide; 258 259 /** 260 * <p> 261 * the left hand side of the condition277 278 /** 279 * <p> 280 * Reft hand side of the condition. 262 281 * </p> 263 282 */ … … 266 285 /** 267 286 * <p> 268 * TODO: comment 269 * </p> 270 * 271 * @param childElement 287 * Constructor. Creates a new AttributeCondition. 288 * </p> 289 * 290 * @param conditionElement 291 * JDOM element that describes the condition 272 292 */ 273 293 private AttributeCondition(Element conditionElement) { … … 275 295 this.rightHandSide = new Term((Element) conditionElement.getChildren().get(1)); 276 296 } 277 278 /** 279 * @return the leftHandSide 297 298 /** 299 * <p> 300 * Returns the left hand side of the condition. 301 * </p> 302 * 303 * @return the left hand side 280 304 */ 281 305 Term getLeftHandSide() { … … 284 308 285 309 /** 286 * @return the rightHandSide 310 * <p> 311 * Returns the right hand side of the condition. 312 * </p> 313 * 314 * @return the right hand side 287 315 */ 288 316 Term getRightHandSide() { … … 294 322 /** 295 323 * <p> 296 * TODO comment324 * Helper class that defines terms to define conditions. 297 325 * </p> 298 326 * 299 * @version $Revision: $ $Date: 22.08.2012$300 * @author 2012, last modified by $Author: patrick$327 * @version 1.0 328 * @author Steffen Herbold, Patrick Harms 301 329 */ 302 330 class Term { … … 304 332 /** 305 333 * <p> 306 * the name of the term334 * Name of the term. 307 335 * </p> 308 336 */ 309 337 private String name; 310 311 /** 312 * <p> 313 * the value of the term, if it is a constValue, null instead338 339 /** 340 * <p> 341 * Value of the term, if it is a constValue; null otherwise. 314 342 * </p> 315 343 */ … … 318 346 /** 319 347 * <p> 320 * the variable name of the object, i.e. a message, of which a parameter is identified if321 * t he term is a winInfoValue or a msgInfoValue; null instead348 * Variable name of the object, i.e. a message, of which a parameter is identified if the 349 * term is a winInfoValue or a msgInfoValue; null otherwise. 322 350 * </p> 323 351 */ … … 326 354 /** 327 355 * <p> 328 * the name of the parameter of the object, e.g. a message, of which a parameter is329 * i dentified if the term is a paramValue, null instead356 * Name of the parameter of the object, i.e., a message, of which a parameter is identified 357 * if the term is a paramValue; null otherwise. 330 358 * </p> 331 359 */ … … 334 362 /** 335 363 * <p> 336 * the variable name of the message sequence denoted by the term in case of a seqValue;337 * null instead364 * Variable name of the message sequence denoted by the term in case of a seqValue; null 365 * otherwise. 338 366 * </p> 339 367 */ … … 342 370 /** 343 371 * <p> 344 * the name of the parameter of the sequence of which a parameter is345 * identified if the term is a seqValue, null instead372 * Name of the parameter of the sequence of which a parameter is identified if the term is a 373 * seqValue; null otherwise. 346 374 * </p> 347 375 */ … … 350 378 /** 351 379 * <p> 352 * the name of the parameter of the window of the object, e.g. a message, of which a353 * parameter is identified if the term is a winInfoValue, null instead380 * Name of the parameter of the window of the object, e.g. a message, of which a parameter 381 * is identified if the term is a winInfoValue; null otherwise. 354 382 * </p> 355 383 */ … … 358 386 /** 359 387 * <p> 360 * the name of the info of the message of which a parameter is identified if the361 * term is a msgInfoValue, null instead388 * Name of the info of the message of which a parameter is identified if the term is a 389 * msgInfoValue; null otherwise. 362 390 * </p> 363 391 */ … … 366 394 /** 367 395 * <p> 368 * the name of the parameter of the message into which a value shall be stored if the369 * term is a resolveHwnd, null instead396 * Name of the parameter of the message into which a value shall be stored if the term is a 397 * resolveHwnd, null otherwise 370 398 * </p> 371 399 */ … … 374 402 /** 375 403 * <p> 376 * the list of handles to be resolved in case the term is a store or storeSeq, null instead404 * List of handles to be resolved in case the term is a store or storeSeq; null otherwise. 377 405 * </p> 378 406 */ … … 381 409 /** 382 410 * <p> 383 * TODO: comment 384 * </p> 385 * 386 * @param object 411 * Constructor. Creates a new Term. 412 * </p> 413 * 414 * @param termElement 415 * JDOM element that describes the term 387 416 */ 388 417 @SuppressWarnings("unchecked") 389 418 private Term(Element termElement) { 390 419 this.name = termElement.getName(); 391 420 392 421 if ("constValue".equals(name)) { 393 422 this.value = termElement.getAttributeValue("value"); … … 434 463 435 464 /** 465 * <p> 466 * Returns the name of the term. 467 * </p> 468 * 436 469 * @return the name 437 470 */ … … 441 474 442 475 /** 476 * <p> 477 * Returns the value of the term. 478 * </p> 479 * 443 480 * @return the value 444 481 */ … … 448 485 449 486 /** 450 * @return the object 487 * <p> 488 * Returns the object Id of the message, which is resolved as part of this term. 489 * </p> 490 * 491 * @return the object Id 451 492 */ 452 493 String getMessageId() { … … 455 496 456 497 /** 457 * @return the objectParameter 498 * <p> 499 * Returns the name of the message parameter that is resolved as part of this term. 500 * </p> 501 * 502 * @return the message parameter name 458 503 */ 459 504 String getMessageParameterName() { … … 462 507 463 508 /** 464 * @return the sequenceId 509 * <p> 510 * Returns the object Id of the message sequence, which is resolved as part of this term. 511 * </p> 512 * 513 * @return the object Id 465 514 */ 466 515 String getSequenceId() { … … 469 518 470 519 /** 520 * <p> 521 * Returns the name of the message parameter that is resolved as part of this term. 522 * </p> 523 * 471 524 * @return the sequenceParameter 472 525 */ … … 476 529 477 530 /** 478 * @return the windowParameter 531 * <p> 532 * Returns the window parameter name that is resolved as part of this term. 533 * </p> 534 * 535 * @return the name of the window parameter 479 536 */ 480 537 String getWindowParameterName() { … … 483 540 484 541 /** 485 * @return the messageParameter 542 * <p> 543 * Returns the name of the message info value that is resolved as part of this term. 544 * </p> 545 * 546 * @return the name of the message info value 486 547 */ 487 548 String getMessageInfoName() { … … 490 551 491 552 /** 492 * @return the storeParameter 553 * <p> 554 * Returns the object Id under which a message will be stored. 555 * </p> 556 * 557 * @return the object Id 493 558 */ 494 559 String getStoreParameterName() { … … 497 562 498 563 /** 499 * @return the resolveHandles 564 * <p> 565 * Returns all terms that are responsible to resolve HWNDs. 566 * </p> 567 * 568 * @return the terms 500 569 */ 501 570 List<Term> getResolveHandles() { … … 504 573 505 574 } 506 507 /** 508 * <p> 509 * TODO comment575 576 /** 577 * <p> 578 * Helper class that defines the replay specification part of rules. 510 579 * </p> 511 580 * 512 * @version $Revision: $ $Date: 22.08.2012$513 * @author 2012, last modified by $Author: patrick$581 * @version 1.0 582 * @author Steffen Herbold, Patrick Harms 514 583 */ 515 584 class ReplayMessageSpec { … … 517 586 /** 518 587 * <p> 519 * determines, if this specification defines one, or a sequence of messages588 * Determines if this specification defines one, or a sequence of messages. 520 589 * </p> 521 590 */ 522 591 private boolean generateSingleMessage; 523 524 /** 525 * <p> 526 * the id of a concrete message of message sequence to be replayed as is592 593 /** 594 * <p> 595 * Object Id of a concrete message of message sequence to be replayed as is. 527 596 * </p> 528 597 */ 529 598 private String replayObjectId; 530 599 600 /** 601 * <p> 602 * Term describing the type of the generated message. 603 * </p> 604 */ 531 605 private Term type; 532 606 607 /** 608 * <p> 609 * Term describing the target of the generated message. 610 * </p> 611 */ 533 612 private Term target; 534 613 614 /** 615 * <p> 616 * Term describing the LO word of the LParam of the generated message. 617 * </p> 618 */ 535 619 private Term lparamLoWord; 536 620 621 /** 622 * <p> 623 * Term describing the HI word of the LParam of the generated message. 624 * </p> 625 */ 537 626 private Term lparamHiWord; 538 627 628 /** 629 * <p> 630 * Term describing the LParam of the generated message. 631 * </p> 632 */ 539 633 private Term lparam; 540 634 635 /** 636 * <p> 637 * Term describing the LO word of the WParam of the generated message. 638 * </p> 639 */ 541 640 private Term wparamLoWord; 542 641 642 /** 643 * <p> 644 * Term describing the HI word of the WParam of the generated message. 645 * </p> 646 */ 543 647 private Term wparamHiWord; 544 648 649 /** 650 * <p> 651 * Term describing the WParam of the generated message. 652 * </p> 653 */ 545 654 private Term wparam; 546 655 656 /** 657 * <p> 658 * Value in milliseconds that the replay waits until the the next message is replayed. 659 * </p> 660 */ 547 661 private int delay; 548 549 /** 550 * <p> 551 * TODO: comment 552 * </p> 553 * 554 * @param child 662 663 /** 664 * <p> 665 * Constructor. Creates a new ReplayMessageSpec. 666 * </p> 667 * 668 * @param replayMessageSpecElement 669 * JDOM element that describes the replay message specification 555 670 */ 556 671 @SuppressWarnings("unchecked") … … 569 684 } 570 685 } 571 686 572 687 this.delay = Integer.parseInt(replayMessageSpecElement.getAttributeValue("delay")); 573 688 574 689 if (children.size() > 1) { 575 690 for (Element child : children) { 576 691 Element termElement = (Element) child.getChildren().get(0); 577 692 578 693 if (child.getName().equals("type")) { 579 694 this.type = new Term(termElement); … … 581 696 else if (child.getName().equals("target")) { 582 697 this.target = new Term(termElement); 583 698 584 699 if (!generateSingleMessage) { 585 700 // in this case, the target is always a sequence value term, i.e. … … 595 710 new Term((Element) loWordElement.getChildren().get(0)); 596 711 } 597 712 598 713 Element hiWordElement = child.getChild("HIWORD", namespace); 599 714 if (hiWordElement != null) { 600 715 this.lparamHiWord = 601 716 new Term((Element) hiWordElement.getChildren().get(0)); 602 717 } 603 718 604 719 if ((lparamLoWord == null) && (lparamHiWord == null)) { 605 720 this.lparam = new Term(termElement); … … 612 727 new Term((Element) loWordElement.getChildren().get(0)); 613 728 } 614 729 615 730 Element hiWordElement = child.getChild("HIWORD", namespace); 616 731 if (hiWordElement != null) { 617 732 this.wparamHiWord = 618 733 new Term((Element) hiWordElement.getChildren().get(0)); 619 734 } 620 735 621 736 if ((wparamLoWord == null) && (wparamHiWord == null)) { 622 737 this.wparam = new Term(termElement); … … 629 744 /** 630 745 * <p> 631 * TODO: comment632 * </p> 633 * 634 * @return 746 * Determines if this specification defines one, or a sequence of messages. 747 * </p> 748 * 749 * @return true if only a single message is generated; false if a sequence is generated 635 750 */ 636 751 boolean generateSingleMessage() { … … 640 755 /** 641 756 * <p> 642 * TODO: comment643 * </p> 644 * 645 * @return 757 * Returns the object Id from which the message is generated. 758 * </p> 759 * 760 * @return the object Id 646 761 */ 647 762 String getReplayObjectId() { … … 650 765 651 766 /** 652 * @return the type 767 * <p> 768 * Returns the term that describes the type of the generated message. 769 * </p> 770 * 771 * @return the type term 653 772 */ 654 773 Term getType() { … … 657 776 658 777 /** 659 * @return the target 778 * <p> 779 * Returns the term that describes the target of the generated message. 780 * </p> 781 * 782 * @return the target term 660 783 */ 661 784 Term getTarget() { … … 664 787 665 788 /** 666 * @return the lparamLoWord 789 * <p> 790 * Returns the term that describes the LO word of the LParam of the generated message. 791 * </p> 792 * 793 * @return the LParam LO word term 667 794 */ 668 795 Term getLparamLoWord() { … … 671 798 672 799 /** 673 * @return the lparamHiWord 800 * <p> 801 * Returns the term that describes the HI word of the LParam of the generated message. 802 * </p> 803 * 804 * @return the LParam HI word term 674 805 */ 675 806 Term getLparamHiWord() { … … 678 809 679 810 /** 680 * @return the lparam 811 * <p> 812 * Returns the term that describes the LParam of the generated message. 813 * </p> 814 * 815 * @return the LParam term 681 816 */ 682 817 Term getLparam() { … … 685 820 686 821 /** 687 * @return the wparamLoWord 822 * <p> 823 * Returns the term that describes the LO word of the WParam of the generated message. 824 * </p> 825 * 826 * @return the WParam LO word term 688 827 */ 689 828 Term getWparamLoWord() { … … 692 831 693 832 /** 694 * @return the wparamHiWord 833 * <p> 834 * Returns the term that describes the HI word of the WParam of the generated message. 835 * </p> 836 * 837 * @return the WParam HI word term 695 838 */ 696 839 Term getWparamHiWord() { … … 699 842 700 843 /** 701 * @return the wparam 844 * <p> 845 * Returns the term that describes the WParam of the generated message. 846 * </p> 847 * 848 * @return the WParam term 702 849 */ 703 850 Term getWparam() { … … 706 853 707 854 /** 855 * <p> 856 * Returns the delay during the replay after this message is sent. 857 * </p> 858 * 708 859 * @return the delay 709 860 */ -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/EventGenerator.java
r775 r837 32 32 * <p> 33 33 * Translates sequences of windows messages into {@link WindowsEvent}s that can be used by the 34 * EventBenchcore libraries.34 * QUEST core libraries. 35 35 * </p> 36 36 * 37 * @author Steffen Herbold38 37 * @version 1.0 38 * @author Steffen Herbold, Patrick Harms 39 39 */ 40 40 public class EventGenerator { … … 220 220 /** 221 221 * <p> 222 * TODO: comment222 * Evaluates whether the current message sequence matches a given rule. 223 223 * </p> 224 224 * 225 * @param currentRule 225 * @param currentRule rule that is matched 226 * @return true if the message sequence matches the rule; false otherwise 226 227 */ 227 228 private boolean evaluateMessageConditions(EventGenerationRule currentRule) { … … 742 743 /** 743 744 * <p> 744 * TODO: comment745 * Resolves the parameters described by {@link Term}s. 745 746 * </p> 746 747 * 747 * @param eventParameters 748 * @return 748 * @param eventParameters terms whose parameters are resolved 749 * @return resolved parameters 749 750 */ 750 751 private Map<String, String> resolveParameters(List<Term> eventParameters) { … … 947 948 /** 948 949 * <p> 949 * convenience method for {@link #getTermValueAsList(WindowsMessage, Term)} with current950 * Convenience method for {@link #getTermValueAsList(WindowsMessage, Term)} with current 950 951 * message is null. 951 952 * </p> … … 996 997 /** 997 998 * <p> 998 * TODO: comment999 * Resolves term values. 999 1000 * </p> 1000 1001 * 1001 * @param value 1002 * @param expectedType 1003 * @return 1002 * @param value value to be resolved 1003 * @param expectedType class defining the expected type 1004 * @return resolved value 1004 1005 */ 1005 1006 @SuppressWarnings("unchecked") … … 1076 1077 /** 1077 1078 * <p> 1078 * TODO: comment1079 * Parses the rules. 1079 1080 * </p> 1080 1081 * … … 1091 1092 catch (JDOMException e) { 1092 1093 Console.printerrln("Invalid rules file."); 1093 // TODO handle Exception 1094 e.printStackTrace(); 1094 Console.logException(e); 1095 1095 return; 1096 1096 } 1097 1097 catch (IOException e) { 1098 1098 Console.printerrln("Invalid rules file."); 1099 // TODO handle Exception 1100 e.printStackTrace(); 1099 Console.logException(e); 1101 1100 return; 1102 1101 } -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/MFCLogParser.java
r774 r837 172 172 } 173 173 catch (UnsupportedEncodingException e) { 174 // TODO handle Exception175 e.printStackTrace();174 Console.printerr("Error parsing file " + file.getName()); 175 Console.logException(e); 176 176 } 177 177 catch (ParserConfigurationException e) { 178 // TODO handle Exception179 e.printStackTrace();178 Console.printerr("Error parsing file " + file.getName()); 179 Console.logException(e); 180 180 } 181 181 catch (SAXException e) { 182 // TODO handle Exception183 e.printStackTrace();182 Console.printerr("Error parsing file " + file.getName()); 183 Console.logException(e); 184 184 } 185 185 catch (FileNotFoundException e) { 186 // TODO handle Exception187 e.printStackTrace();186 Console.printerr("Error parsing file " + file.getName()); 187 Console.logException(e); 188 188 } 189 189 … … 202 202 } 203 203 catch (SAXException e) { 204 // TODO handle Exception205 e.printStackTrace();204 Console.printerr("Error parsing file " + file.getName()); 205 Console.logException(e); 206 206 } 207 207 catch (IOException e) { 208 // TODO handle Exception209 e.printStackTrace();208 Console.printerr("Error parsing file " + file.getName()); 209 Console.logException(e); 210 210 } 211 211 } -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/MFCEventTypeFactory.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.eventcore; 2 3 … … 4 5 5 6 import de.ugoe.cs.quest.eventcore.IEventType; 7 import de.ugoe.cs.quest.eventcore.gui.IInteraction; 6 8 import de.ugoe.cs.quest.eventcore.gui.KeyPressed; 7 9 import de.ugoe.cs.quest.eventcore.gui.KeyReleased; … … 14 16 /** 15 17 * <p> 16 * TODO comment18 * Creates the GUI event types (i.e., {@link IInteraction}s) for MFC events. 17 19 * </p> 18 20 * 19 * @version $Revision: $ $Date: 21.08.2012$20 * @author 2012, last modified by $Author: pharms$21 * @version 1.0 22 * @author Patrick Harms 21 23 */ 22 24 public class MFCEventTypeFactory { 23 25 24 26 /** 25 27 * <p> 26 * the instance of the singleton28 * Instance of the singleton 27 29 * </p> 28 30 */ … … 31 33 /** 32 34 * <p> 33 * TODO: comment35 * Constructor. Creates a new MFCEventTypeFactory. Private to preserve singleton property. 34 36 * </p> 35 * 37 * 36 38 */ 37 private MFCEventTypeFactory() { 38 // prevent external instantiation 39 } 39 private MFCEventTypeFactory() {} 40 40 41 41 /** 42 42 * <p> 43 * TODO: comment43 * Returns the instance of the MFCEventTypeFactory. 44 44 * </p> 45 * 46 * @return 45 * 46 * @return the instance 47 47 */ 48 48 public static MFCEventTypeFactory getInstance() { … … 52 52 /** 53 53 * <p> 54 * TODO: comment54 * Returns the event type based on the name and parameters of a MFC event. 55 55 * </p> 56 * 57 * @param currentRuleName 58 * @return 56 * 57 * @param eventName 58 * name of the MFC event 59 * @param messageParameters 60 * parameters of the MFC event 61 * @return the event type 59 62 */ 60 public IEventType getEventType(String eventName, 61 Map<String, String> messageParameters) 62 { 63 public IEventType getEventType(String eventName, Map<String, String> messageParameters) { 63 64 if ("LeftClickButton".equals(eventName)) { 64 65 return new MouseClick(MouseButtonInteraction.Button.LEFT); … … 136 137 137 138 /** 138 * @param message 139 * @return 139 * <p> 140 * If the message parameters contain information about a key that has been pressed, the 141 * associated {@link VirtualKey} is returned. 142 * </p> 143 * 144 * @param messageParameters 145 * the message parameters 146 * @return key extracted from the message parameters 147 * @throws IllegalArgumentException 148 * thrown if the messageParameters do not contain information about a key 140 149 */ 141 private VirtualKey getKey(Map<String, String> messageParameters) { 150 private VirtualKey getKey(Map<String, String> messageParameters) 151 throws IllegalArgumentException 152 { 142 153 String value = null; 143 154 144 155 if (messageParameters != null) { 145 156 value = messageParameters.get("key"); 146 157 } 147 158 148 159 if (value == null) { 149 160 throw new IllegalArgumentException … … 157 168 /** 158 169 * <p> 159 * TODO: comment 170 * If the message parameters contain information about a scroll position, the respective 171 * position is returned. 160 172 * </p> 161 * 173 * 162 174 * @param messageParameters 163 * @return 175 * the message parameters 176 * @return the scroll position 177 * @throws IllegalArgumentException 178 * thrown if the messageParameters do not contain information about a scroll 179 * position 164 180 */ 165 private int getSelectedValue(Map<String, String> messageParameters) { 181 private int getSelectedValue(Map<String, String> messageParameters) 182 throws IllegalArgumentException 183 { 166 184 String value = null; 167 185 168 186 if (messageParameters != null) { 169 187 value = messageParameters.get("scrollPos"); 170 188 } 171 189 172 190 if (value == null) { 173 191 throw new IllegalArgumentException -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/ReplayWindowsMessage.java
r655 r837 200 200 /** 201 201 * <p> 202 * TODO: comment202 * Sets the XML target string. 203 203 * </p> 204 204 * 205 * @param t ermValue205 * @param targetXML the target string 206 206 */ 207 207 public void setTargetXML(String targetXML) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsMessage.java
r774 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.eventcore; 2 3 … … 17 18 * 18 19 */ 19 public class WindowsMessage 20 public class WindowsMessage implements Serializable { 20 21 21 22 /** … … 76 77 * @param type 77 78 * type of the message 78 * @param currentMessageParameters 79 * @param target 80 */ 81 public WindowsMessage(WindowsMessageType 82 MFCGUIElement 79 * @param currentMessageParameters 80 * @param target 81 */ 82 public WindowsMessage(WindowsMessageType type, 83 MFCGUIElement target, 83 84 Map<String, Object> messageParameters) 84 85 { 85 86 this.type = type; 86 87 setTarget(target); 87 88 88 89 for (Map.Entry<String, Object> entry : messageParameters.entrySet()) { 89 90 addParameter(entry.getKey(), entry.getValue()); … … 99 100 * type of the message 100 101 */ 101 public WindowsMessage(WindowsMessageType type) 102 { 102 public WindowsMessage(WindowsMessageType type) { 103 103 this.type = type; 104 104 } … … 137 137 /** 138 138 * <p> 139 * TODO: comment 140 * </p> 141 * 142 * @param target2 139 * Sets the message target. 140 * </p> 141 * 142 * @param target 143 * the target 143 144 */ 144 145 public void setTarget(MFCGUIElement target) { … … 149 150 /** 150 151 * <p> 151 * TODO: comment152 * </p> 153 * 154 * @return 152 * Returns the target of the message. 153 * </p> 154 * 155 * @return the target 155 156 */ 156 157 public MFCGUIElement getTarget() { 157 158 return target; 158 159 } 159 160 160 161 /** 161 162 * <p> … … 189 190 isEqual = 190 191 ((WindowsMessage) other).type == this.type && 191 ((WindowsMessage) other).target.equals(this.target) &&192 ((WindowsMessage) other).params.equals(this.params);192 ((WindowsMessage) other).target.equals(this.target) && 193 ((WindowsMessage) other).params.equals(this.params); 193 194 } 194 195 return isEqual; … … 259 260 /** 260 261 * <p> 261 * TODO: comment262 * </p> 263 * 264 * @return 262 * Returns the parameters associated with this message. 263 * </p> 264 * 265 * @return the parameters 265 266 */ 266 267 protected Map<String, Object> getParameters() { … … 270 271 /** 271 272 * <p> 272 * TODO: comment273 * </p> 274 * 275 * @return 273 * Returns the XML target description of this message. 274 * </p> 275 * 276 * @return the XML target description 276 277 */ 277 278 public String getTargetXML() { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsMessageType.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.eventcore; 2 3 3 4 /** 4 * TODO comment 5 * <p> 6 * Enumeration to deal with MFC message types. 7 * </p> 5 8 * 6 * @version $Revision: $ $Date: $7 * @author 2011, last modified by $Author: $9 * @version 1.0 10 * @author Patrick Harms, Steffen Herbold 8 11 */ 9 12 public enum WindowsMessageType { 10 11 WM_NULL(0), 12 WM_CREATE(1), 13 WM_DESTROY(2), 14 WM_MOVE(3), 15 WM_SIZE(5), 16 WM_ACTIVATE(6), 17 WM_SETFOCUS(7), 18 WM_KILLFOCUS(8), 19 WM_ENABLE(10), 20 WM_SETREDRAW(11), 21 WM_SETTEXT(12), 22 WM_GETTEXT(13), 23 WM_GETTEXTLENGTH(14), 24 WM_PAINT(15), 25 WM_CLOSE(16), 26 WM_QUERYENDSESSION(17), 27 WM_QUIT(18), 28 WM_QUERYOPEN(19), 29 WM_ERASEBKGND(20), 30 WM_SYSCOLORCHANGE(21), 31 WM_ENDSESSION(22), 32 WM_SHOWWINDOW(24), 33 WM_CTLCOLOR(25), 34 WM_WININICHANGE(26), 35 WM_DEVMODECHANGE(27), 36 WM_ACTIVATEAPP(28), 37 WM_FONTCHANGE(29), 38 WM_TIMECHANGE(30), 39 WM_CANCELMODE(31), 40 WM_SETCURSOR(32), 41 WM_MOUSEACTIVATE(33), 42 WM_CHILDACTIVATE(34), 43 WM_QUEUESYNC(35), 44 WM_GETMINMAXINFO(36), 45 WM_PAINTICON(38), 46 WM_ICONERASEBKGND(39), 47 WM_NEXTDLGCTL(40), 48 WM_SPOOLERSTATUS(42), 49 WM_DRAWITEM(43), 50 WM_MEASUREITEM(44), 51 WM_DELETEITEM(45), 52 WM_VKEYTOITEM(46), 53 WM_CHARTOITEM(47), 54 WM_SETFONT(48), 55 WM_GETFONT(49), 56 WM_SETHOTKEY(50), 57 WM_GETHOTKEY(51), 58 WM_QUERYDRAGICON(55), 59 WM_COMPAREITEM(57), 60 WM_GETOBJECT(61), 61 WM_COMPACTING(65), 62 WM_COMMNOTIFY(68), 63 WM_WINDOWPOSCHANGING(70), 64 WM_WINDOWPOSCHANGED(71), 65 WM_POWER(72), 66 WM_COPYDATA(74), 67 WM_CANCELJOURNAL(75), 68 WM_NOTIFY(78), 69 WM_INPUTLANGCHANGEREQUEST(80), 70 WM_INPUTLANGCHANGE(81), 71 WM_TCARD(82), 72 WM_HELP(83), 73 WM_USERCHANGED(84), 74 WM_NOTIFYFORMAT(85), 75 WM_CONTEXTMENU(123), 76 WM_STYLECHANGING(124), 77 WM_STYLECHANGED(125), 78 WM_DISPLAYCHANGE(126), 79 WM_GETICON(127), 80 WM_SETICON(128), 81 WM_NCCREATE(129), 82 WM_NCDESTROY(130), 83 WM_NCCALCSIZE(131), 84 WM_NCHITTEST(132), 85 WM_NCPAINT(133), 86 WM_NCACTIVATE(134), 87 WM_GETDLGCODE(135), 88 WM_SYNCPAINT(136), 89 WM_NCMOUSEMOVE(160), 90 WM_NCLBUTTONDOWN(161), 91 WM_NCLBUTTONUP(162), 92 WM_NCLBUTTONDBLCLK(163), 93 WM_NCRBUTTONDOWN(164), 94 WM_NCRBUTTONUP(165), 95 WM_NCRBUTTONDBLCLK(166), 96 WM_NCMBUTTONDOWN(167), 97 WM_NCMBUTTONUP(168), 98 WM_NCMBUTTONDBLCLK(169), 99 WM_NCXBUTTONDOWN(171), 100 WM_NCXBUTTONUP(172), 101 WM_NCXBUTTONDBLCLK(173), 102 SBM_SETPOS(224), 103 BM_CLICK(245), 104 WM_INPUT(255), 105 WM_KEYDOWN(256), 106 WM_KEYFIRST(256), 107 WM_KEYUP(257), 108 WM_CHAR(258), 109 WM_DEADCHAR(259), 110 WM_SYSKEYDOWN(260), 111 WM_SYSKEYUP(261), 112 WM_SYSCHAR(262), 113 WM_SYSDEADCHAR(263), 114 WM_KEYLAST(264), 115 WM_WNT_CONVERTREQUESTEX(265), 116 WM_CONVERTREQUEST(266), 117 WM_CONVERTRESULT(267), 118 WM_INTERIM(268), 119 WM_IME_STARTCOMPOSITION(269), 120 WM_IME_ENDCOMPOSITION(270), 121 WM_IME_COMPOSITION(271), 122 WM_IME_KEYLAST(271), 123 WM_INITDIALOG(272), 124 WM_COMMAND(273), 125 WM_SYSCOMMAND(274), 126 WM_TIMER(275), 127 WM_HSCROLL(276), 128 WM_VSCROLL(277), 129 WM_INITMENU(278), 130 WM_INITMENUPOPUP(279), 131 WM_MENUSELECT(287), 132 WM_MENUCHAR(288), 133 WM_ENTERIDLE(289), 134 WM_MENURBUTTONUP(290), 135 WM_MENUDRAG(291), 136 WM_MENUGETOBJECT(292), 137 WM_UNINTMENUPOPUP(293), 138 WM_MENUCOMMAND(294), 139 WM_CHANGEUISTATE(295), 140 WM_UPDATEUISTATE(296), 141 WM_QUERYUISTATE(297), 142 WM_CTLCOLORMSGBOX(306), 143 WM_CTLCOLOREDIT(307), 144 WM_CTLCOLORLISTBOX(308), 145 WM_CTLCOLORBTN(309), 146 WM_CTLCOLORDLG(310), 147 WM_CTLCOLORSCROLLBAR(311), 148 WM_CTLCOLORSTATIC(312), 149 CB_SHOWDROPDOWN(335), 150 LB_SETCURSEL(390), 151 WM_MOUSEFIRST(512), 152 WM_MOUSEMOVE(512), 153 WM_LBUTTONDOWN(513), 154 WM_LBUTTONUP(514), 155 WM_LBUTTONDBLCLK(515), 156 WM_RBUTTONDOWN(516), 157 WM_RBUTTONUP(517), 158 WM_RBUTTONDBLCLK(518), 159 WM_MBUTTONDOWN(519), 160 WM_MBUTTONUP(520), 161 WM_MBUTTONDBLCLK(521), 162 WM_MOUSELAST(521), 163 WM_MOUSEWHEEL(522), 164 WM_XBUTTONDOWN(523), 165 WM_XBUTTONUP(524), 166 WM_XBUTTONDBLCLK(525), 167 WM_USER(1024), 168 CB_SETCURSEL(334), 169 TBM_SETPOS(1029), 170 UDM_SETRANGE(1125), 171 TCM_SETCURSEL(4876); 172 173 /** the numerical representation of the message type */ 13 14 WM_NULL(0), WM_CREATE(1), WM_DESTROY(2), WM_MOVE(3), WM_SIZE(5), WM_ACTIVATE(6), 15 WM_SETFOCUS(7), WM_KILLFOCUS(8), WM_ENABLE(10), WM_SETREDRAW(11), WM_SETTEXT(12), 16 WM_GETTEXT(13), WM_GETTEXTLENGTH(14), WM_PAINT(15), WM_CLOSE(16), WM_QUERYENDSESSION(17), 17 WM_QUIT(18), WM_QUERYOPEN(19), WM_ERASEBKGND(20), WM_SYSCOLORCHANGE(21), WM_ENDSESSION(22), 18 WM_SHOWWINDOW(24), WM_CTLCOLOR(25), WM_WININICHANGE(26), WM_DEVMODECHANGE(27), WM_ACTIVATEAPP( 19 28), WM_FONTCHANGE(29), WM_TIMECHANGE(30), WM_CANCELMODE(31), WM_SETCURSOR(32), 20 WM_MOUSEACTIVATE(33), WM_CHILDACTIVATE(34), WM_QUEUESYNC(35), WM_GETMINMAXINFO(36), 21 WM_PAINTICON(38), WM_ICONERASEBKGND(39), WM_NEXTDLGCTL(40), WM_SPOOLERSTATUS(42), WM_DRAWITEM( 22 43), WM_MEASUREITEM(44), WM_DELETEITEM(45), WM_VKEYTOITEM(46), WM_CHARTOITEM(47), 23 WM_SETFONT(48), WM_GETFONT(49), WM_SETHOTKEY(50), WM_GETHOTKEY(51), WM_QUERYDRAGICON(55), 24 WM_COMPAREITEM(57), WM_GETOBJECT(61), WM_COMPACTING(65), WM_COMMNOTIFY(68), 25 WM_WINDOWPOSCHANGING(70), WM_WINDOWPOSCHANGED(71), WM_POWER(72), WM_COPYDATA(74), 26 WM_CANCELJOURNAL(75), WM_NOTIFY(78), WM_INPUTLANGCHANGEREQUEST(80), WM_INPUTLANGCHANGE(81), 27 WM_TCARD(82), WM_HELP(83), WM_USERCHANGED(84), WM_NOTIFYFORMAT(85), WM_CONTEXTMENU(123), 28 WM_STYLECHANGING(124), WM_STYLECHANGED(125), WM_DISPLAYCHANGE(126), WM_GETICON(127), 29 WM_SETICON(128), WM_NCCREATE(129), WM_NCDESTROY(130), WM_NCCALCSIZE(131), WM_NCHITTEST(132), 30 WM_NCPAINT(133), WM_NCACTIVATE(134), WM_GETDLGCODE(135), WM_SYNCPAINT(136), 31 WM_NCMOUSEMOVE(160), WM_NCLBUTTONDOWN(161), WM_NCLBUTTONUP(162), WM_NCLBUTTONDBLCLK(163), 32 WM_NCRBUTTONDOWN(164), WM_NCRBUTTONUP(165), WM_NCRBUTTONDBLCLK(166), WM_NCMBUTTONDOWN(167), 33 WM_NCMBUTTONUP(168), WM_NCMBUTTONDBLCLK(169), WM_NCXBUTTONDOWN(171), WM_NCXBUTTONUP(172), 34 WM_NCXBUTTONDBLCLK(173), SBM_SETPOS(224), BM_CLICK(245), WM_INPUT(255), WM_KEYDOWN(256), 35 WM_KEYFIRST(256), WM_KEYUP(257), WM_CHAR(258), WM_DEADCHAR(259), WM_SYSKEYDOWN(260), 36 WM_SYSKEYUP(261), WM_SYSCHAR(262), WM_SYSDEADCHAR(263), WM_KEYLAST(264), 37 WM_WNT_CONVERTREQUESTEX(265), WM_CONVERTREQUEST(266), WM_CONVERTRESULT(267), WM_INTERIM(268), 38 WM_IME_STARTCOMPOSITION(269), WM_IME_ENDCOMPOSITION(270), WM_IME_COMPOSITION(271), 39 WM_IME_KEYLAST(271), WM_INITDIALOG(272), WM_COMMAND(273), WM_SYSCOMMAND(274), WM_TIMER(275), 40 WM_HSCROLL(276), WM_VSCROLL(277), WM_INITMENU(278), WM_INITMENUPOPUP(279), WM_MENUSELECT(287), 41 WM_MENUCHAR(288), WM_ENTERIDLE(289), WM_MENURBUTTONUP(290), WM_MENUDRAG(291), WM_MENUGETOBJECT( 42 292), WM_UNINTMENUPOPUP(293), WM_MENUCOMMAND(294), WM_CHANGEUISTATE(295), WM_UPDATEUISTATE( 43 296), WM_QUERYUISTATE(297), WM_CTLCOLORMSGBOX(306), WM_CTLCOLOREDIT(307), 44 WM_CTLCOLORLISTBOX(308), WM_CTLCOLORBTN(309), WM_CTLCOLORDLG(310), WM_CTLCOLORSCROLLBAR(311), 45 WM_CTLCOLORSTATIC(312), CB_SHOWDROPDOWN(335), LB_SETCURSEL(390), WM_MOUSEFIRST(512), 46 WM_MOUSEMOVE(512), WM_LBUTTONDOWN(513), WM_LBUTTONUP(514), WM_LBUTTONDBLCLK(515), 47 WM_RBUTTONDOWN(516), WM_RBUTTONUP(517), WM_RBUTTONDBLCLK(518), WM_MBUTTONDOWN(519), 48 WM_MBUTTONUP(520), WM_MBUTTONDBLCLK(521), WM_MOUSELAST(521), WM_MOUSEWHEEL(522), 49 WM_XBUTTONDOWN(523), WM_XBUTTONUP(524), WM_XBUTTONDBLCLK(525), WM_USER(1024), 50 CB_SETCURSEL(334), TBM_SETPOS(1029), UDM_SETRANGE(1125), TCM_SETCURSEL(4876); 51 52 /** 53 * <p> 54 * Numerical representation of the message type. 55 * </p> 56 */ 174 57 private int mNumber; 175 58 176 59 /** 60 * <p> 61 * Constructor. Creates a new WindowsMessageType. 62 * </p> 63 * 177 64 * @param number 65 * numerical representation of the message type 178 66 */ 179 67 WindowsMessageType(int number) { … … 182 70 183 71 /** 184 * @return Returns the number. 72 * <p> 73 * Returns the numerical representation of the message type. 74 * </p> 75 * 76 * @return the numerical representation 185 77 */ 186 78 public int getNumber() { … … 301 193 302 194 /** 303 * 304 */ 305 public static WindowsMessageType parseMessageType(String numberString) { 195 * <p> 196 * Parses an {@link String} and returns the respective WindowsMessageType if possible. 197 * </p> 198 * 199 * @param numberString 200 * String representation of the event type 201 * @return created WindowsMessageType 202 * @throws IllegalArgumentException 203 * thrown if there is no WindowsMessageType that correlates to numberString 204 */ 205 public static WindowsMessageType parseMessageType(String numberString) 206 throws IllegalArgumentException 207 { 306 208 try { 307 209 int number = Integer.parseInt(numberString); … … 314 216 315 217 /** 316 * 317 */ 318 public static WindowsMessageType valueOf(int number) { 218 * <p> 219 * Returns the WindowsMessageType associated with an integer. 220 * </p> 221 * 222 * @param number 223 * integer to which the according WindowsMessageType is returned 224 * @return the WindowsMessageType 225 * @throws IllegalArgumentException 226 * thrown if there is no WindowsMessageType that correlates to number 227 */ 228 public static WindowsMessageType valueOf(int number) throws IllegalArgumentException { 319 229 for (WindowsMessageType type : WindowsMessageType.values()) { 320 230 if (type.mNumber == number) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/eventcore/WindowsVirtualKey.java
r655 r837 5 5 6 6 /** 7 * TODO comment 7 * <p> 8 * Map of virtual keys for MFC. 9 * </p> 8 10 * 9 * @version $Revision: $ $Date: $10 * @author 2011, last modified by $Author: $11 * @version 1.0 12 * @author Patrick Harms 11 13 */ 12 // ------------------------------------------------------------------------------------------------- 13 14 public enum WindowsVirtualKey 15 { 14 public enum WindowsVirtualKey { 16 15 // VK_LBUTTON (0x01, "Left mouse button"), 17 16 // VK_RBUTTON (0x02, "Right mouse button"), … … 168 167 // VK_OEM_CLEAR (0xFE, "Clear key"); 169 168 170 /** the id of the virtual key */ 169 /** 170 * <p> 171 * Numerical representation of the virtual key. 172 * </p> 173 */ 171 174 private int mNumber; 172 175 173 /** the <code>Key</code> represented by this virtual key */ 176 /** 177 * <p> 178 * {@link VirtualKey} represented by this WindowsVirtualKey 179 * </p> 180 */ 174 181 private VirtualKey mRepresentedKey; 175 182 176 // ----------------------------------------------------------------------------------------------- 177 /** 183 /** 184 * <p> 185 * Constructor. Creates a new WindowsVirtualKey. 186 * </p> 187 * 178 188 * @param number 179 */ 180 // ----------------------------------------------------------------------------------------------- 181 WindowsVirtualKey(int number, VirtualKey representedKey) 182 { 189 * numerical representation of the virtual key 190 * @param representedKey 191 * virtual key that is represented 192 */ 193 WindowsVirtualKey(int number, VirtualKey representedKey) { 183 194 mNumber = number; 184 195 mRepresentedKey = representedKey; 185 196 } 186 197 187 // ----------------------------------------------------------------------------------------------- 188 /** 189 * @return Returns the number. 190 */ 191 // ----------------------------------------------------------------------------------------------- 192 int getNumber() 193 { 198 /** 199 * <p> 200 * Returns the numerical representation of the virtual key. 201 * </p> 202 * 203 * @return the numerical representation 204 */ 205 int getNumber() { 194 206 return mNumber; 195 207 } 196 208 197 // ----------------------------------------------------------------------------------------------- 198 /** 199 * 200 */ 201 // ----------------------------------------------------------------------------------------------- 202 public static WindowsVirtualKey parseVirtualKey(String string) 203 { 204 for (WindowsVirtualKey virtualKey : WindowsVirtualKey.values()) 205 { 206 if (virtualKey.mNumber == Integer.parseInt(string)) 207 { 209 /** 210 * <p> 211 * Parses an {@link String} and returns the respective WindowsVirtualKey if possible. 212 * </p> 213 * 214 * @param string 215 * String representation of the event type 216 * @return created WindowsVirtualKey 217 * @throws IllegalArgumentException 218 * thrown if there is no WindowsVirtualKey that correlates to string 219 */ 220 public static WindowsVirtualKey parseVirtualKey(String string) throws IllegalArgumentException { 221 for (WindowsVirtualKey virtualKey : WindowsVirtualKey.values()) { 222 if (virtualKey.mNumber == Integer.parseInt(string)) { 208 223 return virtualKey; 209 224 } … … 213 228 } 214 229 215 // ----------------------------------------------------------------------------------------------- 216 /** 217 * 218 */ 219 // ----------------------------------------------------------------------------------------------- 220 public static WindowsVirtualKey valueOf(int number) 221 { 222 for (WindowsVirtualKey virtualKey : WindowsVirtualKey.values()) 223 { 224 if (virtualKey.mNumber == number) 225 { 230 /** 231 * <p> 232 * Returns the WindowsVirtualKey associated with an integer. 233 * </p> 234 * 235 * @param number 236 * integer to which the according WindowsVirtualKey is returned 237 * @return the WindowsVirtualKey 238 * @throws IllegalArgumentException 239 * thrown if there is no WindowsVirtualKey that correlates to number 240 */ 241 public static WindowsVirtualKey valueOf(int number) throws IllegalArgumentException { 242 for (WindowsVirtualKey virtualKey : WindowsVirtualKey.values()) { 243 if (virtualKey.mNumber == number) { 226 244 return virtualKey; 227 245 } … … 231 249 } 232 250 233 // ----------------------------------------------------------------------------------------------- 234 /** 235 * TODO: comment 236 * 237 * @return 238 */ 239 // ----------------------------------------------------------------------------------------------- 240 public VirtualKey getKey() 241 { 251 /** 252 * <p> 253 * Returns the {@link VirtualKey} associated with this WindowsVirtualKey. 254 * </p> 255 * 256 * @return the virtual key 257 */ 258 public VirtualKey getKey() { 242 259 return mRepresentedKey; 243 260 } -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCButton.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents buttons in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 21.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCButton extends MFCGUIElement implements IButton { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCButton. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 24 33 */ 25 34 public MFCButton(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCCanvas.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents canvas' in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCCanvas extends MFCGUIElement implements ICanvas { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCCanvas. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCCanvas(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCComboBox.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents combo boxes in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCComboBox extends MFCGUIElement implements IComboBox { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCComboBox. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCComboBox(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCDialog.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents dialogs in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 21.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCDialog extends MFCWindow implements IDialog { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCDialog. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 24 33 */ 25 34 public MFCDialog(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCGUIElement.java
r681 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 6 7 /** 7 * TODO comment 8 * <p> 9 * Base class that represents GUI element in MFC GUIs. 10 * </p> 8 11 * 9 * @version $Revision: $ $Date: $10 * @author 2011, last modified by $Author: $12 * @version 1.0 13 * @author Patrick Harms 11 14 */ 12 15 public abstract class MFCGUIElement extends AbstractDefaultGUIElement { 13 14 /** */ 16 17 /** 18 * <p> 19 * Id for object serialization. 20 * </p> 21 */ 15 22 private static final long serialVersionUID = 1L; 16 23 17 24 /** 18 * @param name 19 * @param id 20 * @param isModal 25 * <p> 26 * Constructor. Creates a new MFCGUIElement. 27 * </p> 28 * 29 * @param specification 30 * specification of created GUI element 31 * @param parent 32 * parent of the created GUI element; null means that the element is a top-level 33 * window 21 34 */ 22 35 public MFCGUIElement(MFCGUIElementSpec specification, MFCGUIElement parent) { … … 24 37 } 25 38 26 /* (non-Javadoc) 39 /* 40 * (non-Javadoc) 41 * 27 42 * @see de.ugoe.cs.quest.eventcore.IEventTarget#getPlatform() 28 43 */ … … 33 48 34 49 /** 35 * @return Returns the id. 50 * <p> 51 * Returns the HWND (Id) of the GUI element. 52 * </p> 53 * 54 * @return the HWND (Id) 36 55 */ 37 56 public String getId() { … … 40 59 41 60 /** 42 * @return Returns the name. 61 * <p> 62 * Returns the type of the GUI element. 63 * </p> 64 * 65 * @return the type 43 66 */ 44 67 public String getType() { … … 47 70 48 71 /** 49 * @return Returns the name. 72 * <p> 73 * Returns the name of the GUI element. 74 * </p> 75 * 76 * @return the name 50 77 */ 51 78 public String getName() { … … 54 81 55 82 /** 56 * @return Returns the isModal. 83 * <p> 84 * Returns the modality of the GUI element. 85 * </p> 86 * 87 * @return the modality 57 88 */ 58 89 public boolean isModal() { … … 62 93 /** 63 94 * <p> 64 * TODO: comment95 * Returns the resource Id of the GUI element. 65 96 * </p> 66 * 67 * @return 97 * 98 * @return the resource Id 68 99 */ 69 100 public int getResourceId() { … … 71 102 } 72 103 73 /* (non-Javadoc) 74 * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec) 104 /* 105 * (non-Javadoc) 106 * 107 * @see 108 * de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.quest.eventcore 109 * .guimodel.IGUIElementSpec) 75 110 */ 76 111 @Override … … 78 113 ((MFCGUIElementSpec) super.getSpecification()).update(furtherSpec); 79 114 } 80 115 116 /* 117 * (non-Javadoc) 118 * 119 * @see de.ugoe.cs.quest.eventcore.IEventTarget#getStringIdentifier() 120 */ 81 121 @Override 82 122 public String getStringIdentifier() { 83 123 String str = this.toString(); 84 if ( getParent()!=null) {124 if (getParent() != null) { 85 125 return getParent().getStringIdentifier() + "->" + str; 86 126 } … … 88 128 } 89 129 90 /* (non-Javadoc) 130 /* 131 * (non-Javadoc) 132 * 91 133 * @see java.lang.Object#toString() 92 134 */ … … 98 140 /** 99 141 * <p> 100 * TODO: comment142 * Returns the XML representation of the GUI element. 101 143 * </p> 144 * 145 * @return the XML representation 102 146 */ 103 147 public String toXML() { 104 148 if (getParent() != null) { 105 return 106 ((MFCGUIElement) getParent()).toXML() + 149 return ((MFCGUIElement) getParent()).toXML() + 107 150 ((MFCGUIElementSpec) super.getSpecification()).toXML(); 108 151 } -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCGUIElementSpec.java
r832 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 99 100 * modality of the window 100 101 */ 101 protected MFCGUIElementSpec(long hwnd, 102 String name, 103 int resourceId, 104 String type, 105 boolean isModal) 102 protected MFCGUIElementSpec(long hwnd, String name, int resourceId, String type, boolean isModal) 106 103 { 107 104 this.hwnd = hwnd; … … 121 118 public String getName() { 122 119 StringBuffer names = new StringBuffer(); 123 120 124 121 if (name != null) { 125 122 names.append('"'); … … 130 127 names.append("NOT_SET"); 131 128 } 132 129 133 130 if (formerNames.size() > 0) { 134 131 135 132 names.append(" (aka "); 136 133 137 134 for (int i = 0; i < formerNames.size(); i++) { 138 135 if (i > 0) { … … 144 141 names.append('"'); 145 142 } 146 143 147 144 names.append(")"); 148 145 } 149 146 150 147 return names.toString(); 151 148 } … … 173 170 } 174 171 175 /* (non-Javadoc) 172 /* 173 * (non-Javadoc) 174 * 176 175 * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec#getType() 177 176 */ … … 183 182 /** 184 183 * <p> 185 * TODO: comment186 * </p> 187 * 188 * @return 184 * Returns the modality of the specified GUI element. 185 * </p> 186 * 187 * @return the modality 189 188 */ 190 189 public boolean isModal() { … … 201 200 */ 202 201 public void setName(String newName) { 203 if ((this.name != null) && 204 (!this.name.equals(newName)) && 202 if ((this.name != null) && (!this.name.equals(newName)) && 205 203 (!this.formerNames.contains(this.name))) 206 204 { 207 205 this.formerNames.add(this.name); 208 206 } 209 207 210 208 this.name = newName; 211 209 } … … 223 221 this.formerHwnds.add(this.hwnd); 224 222 } 225 223 226 224 this.hwnd = newHwnd; 227 225 } 228 226 229 /* (non-Javadoc) 230 * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec#getSimilarity(de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec) 227 /* 228 * (non-Javadoc) 229 * 230 * @see 231 * de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec#getSimilarity(de.ugoe.cs.quest.eventcore 232 * .guimodel.IGUIElementSpec) 231 233 */ 232 234 @Override 233 235 public boolean getSimilarity(IGUIElementSpec other) { 234 236 235 237 if (this == other) { 236 238 return true; 237 239 } 238 240 239 241 if (!(other instanceof MFCGUIElementSpec)) { 240 242 return false; 241 243 } 242 244 243 245 MFCGUIElementSpec otherSpec = (MFCGUIElementSpec) other; 244 246 … … 260 262 // and reopend, i.e. a new instance is created. If one of them stays the same, then 261 263 // similarity is given. Therefore these are the first two comparisons 262 264 263 265 if (hwnd == otherSpec.hwnd) { 264 266 return true; 265 267 } 266 268 267 269 if ((name != null) && (name.equals(otherSpec.name))) { 268 270 return true; 269 271 } 270 271 if ((((name == null) && (otherSpec.name == null)) || 272 (("".equals(name)) && ("".equals(otherSpec.name)))) && 273 (formerNames.size() == 0) && (otherSpec.formerNames.size() == 0)) 272 273 if ((((name == null) && (otherSpec.name == null)) || (("".equals(name)) && ("" 274 .equals(otherSpec.name)))) && 275 (formerNames.size() == 0) && 276 (otherSpec.formerNames.size() == 0)) 274 277 { 275 278 return true; 276 279 } 277 280 278 281 // if the hwnd and the name did not stay the same, then the name should be checked first. 279 282 // The current name of one of the specs must be contained in the former names of the … … 291 294 return true; 292 295 } 293 296 294 297 // ok. Even the names do not match. This is usually a clear indication, that the elements 295 298 // are distinct. However, we check, if the former handles matched. This is very unlikely … … 302 305 303 306 // now we can be really sure, that the GUI elements differ 304 307 305 308 return false; 306 309 } 307 310 308 /* (non-Javadoc) 311 /* 312 * (non-Javadoc) 313 * 309 314 * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec#equals(IGUIElementSpec) 310 315 */ 311 316 @Override 312 317 public boolean equals(Object other) { 313 318 314 319 if (this == other) { 315 320 return true; 316 321 } 317 322 318 323 if (!(other instanceof MFCGUIElementSpec)) { 319 324 return false; 320 325 } 321 326 322 327 MFCGUIElementSpec otherSpec = (MFCGUIElementSpec) other; 323 324 return 325 (hwnd == otherSpec.hwnd) && (isModal == otherSpec.isModal) && 328 329 return (hwnd == otherSpec.hwnd) && (isModal == otherSpec.isModal) && 326 330 (resourceId == otherSpec.resourceId) && 327 331 ((type == otherSpec.type) || ((type != null) && (type.equals(otherSpec.type)))) && … … 329 333 } 330 334 331 /* (non-Javadoc) 335 /* 336 * (non-Javadoc) 337 * 332 338 * @see java.lang.Object#hashCode() 333 339 */ … … 340 346 /** 341 347 * <p> 342 * Returns a string ident fier of the window:<br>348 * Returns a string identifier of the window:<br> 343 349 * {@code [resourceId;"windowName";"className";modality]} 344 350 * </p> … … 348 354 @Override 349 355 public String toString() { 350 return "[" + resourceId + ";" + getName() + ";\"" + type + "\";" + isModal + ";" + 351 hwnd + "]"; 352 } 353 354 /** 355 * <p> 356 * TODO: comment 357 * </p> 356 return "[" + resourceId + ";" + getName() + ";\"" + type + "\";" + isModal + ";" + hwnd + 357 "]"; 358 } 359 360 /** 361 * <p> 362 * Returns the XML representation of this specification. 363 * </p> 364 * 365 * @return the XML representation 358 366 */ 359 367 String toXML() { 360 return 361 "<window name=\"" + (name != null ? StringTools.xmlEntityReplacement(name) : "") + 362 "\" class=\"" + StringTools.xmlEntityReplacement(type) + 363 "\" resourceId=\"" + resourceId + "\" isModal=\"" + 364 isModal + "\"/>"; 365 } 366 367 /** 368 * <p> 369 * TODO: comment 370 * </p> 371 * 368 return "<window name=\"" + (name != null ? StringTools.xmlEntityReplacement(name) : "") + 369 "\" class=\"" + StringTools.xmlEntityReplacement(type) + "\" resourceId=\"" + 370 resourceId + "\" isModal=\"" + isModal + "\"/>"; 371 } 372 373 /** 374 * <p> 375 * Updates the specification with another specification. 376 * </p> 377 * 372 378 * @param furtherSpec 379 * specification used to update the current specification 373 380 */ 374 381 void update(IGUIElementSpec furtherSpec) { 375 382 MFCGUIElementSpec other = (MFCGUIElementSpec) furtherSpec; 376 383 377 384 if (other != this) { 378 385 for (long formerHwnd : other.formerHwnds) { … … 388 395 } 389 396 390 if ((name != other.name) && (name != null) && (!name.equals(other.name))) 391 { 397 if ((name != other.name) && (name != null) && (!name.equals(other.name))) { 392 398 setName(other.name); 393 399 } -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCListBox.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents list boxes in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCListBox extends MFCGUIElement implements IListBox { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCListBox. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCListBox(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCPanel.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents panels in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCPanel extends MFCGUIElement implements IPanel { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCPanel. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCPanel(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCTabbedPane.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents tabbed panes in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCTabbedPane extends MFCGUIElement implements ITabbedPane { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new TabbedPane. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCTabbedPane(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCTextArea.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents text areas in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 21.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCTextArea extends MFCGUIElement implements ITextArea { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCTextArea. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 24 33 */ 25 34 public MFCTextArea(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCToolBar.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents tool bars in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCToolBar extends MFCGUIElement implements IToolBar { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCToolBar. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCToolBar(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCTrackBar.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents track bars in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCTrackBar extends MFCGUIElement implements ITrackBar { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCTrackBar. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCTrackBar(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCWindow.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 4 5 5 6 /** 6 * TODO comment 7 * <p> 8 * Class that represents windows in MFC GUIs. 9 * </p> 7 10 * 8 * @version $Revision: $ $Date: $9 * @author 2011, last modified by $Author: $11 * @version 1.0 12 * @author Patrick Harms 10 13 */ 11 14 public class MFCWindow extends MFCGUIElement implements IFrame { 12 15 13 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 14 21 private static final long serialVersionUID = 1L; 15 22 16 23 /** 17 * @param name 18 * @param id 19 * @param isModal 24 * <p> 25 * Constructor. Creates a new MFCWindow. 26 * </p> 27 * 28 * @param specification 29 * specification of created GUI element 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 20 33 */ 21 34 public MFCWindow(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/WindowTree.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 12 13 import de.ugoe.cs.quest.eventcore.guimodel.GUIModelException; 13 14 import de.ugoe.cs.quest.eventcore.guimodel.IGUIElementFactory; 14 15 15 16 16 /** … … 30 30 /** 31 31 * <p> 32 * Maintains a set of all the targets of all widgets that were at some point part of the 33 * windowtree.32 * Maintains a set of all the targets of all widgets that were at some point part of the window 33 * tree. 34 34 * </p> 35 35 */ … … 38 38 /** 39 39 * <p> 40 * Map of all GUI element specifications that are part of the tree for efficient searching. 41 * Thekeys of the map are the hwnd's of the GUI elements.40 * Map of all GUI element specifications that are part of the tree for efficient searching. The 41 * keys of the map are the hwnd's of the GUI elements. 42 42 * </p> 43 43 */ … … 46 46 /** 47 47 * <p> 48 * Map of all children of GUI elements that are part of the tree. The keys of the map are 49 * thehwnd's of the parent GUI elements.48 * Map of all children of GUI elements that are part of the tree. The keys of the map are the 49 * hwnd's of the parent GUI elements. 50 50 * </p> 51 51 */ … … 54 54 /** 55 55 * <p> 56 * Map of all parents of GUI elements that are part of the tree. The keys of the map are 57 * thehwnd's of the child GUI elements.56 * Map of all parents of GUI elements that are part of the tree. The keys of the map are the 57 * hwnd's of the child GUI elements. 58 58 * </p> 59 59 */ … … 66 66 */ 67 67 private GUIModel guiModel = new GUIModel(); 68 68 69 69 /** 70 70 * <p> … … 114 114 * class name of the window to be created 115 115 */ 116 public void add(long 117 long 118 String 119 int 120 String 116 public void add(long parentHwnd, 117 long childHwnd, 118 String childWindowName, 119 int resourceId, 120 String className, 121 121 boolean isModal) 122 122 { … … 128 128 if (parent != null) { 129 129 List<MFCGUIElementSpec> otherChildren = childRelations.get(parentHwnd); 130 130 131 131 if (otherChildren == null) { 132 132 otherChildren = new ArrayList<MFCGUIElementSpec>(); 133 133 childRelations.put(parentHwnd, otherChildren); 134 134 } 135 135 136 136 otherChildren.add(child); 137 137 138 138 parentRelations.put(childHwnd, parent); 139 139 } … … 145 145 /** 146 146 * <p> 147 * Searches the tree for a window with the specified hwnd and returns its {@link MFCGUIElementSpec}148 * .147 * Searches the tree for a window with the specified hwnd and returns its 148 * {@link MFCGUIElementSpec} . 149 149 * </p> 150 150 * … … 157 157 if (guiElement == null) { 158 158 List<MFCGUIElementSpec> guiElementPath = new ArrayList<MFCGUIElementSpec>(); 159 159 160 160 MFCGUIElementSpec child = guiElementSpecs.get(hwnd); 161 161 162 162 if (child == null) { 163 163 throw new RuntimeException("no GUI element found with id " + hwnd); 164 164 } 165 165 166 166 while (child != null) { 167 167 guiElementPath.add(0, child); 168 168 child = parentRelations.get(child.getHwnd()); 169 169 } 170 170 171 171 try { 172 guiElement = (MFCGUIElement)173 guiModel.integratePath(guiElementPath, guiElementFactory);172 guiElement = 173 (MFCGUIElement) guiModel.integratePath(guiElementPath, guiElementFactory); 174 174 } 175 175 catch (GUIModelException e) { … … 183 183 /** 184 184 * <p> 185 * TODO: comment186 * </p> 187 * 185 * Sets the name of a GUI element given its HWND. 186 * </p> 187 * 188 188 * @param hwnd 189 * HWND of the GUI element 189 190 * @param windowName 191 * new name of the GUI element 190 192 */ 191 193 public void setName(long hwnd, String windowName) { … … 201 203 } 202 204 } 203 205 204 206 /** 205 207 * <p> … … 215 217 MFCGUIElementSpec node = guiElementSpecs.remove(hwnd); 216 218 int removedCounter = 1; 217 219 218 220 if (node != null) { 219 221 List<MFCGUIElementSpec> nodesToBeRemoved = childRelations.remove(hwnd); 220 222 221 223 // remove all children and sub-children, if any 222 224 if (nodesToBeRemoved != null) { … … 225 227 List<MFCGUIElementSpec> children = 226 228 childRelations.remove(nodeToBeRemoved.getHwnd()); 227 229 228 230 if (children != null) { 229 231 nodesToBeRemoved.addAll(children); 230 232 } 231 233 232 234 guiElementSpecs.remove(nodeToBeRemoved.getHwnd()); 233 235 parentRelations.remove(nodeToBeRemoved.getHwnd()); … … 248 250 } 249 251 } 250 252 251 253 if (children.size() <= 0) { 252 254 childRelations.remove(parent.getHwnd());
Note: See TracChangeset
for help on using the changeset viewer.