Revision: 8598
Author: [email protected]
Date: Fri Aug 20 05:23:44 2010
Log: Makes Widget.addDomHandler public, so that helpers can add keyboard handlers to panels without creating new widgets or DOM elements.

Review at http://gwt-code-reviews.appspot.com/779802

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8598

Modified:
 /trunk/user/src/com/google/gwt/user/client/ui/Widget.java

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/Widget.java Fri Mar 19 08:12:41 2010 +++ /trunk/user/src/com/google/gwt/user/client/ui/Widget.java Fri Aug 20 05:23:44 2010
@@ -46,6 +46,37 @@
   private HandlerManager handlerManager;
   private Object layoutData;
   private Widget parent;
+
+  /**
+   * Adds a native event handler to the widget and sinks the corresponding
+ * native event. If you do not want to sink the native event, use the generic
+   * addHandler method instead.
+   *
+   * @param <H> the type of handler to add
+   * @param type the event key
+   * @param handler the handler
+   * @return {...@link HandlerRegistration} used to remove the handler
+   */
+  public final <H extends EventHandler> HandlerRegistration addDomHandler(
+      final H handler, DomEvent.Type<H> type) {
+    assert handler != null : "handler must not be null";
+    assert type != null : "type must not be null";
+    sinkEvents(Event.getTypeInt(type.getName()));
+    return ensureHandlers().addHandler(type, handler);
+  }
+
+  /**
+   * Adds this handler to the widget.
+   *
+   * @param <H> the type of handler to add
+   * @param type the event type
+   * @param handler the handler
+   * @return {...@link HandlerRegistration} used to remove the handler
+   */
+  public final <H extends EventHandler> HandlerRegistration addHandler(
+      final H handler, GwtEvent.Type<H> type) {
+    return ensureHandlers().addHandler(type, handler);
+  }

   public void fireEvent(GwtEvent<?> event) {
     if (handlerManager != null) {
@@ -166,37 +197,6 @@
       eventsToSink |= eventBitsToAdd;
     }
   }
-
-  /**
-   * Adds a native event handler to the widget and sinks the corresponding
- * native event. If you do not want to sink the native event, use the generic
-   * addHandler method instead.
-   *
-   * @param <H> the type of handler to add
-   * @param type the event key
-   * @param handler the handler
-   * @return {...@link HandlerRegistration} used to remove the handler
-   */
- protected final <H extends EventHandler> HandlerRegistration addDomHandler(
-      final H handler, DomEvent.Type<H> type) {
-    assert handler != null : "handler must not be null";
-    assert type != null : "type must not be null";
-    sinkEvents(Event.getTypeInt(type.getName()));
-    return ensureHandlers().addHandler(type, handler);
-  }
-
-  /**
-   * Adds this handler to the widget.
-   *
-   * @param <H> the type of handler to add
-   * @param type the event type
-   * @param handler the handler
-   * @return {...@link HandlerRegistration} used to remove the handler
-   */
-  protected final <H extends EventHandler> HandlerRegistration addHandler(
-      final H handler, GwtEvent.Type<H> type) {
-    return ensureHandlers().addHandler(type, handler);
-  }

   /**
* Creates the {...@link HandlerManager} used by this Widget. You can overwrite

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

Reply via email to