Directory

CollectionContainer - Vaadin Add-on Directory

The simple way of binding collections and arrays to the data-aware Vaadin components like the Table and the Select. CollectionContainer - Vaadin Add-on Directory
Sometimes you only have a list or array of objects you'd like to bind to a ListSelect or a Table and forget about the fancy Container features like lazy loading or automatic updates. Creating a Container from a list or array of beans, string, integers is easy. And you can configure the CollectionContainer to have different type of ids. CollectionContainer is a read-only Container implementation suitable best for small amounts of data, backed simply by a collection storage. Here are some samples: Use the object itself as id (like in the stock BeanItemContainer): select.setContainerDataSource(CollectionContainer.fromBeans(myBeans)); select.setContainerDataSource(CollectionContainer.fromPrimitives(new String[]{"One","Two","Three"})); Index based id that allows duplicate objects: select.setContainerDataSource(CollectionContainer.fromBeans(myBeans,true)); select.setContainerDataSource(CollectionContainer.fromPrimitives(new String[]{"One","Two","Three","One"},true)); A two dimensional array to a table using: String[][] array = new String[][] { new String[]{"One","Two"}, new String[] {"Three","Four"}}; table.setContainerDataSource(CollectionContainer.fromPrimitives(array)); And you can even use a bean property as the item id: select.setContainerDataSource(CollectionContainer.fromBeans(myBeans,"idField")); This is an experimental component, but it has been successfully utilized in many projects already. It only supports reading, not writing or adding items to container.
Online Demo
Source Code
Discussion Forum
Author Homepage
Issue Tracker

CollectionContainer version 0.9.3
Fixed null item sorting. Thanks tnsan79 for the patch.