Selects and collections

The Select Components all have this constructor:

new Select(String caption, Collection options);

Is there a way to change this collection later on? Say my collection changes at some point, and I want to update the options the select gives, can I say somehow select.setCollection(myCollection);? I could not find a method like this in the JavaDoc.

Is there a better way to change the options?

I looked at the constructor for abstractSelect(captions, options), and found that it does this:


        final Container c = new IndexedContainer();
        if (options != null) {
            for (final Iterator i = options.iterator(); i.hasNext();) {
                c.addItem(i.next());
            }
        }
        setContainerDataSource(c);

couldn’t this be made into a separate method, so that you can update the container based on a collection later on?

Yeah, that’s a good point. Actually we’ve been talking about adding better ‘support’ for plain java collections, in addition to the current container api.
At the moment there are only a few helpers, like the Select constructor, and the ‘official recommendation’ is to use containers.

At this point, I’d recommend making an external helper method, that does essentially the same that the Select constructor does.

Best Regards,
Marc