![](/img/trans.png)
[英]When window is opened? How to know window is opened without listening window events?
[英]How could I know if the window is opened or not in Vaadin?
我很少使用一种布局。 但是,当我在窗口(com.vaadin.ui.Window)中显示此布局时,我必须隐藏一个按钮,否则布局保持不变。 因此,我想知道此刻窗口是否打开。 有什么办法可以解决吗?
使用getWindows
您可以获取UI的所有窗口。 并使用isAttached
它是否附加在会话上(处于用户应看到的状态)
我不完全了解您的问题,但这也许会有所帮助:
public class MyLayout extends VerticalLayout {
private Button myButton; // set it in the constructor
@Override
public void setParent(HasComponents parent) {
super.setParent(parent);
myButton.setVisible(!(parent instanceof Window)); // or recursively if need
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.