我是 GWT 和 GWTP 的新手。我知道什么是 GWT 代码拆分和 GWTP 代理代码拆分。我已经红了:
http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html http://dev.arcbees.com/gwtp/core/presenters/creating-places.html
我以为我明白了。所以我喜欢用。:
我有应用程序Administration panel
,只有部分用户可以访问。所以不需要大家下载Administration panel
相关代码。所以在Administration Presenter
我添加@ProxyCodeSplit
如下:
public class AdminAreaPresenter extends Presenter<AdminAreaPresenter.MyView, AdminAreaPresenter.MyProxy> {
@ProxyCodeSplit
@NameToken(Routing.Url.admin)
@UseGatekeeper(IsAdminGatekeeper.class)
public interface MyProxy extends TabContentProxyPlace<AdminAreaPresenter> {}
@TabInfo(container = AppPresenter.class)
static TabData getTabLabel(IsAdminGatekeeper adminGatekeeper) {
return new MenuEntryGatekeeper(Routing.Label.admin, 1, adminGatekeeper);
}
public interface MyView extends View {}
AppPresenter appPresenter;
@Inject
AdminAreaPresenter(EventBus eventBus, MyView view, MyProxy proxy, AppPresenter appPresenter) {
super(eventBus, view, proxy, AppPresenter.SLOT_TAB_CONTENT);
this.appPresenter = appPresenter;
}
}
在其他演示者中,我有@ProxyStandard
而不是@ProxyCodeSplit
.
我已经运行应用程序并登录。然后我Network
在 chrome 的开发者控制台中打开了选项卡:
如您所见,应用程序中没有添加新资源。
我的主要应用程序演示者AppPresenter
实现了以下接口AsyncCallStartHandler, AsyncCallFailHandler, AsyncCallSucceedHandler
:com.gwtplatform.mvp.client.proxy
. 我覆盖了这些方法:
@ProxyEvent
@Override
public void onAsyncCallStart(AsyncCallStartEvent event) {
Window.alert("Async start");
getView().setTopMessage("Loading...");
}
@ProxyEvent
@Override
public void onAsyncCallFail(AsyncCallFailEvent event) {
Window.alert("Async fail");
getView().setTopMessage("Oops, something went wrong...");
}
@ProxyEvent
@Override
public void onAsyncCallSucceed(AsyncCallSucceedEvent event) {
Window.alert("Async success");
getView().setTopMessage(null);
}
当我进入时,AdmininArea
我会收到警报:“异步启动”、“异步成功”。所以我认为everythink 工作,但不幸的是我没有看到资源的任何变化。请帮忙。我做错了什么还是什么?