From: Henri Sara Date: Thu, 12 Apr 2012 08:43:34 +0000 (+0300) Subject: Fix ShortCutListenerModification test X-Git-Tag: 7.0.0.alpha2~64 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b96bdd865ba2010840ae2d08bbcd7369ca13f815;p=vaadin-framework.git Fix ShortCutListenerModification test --- 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();