B-1_14-DEV merge back to main

This commit is contained in:
clay_shooter
2008-02-02 01:38:25 +00:00
parent cd58b57a99
commit df0ba33797
97 changed files with 12208 additions and 8816 deletions

View File

@@ -9,19 +9,20 @@ import com.jacob.test.BaseTestCase;
/**
* This test was lifted from a forum posting and shows how you can't listen to
* Excel events (added post 1.9.1 Eclipse Settings.)
* That test was modified make this a MSWord event listener to demonstrate
* that the InvocationProxy code works with MS Word Events
* This also uses the 1.10
* InvocationProxy to receive the events.
* Excel events (added post 1.9.1 Eclipse Settings.) That test was modified make
* this a MSWord event listener to demonstrate that the InvocationProxy code
* works with MS Word Events This also uses the 1.10 InvocationProxy to receive
* the events.
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
* options.
*/
public class WordEventTest extends BaseTestCase {
/**
* load up word, register for events and make stuff happen
*
* @param args
*/
public void testCaptureWordEvents() {
@@ -49,38 +50,44 @@ public class WordEventTest extends BaseTestCase {
// this is different from the ExcelEventTest because it uses
// the jacob active X api instead of the Dispatch api
System.out.println("version=" + axc.getPropertyAsString("Version"));
axc.setProperty("Visible",true);
ActiveXComponent documents = axc.getPropertyAsComponent("Documents");
if (documents == null){
axc.setProperty("Visible", true);
ActiveXComponent documents = axc
.getPropertyAsComponent("Documents");
if (documents == null) {
fail("unable to get documents");
}
axc.invoke("Quit", new Variant[] {});
} catch (ComException cfe) {
cfe.printStackTrace();
fail("Failed to attach to " + pid + ": " + cfe.getMessage());
fail("Failed to attach to " + pid + ": " + cfe.getMessage());
}
System.out.println(
"Someone needs to add some MSWord commands to this to " +
"make some on screen stuff happens so the tester " +
"thinks we tested something");
}
public class WordEvents extends InvocationProxy {
/**
* Constructor so we can create an instance that implements invoke()
*/
public WordEvents() {
System.out
.println("Someone needs to add some MSWord commands to this to "
+ "make some on screen stuff happens so the tester "
+ "thinks we tested something");
}
/**
* override the invoke() method to log all the events without writing a bunch of code
* a class that receives messages from word
*/
public Variant invoke(String methodName, Variant targetParameter[]) {
System.out.println("Received event from Windows program" + methodName);
return null;
}
public class WordEvents extends InvocationProxy {
/**
* Constructor so we can create an instance that implements invoke()
*/
public WordEvents() {
}
}
/**
* override the invoke() method to log all the events without writing a
* bunch of code
*/
public Variant invoke(String methodName, Variant targetParameter[]) {
System.out.println("Received event from Windows program"
+ methodName);
return null;
}
}
}