Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
how to reset the application from a subwindow's button
Hey,
I want to create a WarningDialog which resets the whole Application. I need something like "getApplication().close()". However, I've created the listener's function in the "SubWindow" class like this:
Button ok = new Button("Yeah!");
ok.addStyleName("danger");
ok.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
getApplication().close();
}
});
This is how I instanciate the dialog in the parent interface:
deny.addClickListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
WarningDialog dialog = new WarningDialog();
setEnabled(false);
UI.getCurrent().addWindow(dialog);
}
});
If I try to click the supposed ok button I get this error:
java.lang.Error: Unresolved compilation problem:
The method getApplication() is undefined for the type new Button.ClickListener(){}
Can someone help me out how to reset the application from a subwindow (dialog)?
Thanks! :)
Where did you get the getApplication()? It doesn't exist in Vaadin 7. It's not in the book page either and...oh, it's still mentioned in one section.
You probably want to use "Session.getCurrent().close();".
There's some examples here. If you don't set the page location, closing the session will restart the application (the session and UIs) immediately.
Marko Grönroos: Where did you get the getApplication()? It doesn't exist in Vaadin 7. It's not in the book page either and...oh, it's still mentioned in one section.
You probably want to use "Session.getCurrent().close();".
There's some examples here. If you don't set the page location, closing the session will restart the application (the session and UIs) immediately.
Thanks :)
Button ok = new Button("Yeah!");
ok.addStyleName("danger");
ok.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
getSession().close();
}
});