From e2e3058a497f43f34f2fcfadf6b63de9211be659 Mon Sep 17 00:00:00 2001 From: Adam Wagner Date: Thu, 11 May 2017 13:13:10 +0300 Subject: Make it possible to upload files by dropping them onto a drop target (#9277) Fixes #8891 --- .../tests/dnd/Html5FileDragAndDropUpload.java | 164 +++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java (limited to 'uitest/src') diff --git a/uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java b/uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java new file mode 100644 index 0000000000..211d50d047 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java @@ -0,0 +1,164 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.dnd; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + +import com.vaadin.server.StreamVariable; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.dnd.FileParameters; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.FileDropTarget; +import com.vaadin.ui.Grid; +import com.vaadin.ui.Html5File; +import com.vaadin.ui.Label; +import com.vaadin.ui.Layout; +import com.vaadin.ui.VerticalLayout; + +public class Html5FileDragAndDropUpload extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + + Label dropArea = new Label("Drop files here"); + + FileDropTarget