Table Container for PropertySetItem

Hi,
i’m new to Vaadin and I’m trying to build something like AddressBook Application. The difference is that my data model is composed of PropertySetItems instead of BeanItems.
Now, I understand how to bind my PropertySetItems to my Form, but I can’t figure out how to build a container for my BeanItems.
This container will be datasource for a table to display the content of my PropertySetItems.

Is there something like BeanItemContainer for PropertySetItem?? …or do I’ have to build it from scrath?
If yes… any suggestion?
Thank you very much and congratulation for your wonderfull framework.

Michele

Most/all standard containers do not allow you to use custom items, but are designed for a particular item type, and implementing a full-featured container from scratch is not a very easy task.

You might find
LazyQueryContainer
or
some other container from the directory
useful.

Thank you very much, I will with LazyQueryContainer.

Michele,

I am also in need of a Container for a list of PropertysetItems. Is there any sample code you can post on how you got LazyQueryContainer to work with PropertysetItems?

Thanks,

Jonathan

Henri - You mention there might be some other container add-ins that can handle PropertysetItems besides LazyQueryContainer. If still available, can you name them?

None of the standard containers does this - I’m not sure if there are some in the directory.

However, BeanItem is a subclass of PropertySetItem. Therefore, you could use e.g. a subclass of BeanContainer where you (e.g. in the constructor) remove all extra properties using removeContainerProperty() and then add new ones with a custom VaadinPropertyDescriptor if necessary. You could use almost any bean class in this case, and your items would be instances of BeanItem - you can even control their creation by overriding createBeanItem().

Alternatively, you could implement your own container - with AbstractInMemoryContainer introduced in Vaadin 6.6, this would not be too hard in your case. The minimal implementation would just implement getUnfilteredItem() and add some public add/removeItem() or similar methods which simply call corresponding superclass methods and store the PropertySetItem in a map or remove it.

For more functionality (filtering, sorting), you need to implement a few more methods, again primarily calling corresponding protected superclass methods. See e.g. AbstractBeanContainer as an example.