review comment addressed
Signed-off-by: asharani-murugesh <asharani.murugesh@in.bosch.com>
This commit is contained in:
@@ -59,6 +59,7 @@ import com.vaadin.spring.annotation.SpringComponent;
|
|||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
import com.vaadin.ui.Alignment;
|
import com.vaadin.ui.Alignment;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Component;
|
||||||
import com.vaadin.ui.DragAndDropWrapper;
|
import com.vaadin.ui.DragAndDropWrapper;
|
||||||
import com.vaadin.ui.DragAndDropWrapper.WrapperTransferable;
|
import com.vaadin.ui.DragAndDropWrapper.WrapperTransferable;
|
||||||
import com.vaadin.ui.HorizontalLayout;
|
import com.vaadin.ui.HorizontalLayout;
|
||||||
@@ -187,21 +188,13 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drop(final DragAndDropEvent event) {
|
public void drop(final DragAndDropEvent event) {
|
||||||
if (validate()) {
|
if (event.getTransferable() instanceof WrapperTransferable && validate()) {
|
||||||
((WrapperTransferable) event.getTransferable()).getDraggedComponent();
|
|
||||||
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
//reset the flag
|
// reset the flag
|
||||||
hasDirectory = Boolean.FALSE;
|
hasDirectory = Boolean.FALSE;
|
||||||
for (final Html5File file : files) {
|
for (final Html5File file : files) {
|
||||||
if (!isDirectory(file)) {
|
processFile(file);
|
||||||
if (!checkForDuplicate(file.getFileName())) {
|
|
||||||
numberOfFileUploadsExpected.incrementAndGet();
|
|
||||||
file.setStreamVariable(createStreamVariable(file));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hasDirectory = Boolean.TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (numberOfFileUploadsExpected.get() > 0) {
|
if (numberOfFileUploadsExpected.get() > 0) {
|
||||||
processBtn.setEnabled(false);
|
processBtn.setEnabled(false);
|
||||||
@@ -216,6 +209,17 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void processFile(final Html5File file) {
|
||||||
|
if (!isDirectory(file)) {
|
||||||
|
if (!checkForDuplicate(file.getFileName())) {
|
||||||
|
numberOfFileUploadsExpected.incrementAndGet();
|
||||||
|
file.setStreamVariable(createStreamVariable(file));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hasDirectory = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isDirectory(final Html5File file) {
|
private static boolean isDirectory(final Html5File file) {
|
||||||
|
|||||||
Reference in New Issue
Block a user