jsni

How to communicate two modules in GWT

强颜欢笑 提交于 2019-12-12 04:58:07
问题 I have created two module name module1 and module2 in gwt application. I want to pass message from module1 to module2 and module2 to module1 simultaneously after some seconds. I write the following code, but it gives me error unable to find module1.gwt.xml in classpath. public void onModuleLoad() { mainBus.fireEvent(new PingEvent("-----Simulation Started-----")); } module1 public void onModuleLoad() { GWTEventBus.mainBus.addHandler(PingEvent.TYPE, new PingEventHandler(){ public void onEvent

GWT JSNI javascript to Java not working

ぐ巨炮叔叔 提交于 2019-12-12 04:41:33
问题 I am trying to invoke a Java Method from my Javascript code. This is for a Windows Phone 7 app using Phonegap. I have the following in my javascript code. document.addEventListener("backbutton", onBackKeyDown, false); function onBackKeyDown(){ } And in my Java code I have the following. public static native void exportStaticMethod() /*-{ $wnd.onBackKeyDown = $entry(this.@com.mycompany.myapp.client.MyApp::hideSettingsWidgets()); }-*/; Then in the on onModuleLoad() I am calling it like so:

JSNI: JsArray<JsArrayNumber> type signature

♀尐吖头ヾ 提交于 2019-12-11 20:26:48
问题 My JavaScript code gives me an array of arrays of float values: var serverData = new Array(); var fArray = new Array(); // .. calc mx and my here fArray.push(mx); fArray.push(my); this.serverData.push(fArray); var out = window.letServerWork(this.serverData); which I want to work with on the server. this.serverData will look something like this: { 0: 0: 1.123 1: 1.459 1: 0: 0.543 1: 1.679 2: 0: 1.157 1: 0.987 } Therefore I need to know the right signature for this call. This here: public

GWT JSNI split method bug

感情迁移 提交于 2019-12-11 14:52:44
问题 I am developing a GWT application and I am obtaining a List containing the result of a select query. This select query has rows. Each row, has each element separated from the previous and the next by "::". I am trying to split it using String.split, but it is taking ages to perform. I have read that currently (i am using GWT 2.5.1), the String.split method its quite bugged, sometimes almost taking x1000 times more than the JSNI method to perform; so i took that approach. The JSNI method that

Is there any way to automatically bridge a Javascript library to GWT?

荒凉一梦 提交于 2019-12-11 12:37:31
问题 I need to bridge a fairly procedural Javascript library consisting of some .js files containing functions to call from GWT. There's already a nice utility called GWT-Exporter that does exactly the opposite (http://code.google.com/p/gwt-exporter/), I would need a kind of GWT-Importer, that generated automatically .java wrappers of the javascript functions. I'm aware type is an issue here, but I'd be content if all return types became JavaScriptObject or primitives. JSNI seems to be the way,

How can unit-tests use SmartGWT classes?

非 Y 不嫁゛ 提交于 2019-12-11 12:08:39
问题 In our SmartGWT web application, we pass our domain objects from the server to the client and back (via GWT serialization). To show/edit the data at client side in a DynamicForm or a GridList, we have to convert it into a Record (or ListGridRecord) and after editing back into our domain objects. I would like to write a unit test for this conversion method, but a straightforward attempt in JUnit fails, since the record's getAttribute and setAttribute methods are implemented by JSOHelper

how can we use onbefoerunload in GWT

回眸只為那壹抹淺笑 提交于 2019-12-11 09:30:25
问题 I am creating a function that prevent the user when he reload the page or press a back space or press back button of Browser . i try the following code.. $wnd.beforeunload=function() { return "hello"; } it is working with simply java script but not in jsni . i also used Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(ClosingEvent event) { event.setMessage("Are you sure?"); } }); this is working with page refreh and closing, but not working with back

Can I use a third party Javascript library in GWT

十年热恋 提交于 2019-12-11 03:38:09
问题 for example mootools!! It's comfortable for me to coding in js, but not for everyone obviously. 回答1: You certainly can. The best thing is to write yourself some nice JavaScript Overlay Types, which encapsulate your access to the third-party library. That way, other developers - I assume that you are trying to set things up for a team - can interact with the third-party JS library without having to know a heap about it. 回答2: Yes, See here: http://code.google.com/webtoolkit/doc/latest

GWT JSNI: invoking applet methods?

帅比萌擦擦* 提交于 2019-12-10 15:21:44
问题 I have a GWT application that includes an embedded applet. I would like to use JNSI to let GWT buttons push data to that applet, but at the moment I can't even get it to connect. Looking for some help - can't seem to find anything addressing how to make things talk. In my entrypoint class I define: native void doSomething() /*-{ $doc.applet_id.doSomething(); }-*/; Which I hook via ClickHandler to a Button. Within the applet main class, there is a doSomething() method, and in the page I launch

Call Java method from JSNI

风格不统一 提交于 2019-12-10 09:21:28
问题 I want to call Java method test() from JSNI variable successHandler() . However, I get error [ERROR] - Line 110: Missing qualifier on instance method 'com.gw.myProject.client.presenter.payments.PaymentProgramPresenter.test' Original code: public static native void purchase(String token) /*-{ var successHandler = function(status){ // Success handler return @com.gw.myProject.client.presenter.payments.PaymentProgramPresenter::test()(); } var failureHandler = function(status){ // Failure handler