java 项目,vaadin 7 我很难找到一种方法来防止在单击内部按钮之前关闭窗口。我希望窗口也位于其他屏幕内容之上。 到目前为止我的代码:
private void handleButtonCancelBatches() {
if (projectBatchTeller > 0) {
Button btnYes = new Button("Yes");
Button btnNo = new Button("No");
// toDo add click listeners to the buttons
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.addComponents(btnYes, btnNo);
// toDo add extra informative content to the horizontalLayout
Window window = new Window( //
"Cancel "+ projectBatchTeller + " selected batches ?", horizontalLayout);
window.setWidth(50f, Unit.PERCENTAGE);
window.setHeight(50f, Unit.PERCENTAGE);
window.setPosition((int) getUI().getWidth() / 2, (int) getUI().getHeight() / 2);
getUI().getCurrent().addWindow(window);
} else {
Notification.show("No batches selected to cancel");
}
}
// toDo add listeners / handlers for the buttons
我真正需要的是典型消息框的行为,但我不允许添加 pom 中存在额外的依赖项,我也无法升级到更新版本的 Vaadin。
如果不可能的话,我想在60秒后自动关闭窗口, 发送通知,通知执行默认路径,女巫不处理批处理
有什么建议吗? 谢谢
最佳答案
我自己找到了一个可行的解决方案。其实很简单,问题 是我不知道“modal”这个词(我说荷兰语)
它提供类似于 msgbox 的行为(如 C# 中的...)
window.setModal(true);
window.setClosable(false);
关于JAVA VAADIN7 如何防止窗口在某些操作之前关闭,如何让窗口在最上面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60500132/