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.