diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-03-24 10:05:38 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-03-24 10:05:38 +0000 |
commit | 4e1d1321ec50c130aafca8d1251a71f12f5e28d1 (patch) | |
tree | 1e90d6c509563ecdd84a9946d45dd81649075e31 /tests | |
parent | 1b55615e5157517eed59265776bad0dcbbdc53d3 (diff) | |
download | vaadin-framework-4e1d1321ec50c130aafca8d1251a71f12f5e28d1.tar.gz vaadin-framework-4e1d1321ec50c130aafca8d1251a71f12f5e28d1.zip |
fixes #3913
svn changeset:12055/svn branch:6.3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java b/tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java index 32f1de752a..3ef26c7e1c 100644 --- a/tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java +++ b/tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java @@ -6,12 +6,18 @@ import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; import com.vaadin.ui.ComboBox; import com.vaadin.ui.DateField; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.OptionGroup; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; public class FocusAndBlurListeners extends TestBase { @@ -37,26 +43,72 @@ public class FocusAndBlurListeners extends TestBase { @Override protected void setup() { Layout l = getLayout(); + TextField tf = new TextField("TextField"); l.addComponent(tf); + DateField df = new DateField("DateField"); l.addComponent(df); ComboBox cb = new ComboBox("ComboBox"); - l.addComponent(cb); + Button btn = new Button("Button"); + l.addComponent(btn); + + NativeButton nbtn = new NativeButton("NativeButton"); + l.addComponent(nbtn); + + CheckBox chkb = new CheckBox("CheckBox"); + l.addComponent(chkb); + + OptionGroup og = createOptionGroup("OptionGroup"); + og.setMultiSelect(false); + l.addComponent(og); + + final OptionGroup ogm = createOptionGroup("OptionGroup (multiselect)"); + ogm.setMultiSelect(true); + l.addComponent(ogm); + + btn.addListener(new ClickListener() { + + private int i; + + public void buttonClick(ClickEvent event) { + ogm.addItem("newItem" + i++); + + } + }); + tf.addListener(focusListener); tf.addListener(blurListener); df.addListener(focusListener); df.addListener(blurListener); cb.addListener(focusListener); cb.addListener(blurListener); + btn.addListener(focusListener); + btn.addListener(blurListener); + nbtn.addListener(focusListener); + nbtn.addListener(blurListener); + chkb.addListener(focusListener); + chkb.addListener(blurListener); + og.addListener(focusListener); + og.addListener(blurListener); + ogm.addListener(focusListener); + ogm.addListener(blurListener); l.addComponent(messages); } + private OptionGroup createOptionGroup(String caption) { + OptionGroup og = new OptionGroup(caption); + og.addItem("Option 0"); + og.addItem("Option 1"); + og.addItem("Option 2"); + return og; + } + @Override protected String getDescription() { return "Testing blur and focus listeners added in 6.2"; |