Skip to content

nothing happen when click on button  #2

@kirubakaranM

Description

@kirubakaranM

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;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions