- 簡單的嵌套主持人(ChannelPresenter),其中有表(網格),在它的記錄。我需要在每個ChannelPresenter.displayEditor()調用中創建新的ChannelEditorPresenter實例。
- 彈出主持人小工具(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);
}
}