Open Modal Window Issue

Greetings!

I’m developing some Vaadin apps as Liferay Portlets, and i’ve came across an issue that is bugging me, and I’ve not been able to solve it so far.

The problem is simple, I have a button that opens a ModalWindow with some content. If I open 2 different web browsers, and log on to my Liferay Portal with two different users with the same permissions ( let’s say User-A and User-B ), and both of them click that same button, only one of the users (the first one that has clicked, let’s say User-A) is presented with the modal window. And worse, He sees the modal window related to his button click, but also sees the window related to the other user’s( User-B ) button click.

As so, if the user( User-B ) that IS NOT SEEING ANY WINDOW clicks the button, for instance, 5 times, that is going to open 5 modal windows in the browser window of the other user( User-A ) AS SOON AS HE( User-A ) CLICK’S THE NEXT TIME ON THE BUTTON, ( plus the window related to this click ). To clear any confusion in the given example, the User-A sees all the windows related to both users clicks.

And more, this behavior never changes even if the users switch the clicking timing ( User-B clicks first than User-A ). This means that once the Portal e loadedUp, the first user that clicks the button e going to be the one that is presented with the modal window for as long as the portal is up.

This is the code that is fired up upon button click:


	public void openModalWindowWithContent(CustomComponent cc, String title){
		Window newWindow = new Window();
		
		newWindow.setModal(true);
		
		VerticalLayout layout = new VerticalLayout();
		
		newWindow.setCaption(title);
		
		layout.setMargin(true);
		layout.setSpacing(true);
		layout.setSizeUndefined();
		layout.addComponent(cc);
		
		newWindow.setContent(layout);
		
		mainApp.getMainWindow().addWindow(newWindow);
	}

Can anyone please help with this?

Thank’s in advance!

Cheers!.

Seems like the sessions of your Users are not cleanly separated. Are you using Spring or CDI?

… or static variables for UI components or other things that should be in the session?

That was it, a static variable!

I have developed a ModalWindowManager as a Singleton, and that was the root of the problem. I’ve changed the approach, and now it works. Thanks for the replies!

Cheers,
João Cartaxo.