Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
custom widget dissapearing after subwindow close
I integrated a Visualization API widget and having trouble with it.
I set up a basic example in the attachment, only needs linking with vaadin and gwt jars.
The problem is that the first time i display the subwindow, the widget appears in it, is a table backed thing. The moment i close the subwindow, the widget is deleted from the client side for as much as i can tell, so, all subsequent subwindow openings have nothing to show. How would i design this so it displays in the subwindow each time i open it?
When you close the subwindow the widget is deleted/removed from the client side. If you open the sub window again a new instance of the widget is created automatically and then rendered. As long as the widget initializes the same way the second time it should display just like the first time.
I had a quick look at your code and noticed you are using a static field to store a VerticalPanel reference. You probably do not want to do this as the static field will be shared between all widget instances so it won't work to have multiple widgets visible simultaneously. Don't know if this is related to your subwindow rendering problem.
Thank you, i removed the static and created the subwindow and the component each time it was opened, and now it works. Should've been a no brainer, i should focus more.
Button button = new Button("open", new Button.ClickListener(){
@Override
public void buttonClick(ClickEvent event) {
if (subwindow.getParent() != null) {
// window is already showing
VaadinvizApplication.this.getMainWindow().showNotification("Visualization window is already open");
} else {
Window myWindow = new Window();
MyComponent aComponent = new MyComponent();
myWindow.addComponent(aComponent);
VaadinvizApplication.this.getMainWindow().addWindow(myWindow);
//subwindow.addComponent(new MyComponent());
subwindow.addComponent(myComponent); }
}
});