Directory

← Back

SimpleFileDownloader

SimpleFileDownloader

Author

Rating

Popularity

100+

Modified version of Vaadin FileDownloader component. It allows to launch downloading resource by any event.

1.0.4 version - Vaadin 7 2.0.0 version - Vaadin 8 (Big thanks to ScreamingTree86 https://github.com/ScreamingTree86 for preparing port to Vaadin 8 version!)

Sample code

final VerticalLayout layout = new VerticalLayout();
		layout.setMargin(true);
		setContent(layout);

		SimpleFileDownloader downloader = new SimpleFileDownloader();
		addExtension(downloader);
		
		Button button = new Button("Click Me");
		button.addClickListener(new Button.ClickListener() {
			public void buttonClick(ClickEvent event) {
				final StreamResource resource = new StreamResource(() -> {
					return new ByteArrayInputStream("This is test clicked on button".getBytes());
				}, "testButton.txt");
				
				downloader.setFileDownloadResource(resource);
				downloader.download();
			}
		});
		layout.addComponent(button);

Compatibility

(Loading compatibility data...)

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

Released
2016-09-23
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.0+
Vaadin 8.0+ in 2.1
Browser
Browser Independent

Vaadin Add-on Directory

Find open-source widgets, add-ons, themes, and integrations for your Vaadin application. Vaadin Add-on Directory
The channel for finding, promoting, and distributing Vaadin add-ons.
Online