2014-09-05 92 views
0

我在少数情况下使用一种布局。但是当我在窗口中显示这个布局(com.vaadin.ui.Window)时,我必须隐藏一个按钮,否则布局保持不变。所以我想知道这个窗口目前是否打开。有什么方法可以解决这个问题吗?我怎么知道Vaadin的窗户是否打开?

回答

2

getWindows你得到了一个用户界面的所有窗口。与isAttached你会发现,如果它连接到会话(的状态下,用户应该看到它)

0

我不完全明白你的问题,但也许这会有所帮助:

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 
    } 

} 
相关问题