Get BeanContainer by index

Why doesn’t the bean container contain away to get the bean item in the container by the index?

The BeanContainer does implement the Container.Indexed interface so you should be able to do the following:


Yes you can do it that way, but why should it have to be so complicated. Second, if I understand the documentation correctly, that might not return an entry if that entry has been filtered out. It just seems to me that there should be a way to easily cycle through the list of beans in the container, and retrieve them even if they have been filtered out.


yes, you’re right, this (and all other operations too) operate on the currently visible (filtered) set of items. You can subclass the container to achieve what you want. Just create a method that takes in an int index, then call the getAllItemIds(), fetch the item ID at the index you need and call getUnfilteredItem(Object itemId) with the result and return that.

I agree it is quite complicated at the moment, but unfortunately there’s just no better API available right now. If you feel this would be a good enhancement for the API, please file a ticket at our trac system. I remembere there was a ticket about this but could not find it.


I think I will do that. I am new to your system, and could not find a link to your trac system. Can you point me to where that is?
Thank you

Thank you.