From b96bdd865ba2010840ae2d08bbcd7369ca13f815 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Thu, 12 Apr 2012 11:43:34 +0300 Subject: [PATCH] Fix ShortCutListenerModification test --- .../button/ShortCutListenerModification.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/testbench/com/vaadin/tests/components/button/ShortCutListenerModification.java b/tests/testbench/com/vaadin/tests/components/button/ShortCutListenerModification.java index f338b1ac90..295c04fc0c 100644 --- a/tests/testbench/com/vaadin/tests/components/button/ShortCutListenerModification.java +++ b/tests/testbench/com/vaadin/tests/components/button/ShortCutListenerModification.java @@ -6,6 +6,7 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Component; import com.vaadin.ui.Notification; import com.vaadin.ui.Window; @@ -36,9 +37,6 @@ public class ShortCutListenerModification extends TestBase implements Button button1 = new Button("b1 (CTRL-C)"); Button button2 = new Button("b2 (CTRL-V)"); - button1.setData(window); - button2.setData(window); - button1.addListener(this); button2.addListener(this); @@ -63,8 +61,12 @@ public class ShortCutListenerModification extends TestBase implements } public void buttonClick(ClickEvent event) { - Window window2 = (Window) event.getButton().getData(); - window2.close(); + Component c = event.getButton(); + while (!(c instanceof Window)) { + c = c.getParent(); + } + ((Window) c).close(); + Button prev = (Button) event.getButton().getData(); if (prev != null) { prev.focus(); -- 2.39.5