0
我执行使用MVP模式GWT应用程序。 在演示者中,我使用setData(Object)方法将数据(模型)从RPC服务发送到视图。GWT MVP最佳实践模型数据传递给视图
private void getmaterialTypes(final String formType) {
new RPCCall<List<MaterialType>>() {
public void onFailure(Throwable arg0) {
Window.alert("Error : unsuccess...");
}
public void onSuccess(List<MaterialType> result) {
display.setData(result, "MaterialType");
Window.alert("Success Getting Material Types !");
}
@Override
protected void callService(AsyncCallback<List<MaterialType>> cb) {
materialTypeService.findMaterialTypesByFormType(formType, cb);
}
}.retry(3);
}
当从一个服务只传递一个对象或列表时,这将是完美的。发送不同服务返回的多个不同对象的最佳做法是什么?
第一种方法似乎更好,因为它会确保所有asynchronus数据被取出,但目前还不清楚如何实现,你可以pleae提供样品或伪代码? –