Search Combobox implementation

Hi, all. first, sorry for my bad english…:frowning: Here’s my question

I’d like some advice on my implementation of a combobox ldap search. In short, whenever the user types a character, I’m looking for information in our ldap and populate the combobox accordingly. I can not get all the information at once because there are too many entries. My code works but can it be better???

public class SearchComboBox extends Select {

    private MemberDao memberDao;
    private BUnit bunit;

    public SearchComboBox(BUnit bunit) {
        Assert.notNull(bunit, "Business Unit cannot be null");

        this.bunit = bunit;
        memberDao = AccessManagerApplication.get().getMemberDao();

        // -- Using MemberFilter instead

    public void changeVariables(Object source, Map<String, Object> variables) {
        String filterString = (String) variables.get("filter");

        if (filterString != null)
            filterString = StringUtils.strip(filterString);

        if (filterString != null && filterString.length() > 2) {

            List<Member> members = memberDao.retrieveAllByName(filterString, null, bunit);

            BeanItemContainer<Member> c = new BeanItemContainer<Member>(Member.class);
            Filterable f = (Filterable) c;
            f.addContainerFilter(new MemberFilter(getItemCaptionPropertyId(), filterString));

        } else {
            // -- Be sure that the selected key is not here because it fires the change event
            if (!variables.containsKey("selected")) {

        super.changeVariables(source, variables);

Any advices would be appreciated.
Thank you!

Seems fine to me (both your english and your code :slight_smile: ).

If you do it this way, one recommendation: add the items to the container and filter it before setting it as a data source for the combo box.
That way, you avoid extraneous update events. This can improve the performance especially if the container will be large, and in your case it only involves moving one line of code three lines down.

Thanks for the advice and your time