當前在我的應用程序中,我們正在使用GWT RequestFactory。我們有多個EntityProxy。 finder方法的幾個返回服務層列表。由於我們在應用程序中使用分頁,因此我們在List中返回預配置數量的EntityProxy。我們還需要總數的EntityProxy在分頁UI中顯示,我們正在爲其分別提出請求。我們想要創建一些封裝List和totalRecord數量的封裝對象。因此,在單個請求中,我們可以同時獲得List和Record count。什麼是最好使用requestfactory來做到這一點?注意:我是GWT RequestFactory的初學者。GWT Requestfactory粗粒度包裝對象
1
A
回答
1
那麼你可以使用的東西沿着這條線:
public interface MyEntityProxy extends EntityProxy {}
public interface MyEntityPageProxy extends ValueProxy {
public List<MyEntityProxy> getEntities();
public int getTotalRecords();
}
這將是更好地使用通用PageProxy
接口(即MyEntityPageProxy<T extends EntityProxy>
),然而因爲這個bug它是不可能的,或者至少只能通過一種變通方法。
因此,對於每個EntityProxy
您想要Paginations支持您必須創建一個單獨的PageProxy
接口。
2
Umit的答案非常正確。我只會添加一個抽象分頁處理的圖層。當您的BasicTable和BasicLists通過相同的PageProxy接口尋址所有數據時(例如用於分頁),此功能非常有用
public interface PaginationInfo extends ValueProxy {
public int getTotalRecords();
//either have the manual page info
public int getPageNumber();
//or use the count API on GAE (returned by your db request as a web safe String)
public String getCount();
}
public interface PageProxy extends ValueProxy {
public PaginationInfo getPageInfo();
}
public interface MyEntityProxy extends EntityProxy {}
public interface MyEntityPageProxy extends PageProxy {
public List<MyEntityProxy> getEntities();
}
相關問題
- 1. GWT RequestFactory - 創建新對象
- 2. GWT RequestFactory返回空對象
- 3. 細粒度粗粒度加密API
- 4. 在GWT中創建代理對象RequestFactory
- 5. 粗粒度WCF服務
- 6. 粗粒和細粒
- 7. 什麼是細粒度和粗粒度超時
- 8. 精細粒度轉換與粗粒度轉換
- 9. 建築中粗粒度/細粒度的定義
- 10. GWT Atmosphere + RequestFactory
- 11. GWT RequestFactory入門
- 12. GWT requestFactory驗證
- 13. GWT requestFactory搜索
- 14. GWT RequestFactory SuperDev
- 15. GWT RequestFactory + CellTable
- 16. GWT RequestFactory性能
- 17. GWT RequestFactory與maven
- 18. GWT DataGrid包裝高度
- 19. 如何從GWT RequestFactory
- 20. Hibernate ResultTransformer和gwt requestfactory
- 21. GWT RequestFactory的例子?
- 22. WSD任務的細粒度和粗粒度評分之間的區別?
- 23. GWT RequestFactory調用設置錯誤的對象
- 24. GWT RequestFactory返回錯誤類型的對象
- 25. 使用with()子句獲取對象RequestFactory GWT
- 26. GWT RequestFactory - 在代理對象上使用新的setter導致IllegalArgumentException
- 27. GWT RequestFactory:更新沒有傳播到級聯對象
- 28. 簡單的GWT RequestFactory崩潰
- 29. gwt的requestfactory的語義RequestContext.edit()
- 30. 吉利德VS RequestFactory爲GWT