Popup from Popup

Can you create a popup window from Popup Window ?

I have a popup window which displays a table grid and I would like to display another form (popup window) when user double clicks on the row in the table grid.

Thank You

Peter

That should not be a problem. Just add the new popup window to the root window - it should nicely popup on top of the previous one.

        final Window mainWindow = new Window("Pt Application");
        Window p1 = new Window("1");
        mainWindow.addWindow(p1);
        p1.addComponent(new Button("pop", new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                Window p2 = new Window("p2");
                mainWindow.addWindow(p2);
            }
        }));
        setMainWindow(mainWindow);

Thank You!

I did not think of that!

I have tried this but I am getting the following error:

com.vaadin.event.ListenerMethod$MethodException
Cause: java.lang.IllegalArgumentException: Only one level of subwindows are supported.
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:507)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1107)
at com.vaadin.ui.Table.handleClickEvent(Table.java:1991)
at com.vaadin.ui.Table.changeVariables(Table.java:1826)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1060)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:561)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:260)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:438)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)

Here’s my code

	final Window mainWindow = new Window("Pt Application");
	Window p1 = new Window("1");
	mainWindow.addWindow(p1);
	p1.addComponent(new Button("pop", new Button.ClickListener() {
		public void buttonClick(ClickEvent event) {

			Window p2 = new Window("p2");
			mainWindow.addWindow(p2);
		}
	}));

	getWindow().addWindow(mainWindow);

worked fine for me, as long as I just changed the last row to setMainWindow(mainWindow); It had wrong syntax.

The code as a whole:

public void init() {
    final Window mainWindow = new Window("Pt Application");
    Window p1 = new Window("1");
    mainWindow.addWindow(p1);
    p1.addComponent(new Button("pop", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {

            Window p2 = new Window("p2");
            mainWindow.addWindow(p2);
        }
    }));

    setMainWindow(mainWindow);
}