I’m currently doing a test on vaadin. I’m courious that to implement the converter but still no Idea on how to doit. I have a simple object that contain list on one of its fields. Then now I’m going to put it on field group. I want to convert the list into combobox. Please any idea on this ?
ComboBox is not the correct component to display a Collection , it is to display a single seletion from many. Use ListBox, TwinColSelect or Table to display multiselect values ( ie collections ). You could use the
https://vaadin.com/directory#addon/tokenfield:vaadin addon if you are restricted in space.
And I think you should still convert between a List and a Set ( the components.getValue() will return a Set in most of them if I’m not mistaken )
Thanks for the advice, Yeah perhaps that solution can be usefull. But I’m still courious on how do we do implementing “converter” for collection (List, Map and Etc) so that Vaadin may understand between the presentation and model. I have been googling but the result are just some simple working sample which convertion between Date and Jodatime, String to Interger and so on.
Here is a collection converter from JPAContainer. If using a single select component, see
this class instead. You probably cannot use them as-is but can write your own converter based on the example.
I have the recollection there are other, more generic examples around, but cannot recall now where to find them. In general, it is not necessary for the converter to know the select component as long as it has some way of mapping between IDs and values, so these can often be simplified.
Vaadin does not support a convertion from an OptionGroup with MultiSelect to a Collection,
wich is pretty much the same scenario, so for sure this is not supported.