Hi Brian,
I had problems similar to you when studying JsInterop, so I've tried your code.
Other than the problems on using JsInterop annotations as reported by Jens, I've found a script load timing issue:
you execute the the Javascript code in the main page script, but at that point GWT has not yet loaded!
Putting the execution of your javascript code inside window.onload event is not again enough: I think this is because of using the xsiframe linker (I'm curious to try out with the sso linker).
So I have used a 3 seconds timeout...
In the fork I've added some console logging to outline the time each part of the Javascript is executed, and the order is:
- first javascript inside main html page is executed
- then javascript inside the window.onload
- finally the GWT entry point
Your javascript code, with the fixes suggested by Jens, has worked after a 3 seconds timeout.
Of course I don't like this workaround, but a more general approach could be to have your application started from the GWT entry point (i.e. define a "main" function in javascript, then run it from GWT entry point). If you don't like the ping-pong between JS and GWT, you may try different solution to detect when GWT has loaded, or - if the problem is the xsiframe linker - try another linker.
Please note that I've changed totally the pom.xml and copied configuration from one of mines: in particular I have added a configuration for maven-jetty-plugin,
so to try it out you need can execute the following commands:
After this you should be able to open your browser at
http://localhost:8888/ and you should see the alert popup (but 3 seconds after the page load!)
Hope this is helpful,
Cristiano
PS. I'm using gwt 2.8.0-SNAPSHOT and also gwt-maven-plugin 2.8.0-SNAPSHOT that I have compiled personally, so I don't have added the repo on the pom.xml,
mvn clean install -DskipTests