]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #2441
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 12 Jan 2009 09:24:05 +0000 (09:24 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 12 Jan 2009 09:24:05 +0000 (09:24 +0000)
svn changeset:6499/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/IFilterSelect.java

index 2644077e9f78c7494be66de483e77588c168bd32..a3e8af4a379ee37e52609bd043f052feec7d0e93 100644 (file)
@@ -434,7 +434,12 @@ public class IFilterSelect extends Composite implements Paintable, Field,
             }
             if (allowNewItem) {
 
-                if (!enteredItemValue.equals(emptyText)) {
+                if (!enteredItemValue.equals(emptyText)
+                        && !enteredItemValue.equals(lastNewItemString)) {
+                    /*
+                     * Store last sent new item string to avoid double sends
+                     */
+                    lastNewItemString = enteredItemValue;
                     client.updateVariable(paintableId, "newitem",
                             enteredItemValue, immediate);
                 }
@@ -520,6 +525,11 @@ public class IFilterSelect extends Composite implements Paintable, Field,
     private int suggestionPopupMinWidth = 0;
     private static final String CLASSNAME_EMPTY = "empty";
     private static final String ATTR_EMPTYTEXT = "emptytext";
+    /*
+     * Stores the last new item string to avoid double submissions. Cleared on
+     * uidl updates
+     */
+    private String lastNewItemString;
 
     public IFilterSelect() {
         selectedItemIcon.setVisible(false);
@@ -612,6 +622,7 @@ public class IFilterSelect extends Composite implements Paintable, Field,
         suggestionPopup.updateStyleNames(uidl);
 
         allowNewItem = uidl.hasAttribute("allownewitem");
+        lastNewItemString = null;
 
         currentSuggestions.clear();
         final UIDL options = uidl.getChildUIDL(0);