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.
Best way to work with Window
Today I use this code to open a window:
public static void abrirJanela(String titulo, Integer altura, Integer largura, Component screen, CloseListener closeListener) {
Window window = new Window(titulo);
window.setWidth(largura, Unit.PERCENTAGE);
window.setHeight(altura, Unit.PERCENTAGE);
window.setModal(true);
window.setContent(tela);
UI.getCurrent().addWindow(window);
}
But now I need to pass one list to my window, and after close this window receive the same list (with changes), to pass a list It`s ok, I pass in constructor but how can I receive that list when window close ?? And how can I close my windows when I click one button inside this window?? looking for samples I only find a way to close when my class extends windows, but in this case my "screen" extends VerticalLayout
tks
Hi,
you can close the window by calling
window.close();
The logical place to call this could be in a click handler of a "close" button. If you're not extending Window, you can pass a reference to your window object.
As for passing a list, you could do that in the same click handler where the close() call happens.
Hope this helps,
-Olli