为什么我无法在GWT中的UiBinder中隐藏DialogBox? [英] why can't i hide DialogBox in UiBinder in GWT?
问题描述
Test.ui.xml
< g:DialogBox ui:field =wishlistDialogBoxautoHide =true>
< g:说明>测试< / g:说明>
< g:HTMLPanel>一些小部件..< / g:HTMLPanel>
< / g:DialogBox>
运行后,应用程序仍显示 DialogBox
,所以我试图在 TestView.java
中为wishlistDialogBox设置隐藏,但它不起作用。
@UiField DialogBox wishlistDialogBox;
@Inject
public TestView(最终的活页夹活页夹){
widget = binder.createAndBindUi(this);
wishlistDialogBox.hide();
}
然后我在 TestPresenter.java中设置它的隐藏但它仍然无效
@Override
保护无效onBind(){
super.onBind();
getView()。getWishlistDialogBox()。hide();
$ / code>
有什么不对,Goodle没有解释它。
另外,如何重用 DialogBox
?
PopupPanel
s一般)不能像其他任何小部件一样工作谈到将它们添加到DOM。你不应该直接附加它们(即, panel.add(yourDialogBox)
或者在 UiBinder
XML文件中)如你所做的那样。相反,您应该创建它们,并简单地调用 hide()
/ show()
等方法来获取它显示/隐藏(即,在DOM的末尾附加/分离)。
in Test.ui.xml
<g:DialogBox ui:field="wishlistDialogBox" autoHide="true">
<g:caption>Test</g:caption>
<g:HTMLPanel> some widgets..</g:HTMLPanel>
</g:DialogBox>
After running, the application still show the DialogBox
, so I tried to set hide for "wishlistDialogBox" in TestView.java
but it didn't work.
@UiField DialogBox wishlistDialogBox;
@Inject
public TestView(final Binder binder) {
widget = binder.createAndBindUi(this);
wishlistDialogBox.hide();
}
Then i set hide for it in TestPresenter.java
but it still didn't work
@Override
protected void onBind() {
super.onBind();
getView().getWishlistDialogBox().hide();
}
What's wrong, Goodle didn't explain it at all.
In addition, how to reuse the DialogBox
?
DialogBox
(and PopupPanel
s in general) does not work like any other widget when speaking about adding them to the DOM. You should never attach them directly to it (i.e., panel.add(yourDialogBox)
or inside a UiBinder
XML file) as you did. Instead you should create them, and simply call hide()
/show()
, and the like methods, to get it displayed/hidden (i.e., attached/detached at the end of/from the DOM).
这篇关于为什么我无法在GWT中的UiBinder中隐藏DialogBox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!