Multiple Windows opened error dependent on log

Hi people!

I’m developing a web application with a login service (I’m using Spring too).
In one tab, I’ve a Table that contains an Indexed Container. And if I click a row it opens a new Window (with few options).
So, my problem is that if I log out and I log in again (with same or different User, it doesn’t matter) when I click a row appears a new Window for each log in… eg

loggin A
1 window
loggout A

loggin B
2 windows
loggout B

loggin A
3 windows
loggout A

I don’t know why is happening this… what I’m doing wrong?

Here is my code to log out…
public void buttonClick(ClickEvent event) {
Button source = event.getButton();

if (source == logout) {


Any idea??

Can you please also post your login code? specifically the part in the button click if the user passes the authentication.

Have you overriden the getWindow method of your Application object ?

Here is loggin code too:

login.addListener(new Button.ClickListener() {
public void buttonClick(Button.ClickEvent event) {
try {

				// Athenticate the user
                                    // username & password are texfields
				authenticate((String) username.getValue(),
						(String) password.getValue());

				// Switch to the main view
						new MainView(app));

			} catch (Exception e) {


public void authenticate(String username, String password) throws Exception {

	if (app.getAuthenticationService() == null) {
		throw new Exception(app.getMessage(Messages.ServiceUnavilable));
	} else if (!app.getAuthenticationService().authenticate(username, password)) {
		throw new Exception(app.getMessage(Messages.FailedLogin));
	} else {

		// Login successful, add user id to session



AuthenticationService is a lib offered by other framework (Activiti).
Where should be the override annotation? On class constructor (I haven’t it)?? like…


public LoginView( ) {

Keep in touch :smiley: !

Well what is it you do in the following methods?

new MainView(app));

What class is “app” object and “MainView”. It likely that in the switchScreen you do something with the mainwindow of the vaadin application etc . You need to debug that part or keep posting code… i might get somewhere :slight_smile:

p.s. the Override annotation is for compile time and you can place it on whatever you actually override, if you place it wrong you’ll know it since you’ll get an error at compile time.

First, app is AdminApp who starts everything and then it offers to the other classes (is like a main)

public void init() {

	// Set theme

	// Set default locale
	setLocale(new Locale("en"));

	// Init resource bundle
	final ResourceBundle i18n = ResourceBundle.getBundle(
			Messages.class.getName(), getLocale());

	// Add title
	mainWindow = new Window(i18n.getString(Messages.AppTitle));
	// Set window to full size

	// Set as main window

	// Add window to view manager
	viewManager = new ViewManager(mainWindow);

	// Create the login screen
			.switchScreen(LoginView.class.getName(), new LoginView(this));


And in the class ViewManager I have:

public void switchScreen(String viewName, Layout newView) {
	Layout view;
	if (newView != null) {
		view = newView;
		views.put(viewName, newView);
	} else
		view = views.get("viewname");


I tried to override it but is not allowed (I thought that I undestand how to use override annotation but … maybe I’m wrong :S ).

If could help anybody, my loggin code is based on P.Holmström application. But I changed a lot the UI and few other things…
Here I link you (it’s a really great job):

Any idea?
I’m a little bit lost