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: jgw@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8598 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/Widget.java b/user/src/com/google/gwt/user/client/ui/Widget.java
index 1cce9af..3a48ace 100644
--- a/user/src/com/google/gwt/user/client/ui/Widget.java
+++ b/user/src/com/google/gwt/user/client/ui/Widget.java
@@ -47,6 +47,37 @@
   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) {
       handlerManager.fireEvent(event);
@@ -168,37 +199,6 @@
   }
 
   /**
-   * 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
    * this method to create a custom {@link HandlerManager}.
    *