I can't detect anything wrong with your implementation on first sight. Is it 
possible that you can reproduce the described behavior in a Quickstart?

  -Tom


On 01.12.2012, at 03:09, Madasamy mcruncher <madas...@mcruncher.com> wrote:

> FooProvider implementation is
> 
>    public class FooProvider extends TextChoiceProvider<Foo>
>    {
> 
>       FooService fooService=new FooService();
>       @Override
>        protected String getDisplayText(Foo fooChoice) {
>            return fooChoice.getName();
>        }
> 
>        @Override
>        protected Object getId(Foo fooChoice) {
>            return fooChoice.getName;
>        }
> 
>        @Override
>        public void query(String term, int page, Response<Foo> response) {
>            response.addAll(queryMatches(term, page, 10));
>            response.setHasMore(response.size() == 10);
> 
>        }
> 
>        @Override
>        public Collection<Foo> toChoices(Collection<String> ids) {
>            ArrayList<Foo> foos = new ArrayList<Foo>();
>            for (String id : ids) {
>                foos.add(fooService.findFooByName(id));
>            }
>            return foos;
>        }
>    }
> 
> private List<Foo> queryMatches(String term, int page, int pageSize) {
> 
>        List<Foo> result = new ArrayList<Foo>();
>        term = term.toUpperCase();
>        final int offset = page * pageSize;
>        int matched = 0;
>        for ( Foo foo : getAllFoos()) {
>            if (result.size() == pageSize) {
>                break;
>            }
> 
>            if (foo.getName().toUpperCase().contains(term)) {
>                matched++;
>                if (matched > offset) {
>                    result.add(foo);
>                }
>            }
>        }
>        return result;
>    }
> 
>    public List<Foo> getAllFoos()
>    {
>        //return all foos
>        return fooService.findAll();
>    }


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to