I am trying to migrate from Vaadin 7.7.7 to 8.0.5 and I experience difficulties converting ComboBoxes.
Before 8, I was able to get combobox items via getItemIds or via getContainerDataSource.
Now I noticed that data comes from a data provider and I don’t know the proper way to ask for items.
In fact, I want to check how many items are there in the combobox.
Next question : how to use effectively the new Registration for listeners?
I cannot find documentation about this feature.
Do I need to keep a reference to all my Registrations to remove them when I want?
Check your DataProvider - getting the amount of items depends on the implementation. The interface itself provides a size() method, but you’ll need to provide a Query to account for filtering, which might be overkill if you just want to know how many items your basic non-filtered in-memory provider has. For example a ListDataProvider has a getItems() method, which you can use to get the Collection of the items and ask for the size of that.
Regarding Registrations, yes, you’ll need to keep a track of those yourself if you might want to remove the listener later. There are still the deprecated remove*Listener methods which do work ok, but note that you can’t use those with lambda expressions.