]> source.dussan.org Git - vaadin-framework.git/commitdiff
reverted #6588 fix, causes rather bad regressions
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 6 Oct 2011 20:49:48 +0000 (20:49 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 6 Oct 2011 20:49:48 +0000 (20:49 +0000)
svn changeset:21621/svn branch:6.7

src/com/vaadin/terminal/gwt/client/ui/VTextField.java
src/com/vaadin/ui/AbstractTextField.java

index a1ae13249f0c5c150f23376e172cd3204a24f243..8bc655f39f1467b07a4e1ee170f048001ad178f2 100644 (file)
@@ -64,7 +64,6 @@ public class VTextField extends TextBoxBase implements Paintable, Field,
     private static final String CLASSNAME_PROMPT = "prompt";
     private static final String ATTR_INPUTPROMPT = "prompt";
     public static final String ATTR_TEXTCHANGE_TIMEOUT = "iet";
-    public static final String ATTR_TEXT_CHANGED = "textChanged";
     public static final String VAR_CURSOR = "c";
     public static final String ATTR_TEXTCHANGE_EVENTMODE = "iem";
     private static final String TEXTCHANGE_MODE_EAGER = "EAGER";
@@ -202,9 +201,6 @@ public class VTextField extends TextBoxBase implements Paintable, Field,
     }
 
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
-        // Required to always check text value sent from server when initalizing
-        // even if server did not send ATTR_TEXT_CHANGED
-        boolean firstPaint = (this.client == null);
         this.client = client;
         id = uidl.getId();
 
@@ -248,17 +244,8 @@ public class VTextField extends TextBoxBase implements Paintable, Field,
             setColumns(new Integer(uidl.getStringAttribute("cols")).intValue());
         }
 
-        final String text;
-        if (uidl.hasVariable("text")
-                && (firstPaint || (uidl.hasAttribute(ATTR_TEXT_CHANGED) && uidl
-                        .getBooleanAttribute(ATTR_TEXT_CHANGED)))) {
-            // Use value from UIDL if this is the first time the component is
-            // painted or if something has changed on the server
-            text = uidl.getStringVariable("text");
-        } else {
-            // Use what we already have if no change from the server
-            text = prompting ? null : getText();
-        }
+        final String text = uidl.hasVariable("text") ? uidl
+                .getStringVariable("text") : null;
         setPrompting(inputPrompt != null && focusedTextField != this
                 && (text == null || text.equals("")));
 
index e31efb85c2f5d4c2a4319b5df9ebb4e9b4401af2..4ed76d367bdf8a3573d3e3cb42edde37a23a42f4 100644 (file)
@@ -92,12 +92,6 @@ public abstract class AbstractTextField extends AbstractField implements
      */
     private boolean changingVariables;
 
-    /**
-     * Track whether the value on the server has actually changed to avoid
-     * updating the text in the input element on every repaint
-     */
-    private boolean localValueChanged = true;
-
     protected AbstractTextField() {
         super();
     }
@@ -129,11 +123,6 @@ public abstract class AbstractTextField extends AbstractField implements
             throw new IllegalStateException(
                     "Null values are not allowed if the null-representation is null");
         }
-
-        if (localValueChanged) {
-            target.addAttribute(VTextField.ATTR_TEXT_CHANGED, true);
-            localValueChanged = false;
-        }
         target.addVariable(this, "text", value);
 
         if (selectionPosition != -1) {
@@ -224,8 +213,7 @@ public abstract class AbstractTextField extends AbstractField implements
                 if (newValue != oldValue
                         && (newValue == null || !newValue.equals(oldValue))) {
                     boolean wasModified = isModified();
-                    // Don't update the local change flag
-                    super.setValue(newValue, true);
+                    setValue(newValue, true);
 
                     // If the modified status changes, or if we have a
                     // formatter, repaint is needed after all.
@@ -249,26 +237,6 @@ public abstract class AbstractTextField extends AbstractField implements
 
     }
 
-    @Override
-    protected void setValue(Object newValue, boolean repaintIsNotNeeded)
-            throws ReadOnlyException, ConversionException {
-        if (notEqual(newValue, getValue())
-                || notEqual(newValue, lastKnownTextContent)) {
-            // The client should use the new value
-            localValueChanged = true;
-            if (!repaintIsNotNeeded) {
-                // Repaint even if super.setValue doesn't detect any change
-                requestRepaint();
-            }
-        }
-        super.setValue(newValue, repaintIsNotNeeded);
-    }
-
-    private static boolean notEqual(Object newValue, Object oldValue) {
-        return oldValue != newValue
-                && (newValue == null || !newValue.equals(oldValue));
-    }
-
     @Override
     public Class getType() {
         return String.class;