ValueChangeListener fo Combobox

Hi Vaadin experts,
My question:
May I ask someone to write an example ValueChangeListener so that it is not necessary to add a listener to every Combobox one by one?

ValueChangeListener should work like this: Allways when a client selects an item in a Combobox ValueChangeListener should collect selected values of all Comboboxes like hasMap and call some method. This method does something and the result is published in in a TextField ‘String number’.

I have a pojo (class ValikkoPojo):
It includes
String number = ””;
String mark;
String model;

and about 20 other Strings + getters and seters.
‘String number’ is a TextField and other Strings are Comboboxes or maybe Selects.
Comboboxes are creted by this bean: setItemDataSource(new BeanItem(dataModel));

The examples that I have found have one or two Combobox that has its own listener.

Tapani

I am not sure if I understood the problem, but you might want to do something like:

final ComboBox[] combos = new ComboBox[10]
;
Property.ValueChangeListener listener = new Property.ValueChangeListener() {
    public void valueChange(ValueChangeEvent event) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 10; i++) {
            sb.append(i > 0 ? "-" : "");
            sb.append(combos[i]
.toString());
        }
        mainWindow.showNotification("State = " + sb);
    }
};
for (int i = 0; i < 10; i++) {
    combos[i]
 = new ComboBox("Box " + i);
    combos[i]
.addListener(listener);
    mainWindow.addComponent(combos[i]
);
}

Joonas,
your code is good for me.
Tapani