How to Add/remove UI components dynamically in liferay portlet

Hi
I’m new to Vaadin and liferay. I’m developing a liferay 6.0 portlet in Vaadin where the user can dynamically add or remove components based on their preferences.
The way I’m trying to achieve this is by adding and removing UI components in a Vertical layout at runtime. But the newly added components do not appear in the portlet immediately when the
addComponent
method is called. However when the user clicks a UI component such as a button or a checkbox after
addComponent
has been called, then the newly added component renders right away. But of course, I want the component to render as soon as the
addComponent
method is called. I don’t know if this is because of the portlet environment or something else.
I have added true tag in liferay-portlet.xml
And I have also tried the Refresher add-on in Vaadin directory but to no avail.
Please tell me where I went wrong!

Regards
Nabeel

It certainly should work.

If you add the components in a (UIDL, i.e. normal user interaction such as in a listener) request, they should show up immediately. If you add them in a background thread (i.e. anywhere but in a UIDL request for that Vaadin application), they should show up on the next UI request. Don’t forget to synchronize on the Application instance.

I suspect the Refresher is either not compiled into the widgetset, or you are not using the widgetset that includes the refresher component.

This should get easier very soon thanks to an “admin” portlet that will let you drop the add-ons in a directory on the portal and then click a button in the portlet to recompile the widgetset with all add-ons. Then just add a reference in your liferay-plugin-package.properties to the add-on JAR, like there should be a reference to the Vaadin JAR. Look for an announcement of the first version of the widgetset management portlet in the next days (I hope) on the forum.