Problem with a Notification placement after component replacement

Hi there !

I have a strange problem with a notification in my application.
The context is as follow :
We are developing a liferay portlet using Vaadin 6.5.4. This portlet is composed of three components : a search screen, and two “detail” screens.
The search screen and first detail screen fit well in the browser window, without scrollbars. The last detail screen (let’s call it detail 2), however, is big enough that a scroll bar is necessary.
The screen cinematic is search → detail 1 → detail 2.

The problem I have happens when you go on the second detail component, you modify data and click on the save button at the bottom of the panel. This sends an event which is caught by the main container which calls a method to save the data, replace the detail 2 component with the detail 1 component (which is significantly smaller than the detail 2 component) and then display a Humanized Notification to say the save was successful.
The problem is that the notification is positioned as if the detail 2 component was still displayed, meaning it appears at the bottom of the window (which would be the center of the window if we were still on the detail 2 component).

As I see it, it’s a refresh problem : the getWindow gives a window whose size has not been yet updated with the detail 1 size information.

I tried to force a repaint, to show the notification via component.getWindow() and application.getMainWindow(), launch another event in order to create a false delay…

I am now completely stuck. Do you have any idea on what the problem is and how to solve it ?




The notification is centered using Window.getClientWidth/Height, and I believe notifications are the last thing that is shown after a repaint in the client, so everything else should be updated before that. Server side actions most likely won’t affect this issue.

Is there anything else on the page than the Vaadin portlet? And the scrollbar is shown on the body element of the portal or is it in the v-view element?

The portlet is the only one in the liferay page, and the scrollbar is on the body element of the portal, not the portlet itself.

Just to add a bit more info : when the notification is shown, it appears at the bottom of the browser’s window with the scrollbar displayed on the portal (not the portlet). When it disapear, so does the scrollbar.

I still don’t see how to proceed to solve this :frowning:

One reason I can think of is that when the contents of the portlet change, the size of the portlet view need to be updated, and this might be done as a deferred command (i.e. with a delay), and the notification might then get wrong dimensions for the position.

It’s quite hard to say what really goes wrong without a good test case. Can you create a simple portlet where this issue is present, and post the code here then?

Hi everybody,
I have the same problem with a vaadin portlet into liferay page. and wrong positioning of notifications.
I have a vaadin portlet inside a liferay page. In this portlet, dynamically loads components by lengthening the height of the page. The problem is that if I see a notification, it is not visible or is positioned down and not in the middle.
Does anyone have the same problems? Can you help me?
Thank you…