]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixed some bugs, filtering now works somehow
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 31 Oct 2007 09:13:48 +0000 (09:13 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 31 Oct 2007 09:13:48 +0000 (09:13 +0000)
svn changeset:2631/svn branch:trunk

src/com/itmill/toolkit/ui/Select.java

index e56666f3ad284074338a725f196c785618b1af38..bf31d9c3ad7277ce0feb1f8aa2b9a40f72ef4a6c 100644 (file)
@@ -234,22 +234,25 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
                        this.filteredOptions = new LinkedList(getItemIds());
                        return this.filteredOptions;
                }
+
                if (this.filterstring.equals(this.prevfilterstring)) {
                        return this.filteredOptions;
                }
 
                Collection items;
-               if (this.filterstring.startsWith(this.prevfilterstring)) {
-                       items = this.filteredOptions;
+               if (prevfilterstring != null
+                               && filterstring.startsWith(this.prevfilterstring)) {
+                       items = filteredOptions;
                } else {
                        items = getItemIds();
                }
+               prevfilterstring = filterstring;
 
                this.filteredOptions = new LinkedList();
                for (Iterator it = items.iterator(); it.hasNext();) {
                        Object itemId = it.next();
-                       String caption = getItemCaption(it);
-                       if (caption != null || caption.equals("")) {
+                       String caption = getItemCaption(itemId);
+                       if (caption == null || caption.equals("")) {
                                continue;
                        }
                        switch (this.filteringMode) {