From 0579fba63048ffa8daa22db5243a149e67f73594 Mon Sep 17 00:00:00 2001 From: Tomi Virtanen Date: Mon, 9 Dec 2013 13:44:27 +0200 Subject: Upload control with empty selection (#9602) Event is now sent on submit even if no file is selected. Removed forceSubmit UIDL attribute and replaced it with a UploadClientRpc call. Added TestBench3 test. Change-Id: Id32b82532ec34e61a9c0718413fd1755015d2c30 --- server/src/com/vaadin/ui/Upload.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'server') diff --git a/server/src/com/vaadin/ui/Upload.java b/server/src/com/vaadin/ui/Upload.java index 08cabf979a..98f5d2ded9 100644 --- a/server/src/com/vaadin/ui/Upload.java +++ b/server/src/com/vaadin/ui/Upload.java @@ -28,6 +28,7 @@ import com.vaadin.server.NoOutputStreamException; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.StreamVariable.StreamingProgressEvent; +import com.vaadin.shared.ui.upload.UploadClientRpc; /** * Component for uploading files from client to server. @@ -106,11 +107,6 @@ public class Upload extends AbstractComponent implements Component.Focusable, private int nextid; - /** - * Flag to indicate that submitting file has been requested. - */ - private boolean forceSubmit; - /** * Creates a new instance of Upload. * @@ -157,11 +153,6 @@ public class Upload extends AbstractComponent implements Component.Focusable, notStarted = false; return; } - if (forceSubmit) { - target.addAttribute("forceSubmit", true); - forceSubmit = true; - return; - } // The field should be focused if (focus) { target.addAttribute("focus", true); @@ -1011,12 +1002,11 @@ public class Upload extends AbstractComponent implements Component.Focusable, */ public void submitUpload() { markAsDirty(); - forceSubmit = true; + getRpcProxy(UploadClientRpc.class).submitUpload(); } @Override public void markAsDirty() { - forceSubmit = false; super.markAsDirty(); } -- cgit v1.2.3