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?
11194.war (696 KB)
11195.png

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);			}
								
			}
			
		});

11200.war (696 KB)