From: Lukas J. <luk...@de...> - 2011-04-07 08:58:00
|
Quick and dirty · Include the jsfile in MODULE.gwt.xml · Place the code that should be executed inside a method jsDoWhenClicked() · Create jsnimethod public native doWhenClicked() that calls the function jsDoWhenClicked in the javascriptfile · In clickhandler of the button call doWhenClicked() Depending on the code you want executed you might instead translate it to Java or rewrite it into classes/methods to organize it better, but the above solutions does what you asked for. /Lukas Från: Mckeane Thomas [mailto:tho...@gm...] Skickat: den 6 april 2011 18:35 Till: Gwt...@li... Ämne: [Gwt-openlayers-users] How to calll javascript file in gwt Hello I would like to run a java-script file in gwt-openlayers and pass it to a button. When I click on the button the file is executed. I saw methods in gwt to call a function or variable in a javascript file. get an external variable: public native String getFirstName()/*-{ return $wnd.first_name; }-*/; calling a function: public native void setShowTrigger(BlueApp x)/*-{ $wnd.showBlueApp = function () { x.@com.company.client.BlueApp::runApp()(); }; }-*/; I would like to execute an entire javascript file. Any help would be greatly appreciated. Best Regards, Mckeane |