我正在實現一個web應用程序,它將根據不同的瀏覽器支持不同的視圖。例如,在移動瀏覽器中,它將向使用較少UI元素的用戶顯示較小的視圖。但我們希望使用相同的演示者。通過GWT平臺實現多個視圖?
我手頭上有一個解決方案 - 添加瀏覽器類型中ClientModule檢測邏輯,e.g:
if (browser == "iphone") {
bindPresenter(HomePresenter.class, HomePresenter.MyView.class, HomeView.class, HomePresenter.MyProxy.class);
} else if (browser == "ipad") {
bindPresenter(HomePresenter.class, HomePresenter.MyView.class, IPadHomeView.class, HomePresenter.MyProxy.class);
} else {
bindPresenter(HomePresenter.class, HomePresenter.MyView.class, IPhoneHomeView.class, HomePresenter.MyProxy.class);
}
我想知道是否有可能使用某些方面像GWT平臺的延遲綁定。 (但我想遵循GWT-plarform的結構,而不是在xxx.gwt.xml中添加延遲綁定代碼)。
所以我的問題是:
1)是否有任何其他方式來實現上述功能?
2)哪種方式最好,爲什麼?
在此先感謝!
最好的問候,
家寬w^
感謝您的回答,您提供的鏈接可以讓我找到更好的解決方案。 – 2012-03-22 08:01:59