Problems using BeanItemContainer based on Interface

Hi Guys,

We are using Vaadin 7.0.0 in a liferay portlet project.

The use case is very simple: we want to display all deployed portlets in a combobox.

In Liferay the method to get this list is

 PortletLocalServiceUtil.getPortlets(themeDisplay.getCompanyId(), false, false))

This works very well and returns a list of Portlet (interface) objects, which are in fact PortletImpl objects at runtime.

When trying to construct a beanitemcontainer based on the fetched list there are also no problems.

The problems arise when I bind the container to the Combobox.

When starting the application nothing is displayed. I was expecting to see a combobox with a lot of items in it with a caption of the memory address since I did not set the itemcaptionmode.

If i replace the interface with an implementation class it works just fine.

Does this mean you cannot use interface type for beanitemcontainer or am I overlooking something?

Hope you guys can help!

Regards,

Kim

Does the Interface contain the Getters and Setters for the properties you want to see?

Hi Tobias,

In my case we are talking about the com.liferay.portal.model.Portlet interface (http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portal/model/impl/PortletImpl.html) which indeed has a getter and setter for the property (portletName) I want to see as itemcaption in my combobox.

But even with no itemcaption mode specified I don’t get a filled combobx with memory addresses (which I would expect when no captionmode is specified.

Thx for taking the time to react!

Regards,

Kim

Hello Guys,

Problem solved! I was using a wrong id property. Portlet.getId() always returns 0 and this property is used in equals method. So container thinks all elements are the same!

Sorry for bothering!

Regards,

Kim