0

Ok, we often see people use AsyncCallback for client to call methods from Server. That's easy, even more easy if we use GWTP platform.

My question is how we create AsyncCallback for a presenter widget in GWTP? Thre is no server involved.

Ex, i want to create a ConfirmationPresenter which has 2 buttons (ok & cancel). When user click ok the system will go to onSuccess of AsyncCallback method.

     private AsyncCallback<ConfirmResult> confirmCallback=new AsyncCallback<ConfirmResult>(){

        @Override
        public void onFailure(Throwable caught) {
        // TODO Auto-generated method stub

        }
         @Override
          public void onSuccess(ConfirmResult result) {
               //do something here
          }
       };

to call the above method we can do this:

     Confirmation action=new Confirmation();
     String msg="pls click ok to confirm");
     action.set(msg);
     dispatchAsync.execute(action, confirmCallback);

I just know the basic structure of Async Callback but I don't know how to create it. I can only create it if i use eClipse, but it will create for server call.

If you can provide a very simple example based on GWTP platform then it will be great. Some other examples on internet was not based on GWTP platform & too complicated.

Tum
  • 3,614
  • 5
  • 38
  • 63
  • Do you want an action call on the presenter widgets? -- user2689075 – John Dvorak Sep 04 '13 at 05:22
  • i want to call a Presenter Widget like to call an action. The reason is that Jscript is single thread, so it won't stop when u open a new Widget, but continue to run to the next line of code, – Tum Sep 04 '13 at 08:53
  • Do you want a action call on the presenter widgets???? – user2689075 Sep 04 '13 at 05:18

0 Answers0