]> source.dussan.org Git - vaadin-framework.git/commitdiff
Test case for #2451 - ComboBox value change
authorArtur Signell <artur.signell@itmill.com>
Tue, 13 Jan 2009 07:57:02 +0000 (07:57 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 13 Jan 2009 07:57:02 +0000 (07:57 +0000)
svn changeset:6510/svn branch:trunk

src/com/itmill/toolkit/tests/components/combobox/ComboBoxValueUpdate.java [new file with mode: 0644]

diff --git a/src/com/itmill/toolkit/tests/components/combobox/ComboBoxValueUpdate.java b/src/com/itmill/toolkit/tests/components/combobox/ComboBoxValueUpdate.java
new file mode 100644 (file)
index 0000000..4d50224
--- /dev/null
@@ -0,0 +1,40 @@
+package com.itmill.toolkit.tests.components.combobox;
+
+import com.itmill.toolkit.data.Property.ValueChangeEvent;
+import com.itmill.toolkit.data.Property.ValueChangeListener;
+import com.itmill.toolkit.tests.components.TestBase;
+import com.itmill.toolkit.ui.ComboBox;
+import com.itmill.toolkit.ui.Label;
+
+public class ComboBoxValueUpdate extends TestBase {
+
+    private Label selectedLabel;
+
+    @Override
+    protected String getDescription() {
+        return "Testcase for value update for ComboBox. The server-side value should be updated immediately when a new item is selected in the dropdown";
+    }
+
+    @Override
+    protected void setup() {
+        ComboBox combobox = new ComboBox();
+        combobox.setImmediate(true);
+        combobox.addItem("Item 1");
+        combobox.addItem("Item 2");
+        combobox.addItem("Item 3");
+        combobox.addListener(new ValueChangeListener() {
+
+            public void valueChange(ValueChangeEvent event) {
+                Object p = event.getProperty().getValue();
+                selectedLabel.setValue("Server side value: " + p);
+            }
+
+        });
+        selectedLabel = new Label("Server side value: " + combobox.getValue());
+        getLayout().addComponent(selectedLabel);
+
+        getLayout().addComponent(combobox);
+
+    }
+
+}