Popup-windows don't show up

Hi,

We have a problem in our Vaadin-application (we’re using Vaadin 6.6.0). We have a button that creates a new popup window (extends Window) and adds this to the main window (mainWindow.addWindow(window);).

Sometimes (quite random, but once it kicks in, it keeps on occurring) the dialog isn’t shown. When debugging the app, the constructor of the popup window is called and the popup is added to the mainwindow without any exceptions. The UIDL returned in result of the button being clicked shows no changes:

for(;;);[{"changes":[]
, "meta" : {}, "resources" : {}, "locales":[]}]

When I do a complete page-refresh, the popup window(s) show up. So if I pressed the button 6 times, 6 popup-windows will occur (including all notifications). This is the case with all popups, not just that single class. This is the same when logging out (the applications main-screen changes).

On top of that, the opposite happens as wel. Sometimes (also randomly, and persisting afterward), a window.close() from within a button-click-handler (from a button on that dialog) doesn’t hide the window. When clicking on the button agian, an out of sync notification is shown (makes sense, since server-side, the window is closed).

First I thought it was a CSS issue, so I disabled the custom theme and used Reindeer insead → same issue. Tried to debug client-side but afaik, nothing is missing in the dom-tree (modality-curtain is there as well). Also, different browsers have this behaviour: FF3, FF4, Safari and Chrome on MacOSX.

Anyone had simmilar issues before? Any pointers where I could look (been debugging deep into vaadin for quite some hours now), will be much appreciated!

Mind Showing Snippet of the Actual Code?

One possibility that popped into my mind: are you using some custom window management, like enabling tabbed browsing and/or using uri fragments for navigation? If so, how are you referring to the main window? Do you use ThreadLocal, is it referencing the correct instances?

And also remember that if you use custom window management (allow multiple tabs to view the app), there is only one main window, and the rest are just plain window objects, and you need to reference those by other means than application.getMainWindow() (usually by accessing component.getWindow())

@Iwada Eja: https://svn.codehaus.org/activiti/activiti/trunk/modules/activiti-webapp-explorer2 :wink: The code that could be responsible is quite scatterred, will try to sum up how we use tomorrow.

@Jouni: We’re indeed using the URLFragments for navigation. Main window is reffered to by our Application subclass, retrieved using thread-local lookup. We didn’t do anything with the getWindow (to enable multi-tab support).

Good pointer about the window references, I’ll look a bit deeper into that as well.

Jouni, thanks a lot for the good pointer about the window, this kind of lead me to the solution. This is our setup:

  • ExplorerApplicationServlet, subclass of AbstractApplicationServlet
    → createNewApplication() uses the application-context to get a Session-scoped bean: explorerApp, with al our services (some session scoped, some app-wide) wired.
  • ExplorerApp (subclass of Application)
    → onRequestStart and onRequestEnd the current app is placed in a thread-local to make it accessible
    → close() method called super.close and did some specific cleanup in our app.

When looking deeper into the windows I noticed that, after logging out (application.close()), the same window (same object reference) was used for the login-screen. So the application returned by the ExplorerAppServlet was still the same one, even though it was closed.

Fixed it by checking in the onRequestComplete of the app was closed. If so, I just flushed the complete session-context (instead of only the vaadin-specific context, that the super.close() does). This cleaned up the session-scope of spring, resulting in a fresh app (and mainwindow) which shows and hides the popups the way it should.

Hi,
I am using Vaadin 6, and i want to open a popup sub window on button click. I wrote a sample code to check that, But it is not working. Can anyone help me to solve this.

public class DynaWindow extends Window {
public DynaWindow(String xml, String name) {
Window w = new Window(“Xml Representation”);
VerticalLayout content = new VerticalLayout();
Button submit = new Button(“A”);
content.addComponent(view);
addComponent(content);
w.setContent(content);
addWindow(w);
}
}

Thanks in advance.