【发布时间】:2014-08-23 10:28:35
【问题描述】:
setDelayMSec( -1 ) 表示在用户点击消息框之前显示消息。当用户点击外面的任何地方时,我可以关闭消息框吗?
【问题讨论】:
setDelayMSec( -1 ) 表示在用户点击消息框之前显示消息。当用户点击外面的任何地方时,我可以关闭消息框吗?
【问题讨论】:
尝试添加一个使用整个屏幕的标签,这样:
public void createAndShowNotification(String caption, String description, Notification.Type type) {
description += "<span style=\"position:fixed;top:0;left:0;width:100%;height:100%\"></span>";
Notification notif = new Notification(caption, description, type, true);
notif.setDelayMsec(-1);
notif.show(Page.getCurrent());
}
【讨论】:
不,当您使用 setDelayMSec(-1) 时,您必须单击消息框将其关闭。
如果用户应该能够通过单击框外的任意位置来关闭它,则必须设置一个正数。 当然,您可以设置一个非常高的数字,以便它(几乎)不会自动关闭...
https://vaadin.com/book/vaadin7/-/page/application.notifications.html
【讨论】: