I have this code for a Button:
private void createDeleteButton() {
Button deleteButton = new Button("Delete");
deleteButton.addClickListener((Button.ClickEvent e) -> {
LOG.info("Creating DeleteModal Window");
DeleteModal deleteModal= new DeleteModal(queryName);
this.getUI().getUI().addWindow(deleteModal);
// I want to wait for the exit event of delete modal
// and then execute the next method
refresh();
});
buttonPanel.addComponent(deleteButton);
}
When I click this button a window appears, but at the same time the refresh();
method is executed
Are there some way to wait for the exit event of deleteModal
and then execute the refresh();
method?
Notes:
DeleteModal extends Window
I'm Using Vaadin
The class that contains this method extends VerticalLayout
You can subscribe to window's close event with Window.addCloseListener
.
Something like this should work (DISCLAIMER: untested code):
deleteModal.addCloseListener((Window.CloseEvent e) -> refresh());