diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-12-02 12:26:58 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-12-02 12:26:58 +0000 |
commit | 18feee13c3ddaeee8e05ed7971de591bc4eadd14 (patch) | |
tree | b61699318dc695c1b31305f2e838e0ddfb7cab90 /tests/src | |
parent | 9954b8421e2117e068e274c834b8e4d4e0c2bcbc (diff) | |
download | vaadin-framework-18feee13c3ddaeee8e05ed7971de591bc4eadd14.tar.gz vaadin-framework-18feee13c3ddaeee8e05ed7971de591bc4eadd14.zip |
fixes #3786, focus and blur events for (textual) datefields and combobox
svn changeset:10131/svn branch:6.2
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java b/tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java new file mode 100644 index 0000000000..32f1de752a --- /dev/null +++ b/tests/src/com/vaadin/tests/components/FocusAndBlurListeners.java @@ -0,0 +1,70 @@ +package com.vaadin.tests.components; + +import java.util.Date; + +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.ComboBox; +import com.vaadin.ui.DateField; +import com.vaadin.ui.Label; +import com.vaadin.ui.Layout; +import com.vaadin.ui.TextField; +import com.vaadin.ui.VerticalLayout; + +public class FocusAndBlurListeners extends TestBase { + + private FocusListener focusListener = new FocusListener() { + + public void focus(FocusEvent event) { + Label msg = new Label(new Date() + " Focused " + + event.getComponent().getCaption()); + messages.addComponentAsFirst(msg); + } + }; + private BlurListener blurListener = new BlurListener() { + + public void blur(BlurEvent event) { + Label msg = new Label(new Date() + " Blurred " + + event.getComponent().getCaption()); + messages.addComponentAsFirst(msg); + + } + }; + private VerticalLayout messages = new VerticalLayout(); + + @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); + + tf.addListener(focusListener); + tf.addListener(blurListener); + df.addListener(focusListener); + df.addListener(blurListener); + cb.addListener(focusListener); + cb.addListener(blurListener); + + l.addComponent(messages); + + } + + @Override + protected String getDescription() { + return "Testing blur and focus listeners added in 6.2"; + } + + @Override + protected Integer getTicketNumber() { + return null; + } + +} |