Revision: 7551
Author: gwt.mirror...@gmail.com
Date: Wed Feb 10 06:13:42 2010
Log: Change RichTextAreaImpl and subclasses to not be coupled to Widget/RichTextArea:
http://gwt-code-reviews.appspot.com/139801

Patch by: sven.brunken
Review by: jlabanca

http://code.google.com/p/google-web-toolkit/source/detail?r=7551

Modified:
 /trunk/user/src/com/google/gwt/user/client/ui/RichTextArea.java
 /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImpl.java
 /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java
/trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplSafari.java /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/RichTextArea.java Thu Feb 4 04:42:51 2010 +++ /trunk/user/src/com/google/gwt/user/client/ui/RichTextArea.java Wed Feb 10 06:13:42 2010
@@ -579,7 +579,7 @@
   public RichTextArea() {
     setElement(impl.getElement());
     setStyleName("gwt-RichTextArea");
-    impl.setWidget(this);
+    impl.setOwner(this);
   }

public HandlerRegistration addInitializeHandler(InitializeHandler handler) {
=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImpl.java Thu Feb 4 04:42:51 2010 +++ /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImpl.java Wed Feb 10 06:13:42 2010
@@ -15,6 +15,7 @@
  */
 package com.google.gwt.user.client.ui.impl;

+import com.google.gwt.event.logical.shared.HasInitializeHandlers;
 import com.google.gwt.event.logical.shared.InitializeEvent;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
@@ -32,7 +33,7 @@
 public class RichTextAreaImpl {

   protected Element elem;
-  protected RichTextArea richTextWidget;
+  protected HasInitializeHandlers owner;

   public RichTextAreaImpl() {
     elem = createElement();
@@ -73,13 +74,22 @@
   public void setHTML(String html) {
     DOM.setElementProperty(elem, "value", html);
   }
+
+  public void setOwner(HasInitializeHandlers owner) {
+    this.owner = owner;
+  }

   public void setText(String text) {
     DOM.setElementProperty(elem, "value", text);
   }

+  /**
+ * @deprecated as of GWT 2.1, use {...@link #setOwner(HasInitializeHandlers)}
+   *             instead
+   */
+  @Deprecated
   public void setWidget(RichTextArea richTextWidget) {
-    this.richTextWidget = richTextWidget;
+    setOwner(richTextWidget);
   }

   public void uninitElement() {
@@ -96,8 +106,8 @@

   protected void onElementInitialized() {
     hookEvents();
-    if (richTextWidget != null) {
-      InitializeEvent.fire(richTextWidget);
+    if (owner != null) {
+      InitializeEvent.fire(owner);
     }
   }
 }
=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java Thu Feb 4 04:42:51 2010 +++ /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java Wed Feb 10 06:13:42 2010
@@ -93,10 +93,12 @@

     var handler = $entry(function() {
       if (elem.__listener) {
- // Weird: this code has the context of the script frame, but we need the
-        // event from the edit iframe's window.
-        var evt = elem.contentWindow.event;
- elem.__listen...@com.google.gwt.user.client.ui.widget::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt); + if (@com.google.gwt.user.client.impl.DOMImpl::isMyListener(Ljava/lang/Object;)(elem.__listener)) { + // Weird: this code has the context of the script frame, but we need the
+          // event from the edit iframe's window.
+          var evt = elem.contentWindow.event;
+ elem.__listen...@com.google.gwt.user.client.eventlistener::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt);
+        }
       }
     });

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplSafari.java Thu Jul 16 17:54:03 2009 +++ /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplSafari.java Wed Feb 10 06:13:42 2010
@@ -39,7 +39,9 @@

     elem.__gwt_handler = function(evt) {
       if (elem.__listener) {
- elem.__listen...@com.google.gwt.user.client.ui.widget::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt); + if (@com.google.gwt.user.client.impl.DOMImpl::isMyListener(Ljava/lang/Object;)(elem.__listener)) { + elem.__listen...@com.google.gwt.user.client.eventlistener::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt);
+        }
       }
     };

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java Thu Feb 4 04:42:51 2010 +++ /trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java Wed Feb 10 06:13:42 2010
@@ -306,7 +306,9 @@

     elem.__gwt_handler = $entry(function(evt) {
       if (elem.__listener) {
- elem.__listen...@com.google.gwt.user.client.ui.widget::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt); + if (@com.google.gwt.user.client.impl.DOMImpl::isMyListener(Ljava/lang/Object;)(elem.__listener)) { + elem.__listen...@com.google.gwt.user.client.eventlistener::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt);
+        }
       }
     });

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to