]> source.dussan.org Git - vaadin-framework.git/commitdiff
Optimization for word wrap. For #6003.
authorMarko Grönroos <magi@iki.fi>
Fri, 19 Nov 2010 13:24:15 +0000 (13:24 +0000)
committerMarko Grönroos <magi@iki.fi>
Fri, 19 Nov 2010 13:24:15 +0000 (13:24 +0000)
svn changeset:16053/svn branch:6.5

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

index c0eb4a90ee7d73962ae2b9d661a272ab4e2d3477..42264fc1b639651df4477d3396ed11248859ab76 100644 (file)
@@ -282,9 +282,14 @@ public class VTextField extends TextBoxBase implements Paintable, Field,
             });
         }
 
-        // For backward compatibility; to be moved to TextArea
-        if (uidl.hasAttribute("wordwrap")) {
-            setWordwrap(uidl.getBooleanAttribute("wordwrap"));
+        // Here for backward compatibility; to be moved to TextArea.
+        // Optimization: server does not send attribute for the default 'true'
+        // state.
+        if (uidl.hasAttribute("wordwrap")
+                && uidl.getBooleanAttribute("wordwrap") == false) {
+            setWordwrap(false);
+        } else {
+            setWordwrap(true);
         }
     }
 
@@ -544,7 +549,7 @@ public class VTextField extends TextBoxBase implements Paintable, Field,
         valueChange(false);
     }
 
-    // For backward compatibility; to be moved to TextArea
+    // Here for backward compatibility; to be moved to TextArea
     public void setWordwrap(boolean enabled) {
         if (enabled == wordwrap)
             return; // No change
index f9dd93b6f92c26d062aec7d7d2c2dfa7274c22f8..64dbf933b2d261c1cc5f8080a0fe4e112a0bb1e4 100644 (file)
@@ -199,8 +199,10 @@ public class TextField extends AbstractTextField implements
             target.addAttribute("rows", String.valueOf(rows));
             target.addAttribute("multiline", true);
 
-            // For backward compatibility; to be moved to TextArea
-            target.addAttribute("wordwrap", isWordwrap());
+            // Optimization: the default true is assumed if not painted
+            if (!isWordwrap()) {
+                target.addAttribute("wordwrap", false);
+            }
         }
 
         if (getInputPrompt() != null) {