File Download Wrapper
Helper add-on for making easy clickable file downloads.
This add-on is meant as a semi-replacement for the FileDownloader extension in earlier Vaadin versions. You can use it to create clickable download links or wrap components like buttons to achieve the same.
Note: intentionally doesn't support dynamic download behavior (like programmatically generating the file on click).
Sample code
TextField textField = new TextField("Enter file contents"); FileDownloadWrapper link = new FileDownloadWrapper("textfield.txt", () -> textField.getValue().getBytes()); link.setText("Download textfield.txt that has contents of the TextField");
Button button = new Button("Click to download"); FileDownloadWrapper buttonWrapper = new FileDownloadWrapper( new StreamResource("foo.txt", () -> new ByteArrayInputStream("foo".getBytes()))); buttonWrapper.wrapComponent(button); add(buttonWrapper);
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Added possibility to disable the component (v24)
- Released
- 2024-08-20
- Maturity
- STABLE
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 24.4+
- Vaadin 10+ in 1.0.0
- Vaadin 14+ in 3.0.0
- Vaadin 23+ in 5.0.0
- Vaadin 24+ in 7.0.0
- Vaadin 23 in 5.1.0
- Browser
- N/A
File Download Wrapper - Vaadin Add-on Directory
Helper add-on for making easy clickable file downloads.File Download Wrapper version 1.0.0
File Download Wrapper version 1.1.0
Added DownloadBytesProvider interface for even easier usage.
File Download Wrapper version 3.0.0
New version for Vaadin 14. Should work both in Compability and npm modes.
File Download Wrapper version 3.0.1
Fixed compatibility mode issue of development build info json file
File Download Wrapper version 4.0.0
Removed shadow DOM
File Download Wrapper version 5.0.0
V23 compatible version
File Download Wrapper version 6.0.0
Removed PolymerTemplate, use LitTemplate instead
File Download Wrapper version 7.0.0
Version for V24
File Download Wrapper version 5.1.0
Added enabled/disabled support, V23 version.
File Download Wrapper version 7.1.0
Added possibility to disable the component (v24)