Dynamically adding/removing components

Hi All,

I have a question regarding adding/removing components dynamically. My application has the following requirement:

When a user clicks on an entry in a table, a popup window is shown with some content. This window is added with getMainWindow().addWindow(poopupWindow). The user is able to dock/undock this window. When the user docks this window, I do the following:

  1. Set the visibility of the window to false
  2. Add a Panel as the last component to the GridLayout (which is my mainlayout) and set the expandratio of this row to 0.5.
  3. When a user undocks this panel, I remove this component from the datagrid and set the expandration of the row to 0. I also set the visibility of the popupWindow to true.

Basically this works. However, sometimes when the window is docked, the docked panel is not visible in the browser. When I undock again, the layout is messed up. This happens when I dock/undock repeatedly. Is the above method the proper way of handling this scenario?

Regards,
Jamie

It seems that I managed to solve the issue by calling the requestRepaintAll on the mainWindow when the contents are docked AND calling the requestRepaintAll on the window, when the window is made visible again.

For your information: It went wrong when I repeatedly docked and undocked the window while performing other UI actions. requestRepaintAll solved my issue.

Normally, it should not be necessary to call requestRepaintAll from application code.

Which Vaadin version and which browser version did you see this with? Was this consistently reproducible with a certain sequence of actions, or did it happen every now and then seemingly randomly?

This could be a bug somewhere. If you are able to create a simple test case with which this is easy to reproduce, a
ticket
would be helpful.

I use Vaadin 6.3.3 in my application and the issue and the browser I tested were IE8 and the latest version of Chrome. It was most of the time consistently reproducible, especially when actions were performed in quick succession.

Since this feature is part of a larger application I will need some time to extract some of the code to create a simple test case for this specific scenario. I will keep you updated.

I think I managed to resolve the issue. There were still some layout problems present when I used the debug console. After fixing those, the issue seems resolved.