Value / Caption of a Select component

Hi !

Let’s say I have a MyBean class which contains a reference to another class “MyRefBean” identifier.

public class MyBean {

  private String myRefBeanId;


I created a form to fill a MyBean object, myRefBeanId being bounded through a Select component. Is this the best (only ?) way to use the Select component to display a caption which is different from the value ?

Select select = new Select("My Select component");

List<MyRefBean> beans = getMyRefBeanCollection();
BeanItemContainer<String> container = new BeanItemContainer<String>(String.class);
for (MyRefBean refBean : beans ) {
	BeanItem<String> beanItem = container.addBean(refBean.getValueProperty());
	beanItem.addItemProperty("displayName",new ObjectProperty(refBean.getDisplayProperty()));


You can also use a pure select:

Select select=new Select();
for(Foo foo: foos)

…thanks. Actually I found such sample in my code that I wrote few days ago… :wacko: