3

How can I create a modal dialog window in Vaadin 7.x? I've already found out that I have the main window and add to this my new dialog window, but how can I get the main window? I want to reach it from a View.

getApplication().getMainWindow()
getWindow()

none of them works..

Slenkra
  • 820
  • 1
  • 8
  • 14

1 Answers1

7

This depends which is your main class. From a normal UI-inherited class you can just use addWindow(...) to add a dialog(subwindow) to the UI.

public class MyApplication extends UI
{

    @Override
    protected void init(VaadinRequest request) 
    {
        addWindow(new ModalWindow());
    }
}
André Schild
  • 4,592
  • 5
  • 28
  • 42
  • 4
    Great, it works! I didn't try addWindow() (I don't know why.. :) ) Just one more tip: if you are not in main class then UI.getCurrent().addWindow() will work perfectly. – Slenkra May 03 '13 at 16:26