I have some code which extends a button to offer a download with FileDownloader
:
private final InputStream stream;
private final Label label;
private final Button button;
//…
StreamResource.StreamSource source = new StreamResource.StreamSource() {
@Override
public InputStream getStream() {
label.setValue("downloaded");
return stream;
}
};
FileDownloader downloader = new FileDownloader(new StreamResource(source));
downloader.extend(button);
This code wants to update the UI as well (set the Label
to "downloaded"
).
This works in some browsers (Konqueror and Chromium), but in Firefox (31) it doesn't.
The behaviour in FF is quiet strange: The first click on the button starts the download without any update of the UI. A second click on the button shows the update of the UI only (i.e. no download).
My suspicion is that FF doesn't like FileDownloader
's iframe:
Please note that the download will be started in an iframe
Any idea how I can achieve an update of the UI from within StreamSource.getStream()
? If not, any better ideas to offer a download which updates the UI as well?
It's vaadin-7.1.15.