aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2010-11-26 12:40:29 +0000
committerArtur Signell <artur.signell@itmill.com>2010-11-26 12:40:29 +0000
commitbc9b965b62815a7bf8e923a032e2766fd9d3d009 (patch)
tree26674058086f219b3f7761655a36f2abb89bcd3e
parent31b448aa337bdd3b7817bcef887f6f12e3c62768 (diff)
downloadvaadin-framework-bc9b965b62815a7bf8e923a032e2766fd9d3d009.tar.gz
vaadin-framework-bc9b965b62815a7bf8e923a032e2766fd9d3d009.zip
#6003 - Word wrap doesn't work in TextArea
svn changeset:16192/svn branch:6.5
-rw-r--r--src/com/vaadin/terminal/gwt/client/Util.java30
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTextField.java5
2 files changed, 34 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java
index ee7fd112aa..0f38d126c0 100644
--- a/src/com/vaadin/terminal/gwt/client/Util.java
+++ b/src/com/vaadin/terminal/gwt/client/Util.java
@@ -13,6 +13,7 @@ import java.util.Set;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
@@ -905,4 +906,33 @@ public class Util {
}
}
+ /**
+ * Detaches and re-attaches the element from its parent. The element is
+ * reattached at the same position in the DOM as it was before.
+ *
+ * Does nothing if the element is not attached to the DOM.
+ *
+ * @param element
+ * The element to detach and re-attach
+ */
+ public static void detachAttach(Element element) {
+ if (element == null) {
+ return;
+ }
+
+ Node nextSibling = element.getNextSibling();
+ Node parent = element.getParentNode();
+ if (parent == null) {
+ return;
+ }
+
+ parent.removeChild(element);
+ if (nextSibling == null) {
+ parent.appendChild(element);
+ } else {
+ parent.insertBefore(element, nextSibling);
+ }
+
+ }
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java
index 959155af23..d84e1fb156 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java
@@ -5,7 +5,6 @@
package com.vaadin.terminal.gwt.client.ui;
import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
@@ -567,6 +566,10 @@ public class VTextField extends TextBoxBase implements Paintable, Field,
if (BrowserInfo.get().isSafari4()) {
// Force redraw as Safari 4 does not properly update the screen
Util.forceWebkitRedraw(getElement());
+ } else if (BrowserInfo.get().isOpera()) {
+ // Opera fails to dynamically update the wrap attribute so we detach
+ // and reattach the whole TextArea.
+ Util.detachAttach(getElement());
}
wordwrap = enabled;
}