0
我有一个简单的模式,我想单击按钮时显示。GWT-Bootstrap Modal未在setVisible之后显示
下面是我用来显示模态
@UiHandler("submit")
void handleClick(ClickEvent e){
ModalDialogDemo modalDialog = (ModalDialogDemo) RootPanel.get().getWidget(2);
modalDialog.setHeight("200px");
modalDialog.setWidth("100px");
modalDialog.setVisible(true);
if(modalDialog.isVisible()){
System.out.println("Successfully Displayed the Modal!");
}
else{
System.out.println("Something went wrong.");
}
}
即使模态不显示在屏幕上登录到控制台的消息是前者,即成功显示了模态代码!
我做了一些与萤火虫和之前的按钮挖单击呈现的HTML是
<div>
<div class="modal" style="display: none;" aria-hidden="true">
<div class="modal-header"><a class="close" data-dismiss="modal">×</a><h3>Name</h3></div>
<div class="modal-body"><div class="gwt-Label">Modal Content Comes Here</div></div>
<div class="modal-footer"><div class="gwt-Label">And this is the footer</div></div></div>
</div>
按钮被点击之后,它改变
<div style="height: 200px; width: 100px;" aria-hidden="false">
<div class="modal" style="display: none;" aria-hidden="true">
<div class="modal-header"><a class="close" data-dismiss="modal">×</a><h3>Name</h3></div>
<div class="modal-body"><div class="gwt-Label">Modal Content Comes Here</div></div>
<div class="modal-footer"><div class="gwt-Label">And this is the footer</div></div></div>
</div>
第一个div有高度和宽度我设置了应用并隐藏了咏叹调也被清除,但实际上包含模式的子div不受影响。
我不知道如何告诉GWT将更改应用到子div,有人可以帮我解决这个问题吗?
编辑: 这是我ModalDialogDemo.ui.xml
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b = "urn:import:com.github.gwtbootstrap.client.ui">
<g:HTMLPanel>
<b:Modal title="VipName" backdrop="STATIC">
<g:Label>Modal Content Comes Here</g:Label>
<b:ModalFooter>
<g:Label>And this is the footer</g:Label>
</b:ModalFooter>
</b:Modal>
</g:HTMLPanel>
</ui:UiBinder>
然后调用,
modalDialog.getVipNameModel().show();
有没有'的模式show'方法:创建getter方法。 http://gwtbootstrap.github.com/gwt-bootstrap/apidocs/com/github/gwtbootstrap/client/ui/Modal.html – nikhil 2013-02-26 09:44:53
@nikhil请看你提到的API文档。 'public void show():显示小部件是否曾经隐藏过.'尝试使用它。我用它来显示使用gwt-bootstrap-2.2.1.0-SNAPSHOT.jar的模态。你使用哪个版本? – iMBMT 2013-02-26 10:46:31
我认为你是对的@takrbuiam我也添加了我的UIBinder代码。我如何从ModalDialogDemo类中选择Modal?如果我能够选择那个,那么我就可以调用'show'。任何指针呢? – nikhil 2013-02-26 10:58:59