【发布时间】:2016-11-23 21:06:57
【问题描述】:
我有:
- 简单的嵌套演示者 (ChannelPresenter),其中包含包含记录的表(网格)。我需要在每个 ChannelPresenter.displayEditor() 调用中创建新的 ChannelEditorPresenter 实例。
- Popup Presenter 小部件 (ChannelEditorPresenter) 应在每个 ChannelEditorPresenter.edit() 调用中显示弹出窗口
目前我将 ChannelEditorPresenter 注入到 ChannelPresenter 构造函数,但在这种情况下,我只有一个 ChannelEditorPresenter 实例。实际上,每次通话我都需要单独的 Popup 演示者。 (很多分离的窗口,每个都有自己的数据)。
ChannelPresenter.java:
public class ChannelPresenter extends Presenter<ChannelPresenter.MyView, ChannelPresenter.MyProxy> implements ChannelUiHandlers {
public interface MyView extends View, HasUiHandlers<ChannelUiHandlers> {
void load();
}
@ProxyStandard
@NameToken(NameTokens.CHANNELS)
interface MyProxy extends ProxyPlace<ChannelPresenter> {
}
ChannelEditorPresenter channelEditorPresenter;
@Inject
ChannelPresenter(EventBus eventBus, MyView view, MyProxy proxy,
ChannelEditorPresenter channelEditorPresenter
) {
super(eventBus, view, proxy, ApplicationPresenter.SLOT_MAIN);
getView().setUiHandlers(this);
this.channelEditorPresenter = channelEditorPresenter;
}
@Override
protected void onBind() {
super.onBind();
getView().load();
}
@Override
public void displayEditor(Channel channel) {
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Here I need to create new instance for each call
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
addToPopupSlot(channelEditorPresenter);
channelEditorPresenter.edit(channel);
}
}
【问题讨论】:
标签: java gwtp gwt-platform