diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2020-04-01 11:38:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-01 11:38:11 +0300 |
commit | f4dc8b29525019f9d4a79e712d64a0e2bede4587 (patch) | |
tree | eeda4ff8aed2cd71e0d2c20add435252b2b718db /client/src | |
parent | 34d93e6468e3f6a56f0eca74a9122ae39bd7e504 (diff) | |
download | vaadin-framework-f4dc8b29525019f9d4a79e712d64a0e2bede4587.tar.gz vaadin-framework-f4dc8b29525019f9d4a79e712d64a0e2bede4587.zip |
Ensure ChangeListener still works after first upload. (#11936)
Fixes #10420
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VUpload.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VUpload.java b/client/src/main/java/com/vaadin/client/ui/VUpload.java index 2f4b62a47f..e72fe3e838 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUpload.java +++ b/client/src/main/java/com/vaadin/client/ui/VUpload.java @@ -40,6 +40,7 @@ import com.vaadin.client.ConnectorMap; import com.vaadin.client.StyleConstants; import com.vaadin.client.ui.upload.UploadConnector; import com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy; +import com.vaadin.shared.EventId; import com.vaadin.shared.ui.upload.UploadServerRpc; /** @@ -264,6 +265,16 @@ public class VUpload extends SimplePanel { if (isImmediateMode()) { fu.sinkEvents(Event.ONCHANGE); } + fu.addChangeHandler(event -> { + if (client != null) { + UploadConnector connector = ((UploadConnector) ConnectorMap + .get(client).getConnector(VUpload.this)); + if (connector.hasEventListener(EventId.CHANGE)) { + connector.getRpcProxy(UploadServerRpc.class) + .change(fu.getFilename()); + } + } + }); } /** |