Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin 8 ComboBox of POJOs
In Vaadin 7 I was using ComboBox.setContainerDataSource(IndexedContainer). The IndexedContainer contained Items with internal value and a localized presentation string. The internal value was bound to a DAO.
In the documentation of ComboBox and "Binding data to forms" I cannot find an example that handles this (which I find very common) use case.
I do comboBox.setItems(Collection<POJO>) and I think I need a converter:
The ComboBox ItemType which I specify in the Designer is my POJO with internal and localized presentation.
The DAO needs a String
Do I need a StringToPOJOConverter? Is there an example somewhere?
Can you do a
comboBox.setItemCaptionProvider(c -> i18n(c.getKey()); ?
This is one side of the problem. I solved it by defining a POJO.toString() which returns the localized display string.
But you gave me the idea of feeding the ComboBox a collection of keys. That should work