-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
am using vaadin 7.6 and simple file downloader 1.0.4
by using simple file downloader nothing happen when click button
please help me to solve this
and may i know there is any required to compile it's widget
the below one is what am try
SimpleFileDownloader downloader = new SimpleFileDownloader();
addExtension(downloader);
Button button = new Button("Click Me");
button.addClickListener(new Button.ClickListener()
{
public void buttonClick(ClickEvent event)
{
StreamResource resource=getStream(new File("/home/likewise-open/KONNECTBI/kirubakaran.m/Downloads/DL_TSTMDLLD.xlsx"));
downloader.setFileDownloadResource(resource);
downloader.download();
}
});
gl.addComponent(button, 4, 0);
}
private StreamResource getStream(File inputfile) {
StreamResource.StreamSource source = new StreamResource.StreamSource() {
public InputStream getStream() {
InputStream input=null;
try
{
input = new FileInputStream(inputfile);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
return input;
}
};
StreamResource resource = new StreamResource ( source, inputfile.getName());
return resource;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels