ConfirmDialog problem with authentication window


Authenticating Vaadin based Applications
My application uses authentication mechanism using a LoginWindow described in

With that if I use confirmDialog, after successful login and application loading data in a table, as such

					ConfirmDialog.show(getMainWindow(), "Delete Entry:", "Are you sure?", "Yes", "No",
							new ConfirmDialog.Listener() {

								public void onClose(ConfirmDialog dialog) {
									if (dialog.isConfirmed()) {
										table.removeItem(table.getValue());
										close();
									}
								}
							});

upon closing the dialog, it takes me back to the login window instead of the application window

My logical coding flow is -

  1. Launch login window
  2. On successful authentication,

[indent]

[/indent]create a new window w

[indent]

[/indent]setMainWindow(w)

[indent]

[/indent]build application layout

[indent]

[/indent]set layout to window w

[indent]

[/indent]load data

  1. From the loaded table data, context menu “Delete Entry” invokes the confirmDialog as shown above

  2. When confirming yes, the table removes the item, popup closes but the main page goes back to login window instead of application window and I am forced to restart my application

Any help is appreciated

Thanks
Nilesh

Hi,

I noticed you are calling the close() method in the onClose method. That is probably what you did not want to do, because it closes
the whole application
causing it to reset (and go back to the login view I guess).

(And the ConfirmDialog you don’t need to close at all. It is closed automatically.)

Thank you Sami!

That was it - a victim of copy-paste error.