diff options
author | Anastasia Smirnova <anasmi@utu.fi> | 2018-03-07 00:29:53 -1200 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-03-07 15:29:53 +0300 |
commit | 0c5e445058fe93b2e0742ada88b29ad342304b21 (patch) | |
tree | 0a36f0984f52e8162e1248696a8d6c4990a49f55 /documentation/advanced/advanced-dragndrop.asciidoc | |
parent | e597d0cfe47d5d8e18d1ceeae2f1ea8b9e711efb (diff) | |
download | vaadin-framework-0c5e445058fe93b2e0742ada88b29ad342304b21.tar.gz vaadin-framework-0c5e445058fe93b2e0742ada88b29ad342304b21.zip |
Update advanced-dragndrop.asciidoc (#10680)
* Update advanced-dragndrop.asciidoc
Fixing example of Drag and drop code.
Resolves https://github.com/vaadin/framework/issues/10512
* Update advanced-dragndrop.asciidoc
Removed unnecessary spaces
* Update advanced-dragndrop.asciidoc
Removed unnecessary spaces
Diffstat (limited to 'documentation/advanced/advanced-dragndrop.asciidoc')
-rw-r--r-- | documentation/advanced/advanced-dragndrop.asciidoc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/documentation/advanced/advanced-dragndrop.asciidoc b/documentation/advanced/advanced-dragndrop.asciidoc index 1f18234dbf..24e2e2d6f4 100644 --- a/documentation/advanced/advanced-dragndrop.asciidoc +++ b/documentation/advanced/advanced-dragndrop.asciidoc @@ -443,7 +443,7 @@ To start uploading a file, set a `StreamVariable` to it. The stream variable pro Label dropArea = new Label("Drop files here"); FileDropTarget<Label> dropTarget = new FileDropTarget<>(dropArea, event -> { - List<Html5File> files = event.getFiles(); + Collection<Html5File> files = event.getFiles(); files.forEach(file -> { // Max 1 MB files are uploaded if (file.getFileSize() <= 1024 * 1024) { @@ -452,8 +452,13 @@ FileDropTarget<Label> dropTarget = new FileDropTarget<>(dropArea, event -> { // Output stream to write the file to @Override public OutputStream getOutputStream() { - return new FileOutputStream("/path/to/files/" - + file.getFileName()); + try{ + return new FileOutputStream("/path/to/files/" + + file.getFileName()); + }catch (FileNotFoundException e) { + e.printStackTrace(); + } + return null; } // Returns whether onProgress() is called during upload @@ -489,6 +494,11 @@ FileDropTarget<Label> dropTarget = new FileDropTarget<>(dropArea, event -> { Notification.show("Stream failed, fileName=" + event.getFileName()); } + + @Override + public boolean isInterrupted() { + return false; + } }); } } |