summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2009-12-02 12:26:58 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2009-12-02 12:26:58 +0000
commit18feee13c3ddaeee8e05ed7971de591bc4eadd14 (patch)
treeb61699318dc695c1b31305f2e838e0ddfb7cab90 /tests/src
parent9954b8421e2117e068e274c834b8e4d4e0c2bcbc (diff)
downloadvaadin-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.java70
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;
+ }
+
+}