tlaukkan/vaadin-lazyquerycontainer — pull request #59 by michael-simons (2013-11-29 10:24:00+00:00)
Title: Improvements to make lazyquerycontainer suitable for combo boxes in combination with large result sets

Hi Tommi.

I am using your lazyquerycontainer with a custom JPA filter implementation for Vaadins Comboboxes. My own criteria based filtering works very well but in some cases we have really big unfiltered results.

When lazyquerycontainer is used with Vaadins Combobox, a moderate page size and more than some 1000 results, it doesn't work quite well as the Combobox requests the index and the LazyIdList needs to linear search all results for an index leading to querying all objects (not lazy anymore for nothing) and many, many queries.

My request has to components:

1. Introduce an ItemIdListFactory that produces id lists. Passing this to LazyQueryView keeps its immutable structure but providing an entry point for customization. The original functionality is now in DefaultItemIdListFactory, same as before. All tests are green.

2. Introduce a SmartItemIdListFactory which produces SmartLazyIdList. With the requirement of the idPropertyIds being comparable to each other and the assumption that they are in ascending order a binary search for an index can be used which makes the container suitable for ComboBox with more than (tested) 100.000 entries.

What do you think? The fork is based on tag 2.1.0. I've added a custom version for the time being.

I really hope this makes into your upstream and that you'll release a new version in the near future.

Again, thank you for your work and letting me participate.

Michael