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.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).