SmartGWT modal window

自作多情 提交于 2019-12-24 08:30:24

问题


I have problem with modal window. I call this two methods setIsModal(true) and setShowModalMask(true) but why my window isn't modal ?

Here is the Code :

Window summaryWindow = new Window();
summaryWindow.setWidth(950);
summaryWindow.setHeight(620);
summaryWindow.centerInPage();
summaryWindow.setCanDragReposition(false);
summaryWindow.setIsModal(true);
summaryWindow.setShowModalMask(true);
summaryWindow.setShowMinimizeButton(false);
summaryWindow.setTitle("Example");
summaryWindow.addItem(new Button("Example");
summaryWindow.show();

回答1:


The exception you're getting is valid. In any GWT related technology, you'll find many API functionalities to set properties of GWT widget. For example, for a Window widget you have, setWidth, setHeight, centerInPage etc...

Now some of these properties MUST be applied before the widget is rendered in DOM of the browser & some of them MUST be applied after the widget is rendered in DOM of the browser.

ShowModalMask() is a property that you can set only before the widget is rendered. centerInPage() is a property that renders Window in DOM of browser & that is the reason you're getting the exception.

Apply properties in a proper order (centerInPage() after ShowModalMask() in your case) to avoid this kind of exception.




回答2:


I'm using smartgwt 2.4 : if I try your code with a button calling it enclosed in a method I get an error which indicated I cannot modify it with setModalMask (IllegalStateException - this property cannot be changed after the component has been created) . After moving this call just after the instanciation it's working:

Window summaryWindow = new Window();
summaryWindow.setShowModalMask(true);

I don't really understand, but let me know if it's also working for you



来源:https://stackoverflow.com/questions/14772234/smartgwt-modal-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!