@@ -0,0 +1,2526 @@
+package com.vaadin.tests.components.window;%0A%0Aimport com.vaadin.event.Action;%0Aimport com.vaadin.event.Action.Handler;%0Aimport com.vaadin.event.FieldEvents.BlurEvent;%0Aimport com.vaadin.event.FieldEvents.BlurListener;%0Aimport com.vaadin.event.FieldEvents.FocusEvent;%0Aimport com.vaadin.event.FieldEvents.FocusListener;%0Aimport com.vaadin.event.ShortcutAction;%0Aimport com.vaadin.tests.components.TestBase;%0Aimport com.vaadin.ui.Button;%0Aimport com.vaadin.ui.Button.ClickEvent;%0Aimport com.vaadin.ui.TextField;%0Aimport com.vaadin.ui.Window;%0A%0Apublic class SubWindowFocusAndBlurListeners extends TestBase %7B%0A%0A    @Override%0A    protected String getDescription() %7B%0A        return %22Focus and blur listeners should work. Note the %22%0A                + %22side efect (focusing) when callintg bring to front.%22;%0A    %7D%0A%0A    @Override%0A    protected Integer getTicketNumber() %7B%0A        return 5039;%0A    %7D%0A%0A    @Override%0A    protected void setup() %7B%0A%0A        final Window window = new Window(%22Focus test window%22);%0A        window.getContent().setSizeUndefined();%0A%0A        window.addComponent(new TextField());%0A        window.addListener(new FocusListener() %7B%0A            public void focus(FocusEvent event) %7B%0A                event.getComponent().getWindow()%0A                        .showNotification(%22Focused window%22);%0A            %7D%0A        %7D);%0A%0A        window.addListener(new BlurListener() %7B%0A            public void blur(BlurEvent event) %7B%0A                event.getComponent().getWindow()%0A                        .showNotification(%22Blurred window%22);%0A            %7D%0A        %7D);%0A%0A        window.addActionHandler(new Handler() %7B%0A%0A            private Action%5B%5D s = new Action%5B%5D %7B new ShortcutAction(%22%5ESave%22) %7D;%0A%0A            public Action%5B%5D getActions(Object target, Object sender) %7B%0A                return s;%0A            %7D%0A%0A            public void handleAction(Action action, Object sender, Object target) %7B%0A                window.showNotification(%22Action!%22);%0A            %7D%0A        %7D);%0A%0A        Window main = getLayout().getWindow();%0A%0A        main.addWindow(window);%0A%0A        main.addComponent(new TextField());%0A%0A        Button button = new Button(%22Bring to front (should focus too)%22,%0A                new Button.ClickListener() %7B%0A                    public void buttonClick(ClickEvent event) %7B%0A                        window.bringToFront();%0A                    %7D%0A                %7D);%0A        main.addComponent(button);%0A%0A        Window window2 = new Window(%22Another window for testing%22);%0A        main.addWindow(window2);%0A        window2.setPositionX(50);%0A%0A    %7D%0A%7D%0A

test case for #5039