Is there a simple way to close a popup confirm button connected to Vaadin FileDownloader

460 Views Asked by At

I am trying to download a file from server using Vaadin 8.05 while cliking on a button in a popup window and it works. The problem is that I can not find a way to close the popup after clicking. If I am trying to close the window then download will not be accomplished and nothing happens. If i am removing the close then download is working. But I want to close the popup after dwonload. Here is the code:

StreamResource.StreamSource source = () -> new ByteArrayInputStream("This is a test string for downloading".getBytes());
StreamResource resource = new StreamResource(source, "testFile");
resource.getStream().setParameter("Content-Disposition",
        "attachment; filename=testFile");
resource.setMIMEType("application/json");
FileDownloader downloader = new FileDownloader(resource);
downloader.extend(saveGuidePopup.getConfirmButton());
 saveGuidePopup.getConfirmButton().addClickListener((Button.ClickListener) event -> saveGuidePopup.close());
0

There are 0 best solutions below