gpt4 book ai didi

gwt-platform - 使用 GWTP 嵌套演示者

转载 作者:行者123 更新时间:2023-12-04 01:52:32 26 4
gpt4 key购买 nike

我的主演示器中有内容插槽,我如何在应用加载时将主演示器放在一个插槽中,将菜单插槽放在另一个插槽中?

或者不可能?

提前致谢。

最佳答案

是的你可以 !在以下示例代码中,我假设您的 HomePresenter 是一个场所并扩展了 Presenter,而您的 MenuPresenter 扩展了 PresenterWidget。
在您的 MainPresenter 中:

@ContentSlot public static final Type<RevealContentHandler<?>> MAIN_SLOT = new Type<RevealContentHandler<?>>();  
@ContentSlot public static final Type<RevealContentHandler<?>> MENU_SLOT = new Type<RevealContentHandler<?>>();

@Override
protected void onReveal() {
super.onReveal();
setInSlot(MENU_SLOT, menuPresenter);
}

在您的 HomePresenter 中:
@Override
protected void revealInParent() {
RevealContentEvent.fire(this, MainPresenter.MAIN_SLOT, this);
}

然后在 MainView 中:
@UiField Panel mainContainer;
@UiField Panel menuContainer;

@Override
public void setInSlot(Object slot, Widget content) {
if (slot == MainPresenter.MAIN_SLOT) {
mainContainer.clear();
mainContainer.add(content);
} else if (slot == MainPresenter.MENU_SLOT) {
menuContainer.clear();
menuContainer.add(content);
} else {
super.setInSlot(slot, content);
}
}

关于gwt-platform - 使用 GWTP 嵌套演示者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7578123/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com