Reputation: 535
I use one layout in few cases. But when I show this layout in the window (com.vaadin.ui.Window) I have to hide one button otherwise layout stays unchanged. So I would like to know is the window opened or not at the moment. Is the any way to figure that out?
Upvotes: 0
Views: 580
Reputation: 2510
I don't fully understand your question, but maybe this helps:
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
}
}
Upvotes: 0
Reputation: 37008
with getWindows
you get all the windows of an UI. and with isAttached
you will find out, if it is attached to the session (in a state where the user should see it)
Upvotes: 2