From: Artur Signell Date: Tue, 13 Jan 2009 07:57:02 +0000 (+0000) Subject: Test case for #2451 - ComboBox value change X-Git-Tag: 6.7.0.beta1~3354 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=def6a163ec21667829862914d3f605ea9699d490;p=vaadin-framework.git Test case for #2451 - ComboBox value change svn changeset:6510/svn branch:trunk --- 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 index 0000000000..4d502247b6 --- /dev/null +++ b/src/com/itmill/toolkit/tests/components/combobox/ComboBoxValueUpdate.java @@ -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); + + } + +}