From 09969ce1fedb3dc9cca863c393735f64bfbbedc1 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 3 Feb 2014 21:46:06 +0200 Subject: Add change event for Upload (#13222) Change-Id: I9850888b1997104cbc493ae0882316a9d2b1cedd --- .../com/vaadin/client/ui/upload/UploadConnector.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'client/src') diff --git a/client/src/com/vaadin/client/ui/upload/UploadConnector.java b/client/src/com/vaadin/client/ui/upload/UploadConnector.java index 989a913adc..03f1a2802c 100644 --- a/client/src/com/vaadin/client/ui/upload/UploadConnector.java +++ b/client/src/com/vaadin/client/ui/upload/UploadConnector.java @@ -16,13 +16,17 @@ package com.vaadin.client.ui.upload; +import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.ChangeHandler; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; import com.vaadin.client.ui.AbstractComponentConnector; import com.vaadin.client.ui.VUpload; +import com.vaadin.shared.EventId; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.upload.UploadClientRpc; +import com.vaadin.shared.ui.upload.UploadServerRpc; import com.vaadin.ui.Upload; @Connect(Upload.class) @@ -38,6 +42,21 @@ public class UploadConnector extends AbstractComponentConnector implements }); } + @Override + protected void init() { + super.init(); + + getWidget().fu.addChangeHandler(new ChangeHandler() { + @Override + public void onChange(ChangeEvent event) { + if (hasEventListener(EventId.CHANGE)) { + getRpcProxy(UploadServerRpc.class).change( + getWidget().fu.getFilename()); + } + } + }); + } + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { if (!isRealUpdate(uidl)) { -- cgit v1.2.3