FileDownloader

Hi I have a table that references to a documents.
when I select a row I would like that with a “Download” button to download the file but I can’t use FileDownloader because I don’t down what is the file to download.
Now I use this code:

InputStream is = am.getDocumentInputStream(selectedDoc.getIdDocumento()); StreamResource resource = Utils.createResource(is, selectedDoc.getName()); resource.setMIMEType(selectedDoc.getType()); resource.getStream().setParameter( "Content-Disposition", "attachment; filename="+selectedDoc.getName()); Page.getCurrent().open(resource, selectedDoc.getName(), true); but It’s not good because always opens a new page. Is there an alternative?

  1. Create
    FileDownloader
    with some fake resource
  2. Extend downloader with the button.
  3. In table click listener, set proper resource with
    setFileDownloadResource(Resource resource)
    method

ok thanks!