]> source.dussan.org Git - vaadin-framework.git/commitdiff
#8089 Don't fire TextChangeEvent inside TextChangeEvent
authorLeif Åstrand <leif@vaadin.com>
Fri, 9 Dec 2011 13:38:41 +0000 (13:38 +0000)
committerLeif Åstrand <leif@vaadin.com>
Fri, 9 Dec 2011 13:38:41 +0000 (13:38 +0000)
svn changeset:22361/svn branch:6.7

src/com/vaadin/ui/AbstractTextField.java

index 3bfeabd33f739360cf5a200ef58620fc261ed38f..346d370bd5804704f1d9953860e1c8965f68f8eb 100644 (file)
@@ -70,6 +70,8 @@ public abstract class AbstractTextField extends AbstractField implements
      */
     private boolean textChangeEventPending;
 
+    private boolean isFiringTextChangeEvent = false;
+
     private TextChangeEventMode textChangeEventMode = TextChangeEventMode.LAZY;
 
     private final int DEFAULT_TEXTCHANGE_TIMEOUT = 400;
@@ -449,9 +451,14 @@ public abstract class AbstractTextField extends AbstractField implements
     /* ** Text Change Events ** */
 
     private void firePendingTextChangeEvent() {
-        if (textChangeEventPending) {
+        if (textChangeEventPending && !isFiringTextChangeEvent) {
+            isFiringTextChangeEvent = true;
             textChangeEventPending = false;
-            fireEvent(new TextChangeEventImpl(this));
+            try {
+                fireEvent(new TextChangeEventImpl(this));
+            } finally {
+                isFiringTextChangeEvent = false;
+            }
         }
     }
 
@@ -494,11 +501,6 @@ public abstract class AbstractTextField extends AbstractField implements
             firePendingTextChangeEvent();
         }
 
-        /*
-         * Reset lastKnownTextContent field on value change. We know the value
-         * now.
-         */
-        lastKnownTextContent = null;
         super.setInternalValue(newValue);
     }