From a8d6138ab0e42a1412d37ef151d77b8e40152271 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 1 Sep 2011 07:06:17 +0000 Subject: #6630 improved submitUpload so that upload started listeners now trigger server side event svn changeset:20781/svn branch:6.6 --- .../tests/components/upload/ForceSubmit.java | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/src/com/vaadin/tests/components/upload/ForceSubmit.java b/tests/src/com/vaadin/tests/components/upload/ForceSubmit.java index fef82dd962..9f5c2b67e2 100644 --- a/tests/src/com/vaadin/tests/components/upload/ForceSubmit.java +++ b/tests/src/com/vaadin/tests/components/upload/ForceSubmit.java @@ -5,12 +5,14 @@ import java.io.OutputStream; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.TextField; import com.vaadin.ui.Upload; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Upload.FailedEvent; import com.vaadin.ui.Upload.FinishedEvent; import com.vaadin.ui.Upload.Receiver; +import com.vaadin.ui.Upload.StartedEvent; public class ForceSubmit extends TestBase implements Receiver { @@ -26,6 +28,9 @@ public class ForceSubmit extends TestBase implements Receiver { @Override protected void setup() { + final TextField textField = new TextField("Test field"); + addComponent(textField); + final Upload u; u = new Upload("Upload", this); @@ -49,6 +54,13 @@ public class ForceSubmit extends TestBase implements Receiver { } }); + u.addListener(new Upload.StartedListener() { + public void uploadStarted(StartedEvent event) { + getMainWindow().showNotification( + "Started upload. TF value :" + textField.getValue()); + } + }); + Button button = new Button( "I'm an external button (not the uploads builtin), hit me to start upload."); button.addListener(new ClickListener() { @@ -63,11 +75,11 @@ public class ForceSubmit extends TestBase implements Receiver { @Override protected String getDescription() { - return "Some wireframists are just so web 1.0. If requirements " + - "say the upload must not start until the whole form " + - "is 'Oukeyd', that is what we gotta do. In these cases " + - "developers most probably also want to hide the uploads" + - " internal button by setting its caption to null."; + return "Some wireframists are just so web 1.0. If requirements " + + "say the upload must not start until the whole form " + + "is 'Oukeyd', that is what we gotta do. In these cases " + + "developers most probably also want to hide the uploads" + + " internal button by setting its caption to null."; } } -- cgit v1.2.3