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提供樣品或僞代碼? –