Sunday, January 8, 2017

How to Invoke a Method in the Active Tab/Dialog Presenter Using GWT Exporter?

I'm very new to GWT and its derivative technologies, so bear with me. I need to know how to obtain a reference to an instance of the active tab or dialog Presenter using GWT Exporter. Here is a run down of why and how I am doing this:

I have a callback JavaScript function that gets called by an applet. I tried to write a native interface method to be called in place but for some reason it doesn't get called. Page consists of several IFrames and parent/child presenters (GWTP). So, as a work around, I managed to invoke a JavaScript rather than the JSNI method. From this JavaScript function, using GWT Exporter, I would like to get the instance of an active dialog and invoke a particular method, e.g.:

function jsCallBack() {
  (new test.JSCallBackExporter()).callActiveDialogMethod();
}

@Export
@ExportPackage("test")
public class JSCallbackExporter implements Exportable {

  public void callActiveDialogMethod() {
    MainEntry.appGinJector.getMyDialogPresenter().get().MyTargetMethod();
  }

However, it appears that getMyDialogPresenter().get() returns a new instance (provider) of MyDialogPresenter (which does not have the instance properties of the active dialog needed to run MyTargetMethod()). I am assuming there has to be a way to get a reference to an active dialog Presenter instance. Does anyone know how?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment