Add the beginnings of new HTML5 drag and drop events
Review at http://gwt-code-reviews.appspot.com/1398802
Review by: pdr@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9944 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/event/dom/client/DragEnterClickHandler.java b/user/src/com/google/gwt/event/dom/client/DragEnterClickHandler.java
new file mode 100644
index 0000000..6fe1219
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DragEnterClickHandler.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link DragEnterEvent} events.
+ */
+public interface DragEnterClickHandler extends EventHandler {
+
+ /**
+ * Called when a {@link DragEnterEvent} is fired.
+ *
+ * @param event the {@link DragEnterEvent} that was fired
+ */
+ void onDoubleClick(DragEnterEvent event);
+}
\ No newline at end of file
diff --git a/user/src/com/google/gwt/event/dom/client/DragEnterEvent.java b/user/src/com/google/gwt/event/dom/client/DragEnterEvent.java
new file mode 100644
index 0000000..8171f8e
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DragEnterEvent.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+/**
+ * Represents a native drag enter event.
+ */
+public class DragEnterEvent extends DomEvent<DragEnterHandler> {
+
+ /**
+ * Event type for drag enter events. Represents the meta-data associated
+ * with this event.
+ */
+ private static final Type<DragEnterHandler> TYPE = new Type<DragEnterHandler>(
+ "dragenter", new DragEnterEvent());
+
+ /**
+ * Gets the event type associated with drag enter events.
+ *
+ * @return the handler type
+ */
+ public static Type<DragEnterHandler> getType() {
+ return TYPE;
+ }
+
+ /**
+ * Protected constructor, use
+ * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+ * to fire drag enter events.
+ */
+ protected DragEnterEvent() {
+ }
+
+ @Override
+ public final Type<DragEnterHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(DragEnterHandler handler) {
+ handler.onDragEnter(this);
+ }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/DragEnterHandler.java b/user/src/com/google/gwt/event/dom/client/DragEnterHandler.java
new file mode 100644
index 0000000..a5de3c2
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DragEnterHandler.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link DragEnterEvent} events.
+ */
+public interface DragEnterHandler extends EventHandler {
+
+ /**
+ * Called when a {@link DragEnterEvent} is fired.
+ *
+ * @param event the {@link DragEnterEvent} that was fired
+ */
+ void onDragEnter(DragEnterEvent event);
+}
\ No newline at end of file
diff --git a/user/src/com/google/gwt/event/dom/client/DragExitEvent.java b/user/src/com/google/gwt/event/dom/client/DragExitEvent.java
new file mode 100644
index 0000000..6f68f3f
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DragExitEvent.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+/**
+ * Represents a native drag Exit event.
+ */
+public class DragExitEvent extends DomEvent<DragExitHandler> {
+
+ /**
+ * Event type for drag exit events. Represents the meta-data associated
+ * with this event.
+ */
+ private static final Type<DragExitHandler> TYPE = new Type<DragExitHandler>(
+ "dragexit", new DragExitEvent());
+
+ /**
+ * Gets the event type associated with drag exit events.
+ *
+ * @return the handler type
+ */
+ public static Type<DragExitHandler> getType() {
+ return TYPE;
+ }
+
+ /**
+ * Protected constructor, use
+ * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent,
+ * com.google.gwt.event.shared.HasHandlers)}
+ * to fire drag exit events.
+ */
+ protected DragExitEvent() {
+ }
+
+ @Override
+ public final Type<DragExitHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(DragExitHandler handler) {
+ handler.onDragExit(this);
+ }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/DragExitHandler.java b/user/src/com/google/gwt/event/dom/client/DragExitHandler.java
new file mode 100644
index 0000000..8f0cb31
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DragExitHandler.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link DragExitEvent} events.
+ */
+public interface DragExitHandler extends EventHandler {
+
+ /**
+ * Called when a {@link DragExitEvent} is fired.
+ *
+ * @param event the {@link DragExitEvent} that was fired
+ */
+ void onDragExit(DragExitEvent event);
+}
\ No newline at end of file
diff --git a/user/src/com/google/gwt/event/dom/client/DragOverEvent.java b/user/src/com/google/gwt/event/dom/client/DragOverEvent.java
new file mode 100644
index 0000000..9154808
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DragOverEvent.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+/**
+ * Represents a native drag over event.
+ */
+public class DragOverEvent extends DomEvent<DragOverHandler> {
+
+ /**
+ * Event type for drag over events. Represents the meta-data associated
+ * with this event.
+ */
+ private static final Type<DragOverHandler> TYPE = new Type<DragOverHandler>(
+ "dragover", new DragOverEvent());
+
+ /**
+ * Gets the event type associated with drag over events.
+ *
+ * @return the handler type
+ */
+ public static Type<DragOverHandler> getType() {
+ return TYPE;
+ }
+
+ /**
+ * Protected constructor, use
+ * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+ * to fire drag over events.
+ */
+ protected DragOverEvent() {
+ }
+
+ @Override
+ public final Type<DragOverHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(DragOverHandler handler) {
+ handler.onDragOver(this);
+ }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/DragOverHandler.java b/user/src/com/google/gwt/event/dom/client/DragOverHandler.java
new file mode 100644
index 0000000..da8ac58
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DragOverHandler.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link DragOverEvent} events.
+ */
+public interface DragOverHandler extends EventHandler {
+
+ /**
+ * Called when a {@link DragOverEvent} is fired.
+ *
+ * @param event the {@link DragOverEvent} that was fired
+ */
+ void onDragOver(DragOverEvent event);
+}
\ No newline at end of file
diff --git a/user/src/com/google/gwt/event/dom/client/DropEvent.java b/user/src/com/google/gwt/event/dom/client/DropEvent.java
new file mode 100644
index 0000000..6c2a17c
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DropEvent.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+/**
+ * Represents a native drop event.
+ */
+public class DropEvent extends DomEvent<DropHandler> {
+
+ /**
+ * Event type for drop events. Represents the meta-data associated
+ * with this event.
+ */
+ private static final Type<DropHandler> TYPE = new Type<DropHandler>(
+ "drop", new DropEvent());
+
+ /**
+ * Gets the event type associated with drop events.
+ *
+ * @return the handler type
+ */
+ public static Type<DropHandler> getType() {
+ return TYPE;
+ }
+
+ /**
+ * Protected constructor, use
+ * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+ * to fire drop events.
+ */
+ protected DropEvent() {
+ }
+
+ @Override
+ public final Type<DropHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(DropHandler handler) {
+ handler.onDrop(this);
+ }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/DropHandler.java b/user/src/com/google/gwt/event/dom/client/DropHandler.java
new file mode 100644
index 0000000..4634568
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/DropHandler.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link DropEvent} events.
+ */
+public interface DropHandler extends EventHandler {
+
+ /**
+ * Called when a {@link DropEvent} is fired.
+ *
+ * @param event the {@link DropEvent} that was fired
+ */
+ void onDrop(DropEvent event);
+}
\ No newline at end of file
diff --git a/user/src/com/google/gwt/event/dom/client/HasAllDragAndDropHandlers.java b/user/src/com/google/gwt/event/dom/client/HasAllDragAndDropHandlers.java
new file mode 100644
index 0000000..b16a7d3
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/HasAllDragAndDropHandlers.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.gwt.event.dom.client;
+
+/**
+ * This is a convenience interface that includes all drag and drop handlers
+ * defined by the core GWT system.
+ *
+ * <p>
+ * <span style="color:red">Experimental API: This API is still under development
+ * and is subject to change.
+ * </span>
+ * </p>
+ */
+public interface HasAllDragAndDropHandlers extends HasDragEnterHandlers,
+ HasDragExitHandlers, HasDragOverHandlers, HasDropHandlers {
+}
\ No newline at end of file
diff --git a/user/src/com/google/gwt/event/dom/client/HasDragEnterHandlers.java b/user/src/com/google/gwt/event/dom/client/HasDragEnterHandlers.java
new file mode 100644
index 0000000..936ed52
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/HasDragEnterHandlers.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link DragEnterHandler} instances.
+ *
+ * <p>
+ * <span style="color:red">Experimental API: This API is still under development
+ * and is subject to change.
+ * </span>
+ * </p>
+ */
+public interface HasDragEnterHandlers extends HasHandlers {
+ /**
+ * Adds a {@link DragEnterEvent} handler.
+ *
+ * @param handler the drag end handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addDragEnterHandler(DragEnterHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasDragExitHandlers.java b/user/src/com/google/gwt/event/dom/client/HasDragExitHandlers.java
new file mode 100644
index 0000000..734552d
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/HasDragExitHandlers.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link DragExitHandler} instances.
+ *
+ * <p>
+ * <span style="color:red">Experimental API: This API is still under development
+ * and is subject to change.
+ * </span>
+ * </p>
+ */
+public interface HasDragExitHandlers extends HasHandlers {
+ /**
+ * Adds a {@link DragExitEvent} handler.
+ *
+ * @param handler the drag exit handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addDragExitHandler(DragExitHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasDragOverHandlers.java b/user/src/com/google/gwt/event/dom/client/HasDragOverHandlers.java
new file mode 100644
index 0000000..88b8bff
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/HasDragOverHandlers.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link DragOverHandler} instances.
+ *
+ * <p>
+ * <span style="color:red">Experimental API: This API is still under development
+ * and is subject to change.
+ * </span>
+ * </p>
+ */
+public interface HasDragOverHandlers extends HasHandlers {
+ /**
+ * Adds a {@link DragOverEvent} handler.
+ *
+ * @param handler the drag over handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addDragOverHandler(DragOverHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasDropHandlers.java b/user/src/com/google/gwt/event/dom/client/HasDropHandlers.java
new file mode 100644
index 0000000..53a7091
--- /dev/null
+++ b/user/src/com/google/gwt/event/dom/client/HasDropHandlers.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link DropHandler} instances.
+ *
+ * <p>
+ * <span style="color:red">Experimental API: This API is still under development
+ * and is subject to change.
+ * </span>
+ * </p>
+ */
+public interface HasDropHandlers extends HasHandlers {
+ /**
+ * Adds a {@link DropEvent} handler.
+ *
+ * @param handler the drop handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addDropHandler(DropHandler handler);
+}
diff --git a/user/src/com/google/gwt/user/client/ui/FocusPanel.java b/user/src/com/google/gwt/user/client/ui/FocusPanel.java
index a793fd6..8d8e359 100644
--- a/user/src/com/google/gwt/user/client/ui/FocusPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/FocusPanel.java
@@ -21,6 +21,14 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.event.dom.client.DragEnterEvent;
+import com.google.gwt.event.dom.client.DragEnterHandler;
+import com.google.gwt.event.dom.client.DragExitEvent;
+import com.google.gwt.event.dom.client.DragExitHandler;
+import com.google.gwt.event.dom.client.DragOverEvent;
+import com.google.gwt.event.dom.client.DragOverHandler;
+import com.google.gwt.event.dom.client.DropEvent;
+import com.google.gwt.event.dom.client.DropHandler;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.GestureChangeEvent;
@@ -29,6 +37,7 @@
import com.google.gwt.event.dom.client.GestureEndHandler;
import com.google.gwt.event.dom.client.GestureStartEvent;
import com.google.gwt.event.dom.client.GestureStartHandler;
+import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers;
import com.google.gwt.event.dom.client.HasAllFocusHandlers;
import com.google.gwt.event.dom.client.HasAllGestureHandlers;
import com.google.gwt.event.dom.client.HasAllKeyHandlers;
@@ -72,8 +81,9 @@
@SuppressWarnings("deprecation")
public class FocusPanel extends SimplePanel implements HasFocus,
SourcesClickEvents, SourcesMouseEvents, SourcesMouseWheelEvents,
- HasAllMouseHandlers, HasClickHandlers, HasDoubleClickHandlers,
- HasAllKeyHandlers, HasAllFocusHandlers, HasAllGestureHandlers, HasAllTouchHandlers {
+ HasAllDragAndDropHandlers, HasAllMouseHandlers, HasClickHandlers,
+ HasDoubleClickHandlers, HasAllKeyHandlers, HasAllFocusHandlers,
+ HasAllGestureHandlers, HasAllTouchHandlers {
static final FocusImpl impl = FocusImpl.getFocusImplForPanel();
@@ -106,6 +116,22 @@
return addDomHandler(handler, DoubleClickEvent.getType());
}
+ public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
+ return addBitlessDomHandler(handler, DragEnterEvent.getType());
+ }
+
+ public HandlerRegistration addDragExitHandler(DragExitHandler handler) {
+ return addBitlessDomHandler(handler, DragExitEvent.getType());
+ }
+
+ public HandlerRegistration addDragOverHandler(DragOverHandler handler) {
+ return addBitlessDomHandler(handler, DragOverEvent.getType());
+ }
+
+ public HandlerRegistration addDropHandler(DropHandler handler) {
+ return addBitlessDomHandler(handler, DropEvent.getType());
+ }
+
public HandlerRegistration addFocusHandler(FocusHandler handler) {
return addDomHandler(handler, FocusEvent.getType());
}
diff --git a/user/src/com/google/gwt/user/client/ui/FocusWidget.java b/user/src/com/google/gwt/user/client/ui/FocusWidget.java
index e3cde65..b2a8b69 100644
--- a/user/src/com/google/gwt/user/client/ui/FocusWidget.java
+++ b/user/src/com/google/gwt/user/client/ui/FocusWidget.java
@@ -22,6 +22,14 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.event.dom.client.DragEnterEvent;
+import com.google.gwt.event.dom.client.DragEnterHandler;
+import com.google.gwt.event.dom.client.DragExitEvent;
+import com.google.gwt.event.dom.client.DragExitHandler;
+import com.google.gwt.event.dom.client.DragOverEvent;
+import com.google.gwt.event.dom.client.DragOverHandler;
+import com.google.gwt.event.dom.client.DropEvent;
+import com.google.gwt.event.dom.client.DropHandler;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.GestureChangeEvent;
@@ -30,6 +38,7 @@
import com.google.gwt.event.dom.client.GestureEndHandler;
import com.google.gwt.event.dom.client.GestureStartEvent;
import com.google.gwt.event.dom.client.GestureStartHandler;
+import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers;
import com.google.gwt.event.dom.client.HasAllFocusHandlers;
import com.google.gwt.event.dom.client.HasAllGestureHandlers;
import com.google.gwt.event.dom.client.HasAllKeyHandlers;
@@ -73,8 +82,9 @@
@SuppressWarnings("deprecation")
public abstract class FocusWidget extends Widget implements SourcesClickEvents,
HasClickHandlers, HasDoubleClickHandlers, HasFocus, HasEnabled,
- HasAllFocusHandlers, HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers,
- HasAllTouchHandlers, SourcesMouseEvents {
+ HasAllDragAndDropHandlers, HasAllFocusHandlers, HasAllGestureHandlers,
+ HasAllKeyHandlers, HasAllMouseHandlers, HasAllTouchHandlers,
+ SourcesMouseEvents {
private static final FocusImpl impl = FocusImpl.getFocusImplForWidget();
@@ -123,6 +133,22 @@
return addDomHandler(handler, DoubleClickEvent.getType());
}
+ public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
+ return addBitlessDomHandler(handler, DragEnterEvent.getType());
+ }
+
+ public HandlerRegistration addDragExitHandler(DragExitHandler handler) {
+ return addBitlessDomHandler(handler, DragExitEvent.getType());
+ }
+
+ public HandlerRegistration addDragOverHandler(DragOverHandler handler) {
+ return addBitlessDomHandler(handler, DragOverEvent.getType());
+ }
+
+ public HandlerRegistration addDropHandler(DropHandler handler) {
+ return addBitlessDomHandler(handler, DropEvent.getType());
+ }
+
public HandlerRegistration addFocusHandler(FocusHandler handler) {
return addDomHandler(handler, FocusEvent.getType());
}
diff --git a/user/src/com/google/gwt/user/client/ui/HTMLTable.java b/user/src/com/google/gwt/user/client/ui/HTMLTable.java
index 6a0d499..18fdaf5 100644
--- a/user/src/com/google/gwt/user/client/ui/HTMLTable.java
+++ b/user/src/com/google/gwt/user/client/ui/HTMLTable.java
@@ -22,6 +22,15 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.event.dom.client.DragEnterEvent;
+import com.google.gwt.event.dom.client.DragEnterHandler;
+import com.google.gwt.event.dom.client.DragExitEvent;
+import com.google.gwt.event.dom.client.DragExitHandler;
+import com.google.gwt.event.dom.client.DragOverEvent;
+import com.google.gwt.event.dom.client.DragOverHandler;
+import com.google.gwt.event.dom.client.DropEvent;
+import com.google.gwt.event.dom.client.DropHandler;
+import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.HasDoubleClickHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
@@ -47,7 +56,7 @@
*/
@SuppressWarnings("deprecation")
public abstract class HTMLTable extends Panel implements SourcesTableEvents,
- HasClickHandlers, HasDoubleClickHandlers {
+ HasAllDragAndDropHandlers, HasClickHandlers, HasDoubleClickHandlers {
/**
* Return value for {@link HTMLTable#getCellForEvent}.
@@ -729,6 +738,22 @@
return addDomHandler(handler, DoubleClickEvent.getType());
}
+ public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
+ return addBitlessDomHandler(handler, DragEnterEvent.getType());
+ }
+
+ public HandlerRegistration addDragExitHandler(DragExitHandler handler) {
+ return addBitlessDomHandler(handler, DragExitEvent.getType());
+ }
+
+ public HandlerRegistration addDragOverHandler(DragOverHandler handler) {
+ return addBitlessDomHandler(handler, DragOverEvent.getType());
+ }
+
+ public HandlerRegistration addDropHandler(DropHandler handler) {
+ return addBitlessDomHandler(handler, DropEvent.getType());
+ }
+
/**
* Adds a listener to the current table.
*
diff --git a/user/src/com/google/gwt/user/client/ui/Image.java b/user/src/com/google/gwt/user/client/ui/Image.java
index 2c074d8..6e711b3 100644
--- a/user/src/com/google/gwt/user/client/ui/Image.java
+++ b/user/src/com/google/gwt/user/client/ui/Image.java
@@ -24,6 +24,14 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.event.dom.client.DragEnterEvent;
+import com.google.gwt.event.dom.client.DragEnterHandler;
+import com.google.gwt.event.dom.client.DragExitEvent;
+import com.google.gwt.event.dom.client.DragExitHandler;
+import com.google.gwt.event.dom.client.DragOverEvent;
+import com.google.gwt.event.dom.client.DragOverHandler;
+import com.google.gwt.event.dom.client.DropEvent;
+import com.google.gwt.event.dom.client.DropHandler;
import com.google.gwt.event.dom.client.ErrorEvent;
import com.google.gwt.event.dom.client.ErrorHandler;
import com.google.gwt.event.dom.client.GestureChangeEvent;
@@ -32,6 +40,7 @@
import com.google.gwt.event.dom.client.GestureEndHandler;
import com.google.gwt.event.dom.client.GestureStartEvent;
import com.google.gwt.event.dom.client.GestureStartHandler;
+import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers;
import com.google.gwt.event.dom.client.HasAllGestureHandlers;
import com.google.gwt.event.dom.client.HasAllMouseHandlers;
import com.google.gwt.event.dom.client.HasAllTouchHandlers;
@@ -110,8 +119,8 @@
@SuppressWarnings("deprecation")
public class Image extends Widget implements SourcesLoadEvents, HasLoadHandlers,
HasErrorHandlers, SourcesClickEvents, HasClickHandlers,
- HasDoubleClickHandlers, HasAllGestureHandlers, HasAllMouseHandlers, HasAllTouchHandlers,
- SourcesMouseEvents {
+ HasDoubleClickHandlers, HasAllDragAndDropHandlers, HasAllGestureHandlers,
+ HasAllMouseHandlers, HasAllTouchHandlers, SourcesMouseEvents {
/**
* The attribute that is set when an image fires a native load or error event
@@ -499,6 +508,22 @@
return addHandler(handler, DoubleClickEvent.getType());
}
+ public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
+ return addBitlessDomHandler(handler, DragEnterEvent.getType());
+ }
+
+ public HandlerRegistration addDragExitHandler(DragExitHandler handler) {
+ return addBitlessDomHandler(handler, DragExitEvent.getType());
+ }
+
+ public HandlerRegistration addDragOverHandler(DragOverHandler handler) {
+ return addBitlessDomHandler(handler, DragOverEvent.getType());
+ }
+
+ public HandlerRegistration addDropHandler(DropHandler handler) {
+ return addBitlessDomHandler(handler, DropEvent.getType());
+ }
+
public HandlerRegistration addErrorHandler(ErrorHandler handler) {
return addHandler(handler, ErrorEvent.getType());
}
diff --git a/user/src/com/google/gwt/user/client/ui/Label.java b/user/src/com/google/gwt/user/client/ui/Label.java
index 29bb577..c824be1 100644
--- a/user/src/com/google/gwt/user/client/ui/Label.java
+++ b/user/src/com/google/gwt/user/client/ui/Label.java
@@ -24,12 +24,21 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.event.dom.client.DragEnterEvent;
+import com.google.gwt.event.dom.client.DragEnterHandler;
+import com.google.gwt.event.dom.client.DragExitEvent;
+import com.google.gwt.event.dom.client.DragExitHandler;
+import com.google.gwt.event.dom.client.DragOverEvent;
+import com.google.gwt.event.dom.client.DragOverHandler;
+import com.google.gwt.event.dom.client.DropEvent;
+import com.google.gwt.event.dom.client.DropHandler;
import com.google.gwt.event.dom.client.GestureChangeEvent;
import com.google.gwt.event.dom.client.GestureChangeHandler;
import com.google.gwt.event.dom.client.GestureEndEvent;
import com.google.gwt.event.dom.client.GestureEndHandler;
import com.google.gwt.event.dom.client.GestureStartEvent;
import com.google.gwt.event.dom.client.GestureStartHandler;
+import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers;
import com.google.gwt.event.dom.client.HasAllGestureHandlers;
import com.google.gwt.event.dom.client.HasAllMouseHandlers;
import com.google.gwt.event.dom.client.HasAllTouchHandlers;
@@ -87,8 +96,9 @@
@SuppressWarnings("deprecation")
public class Label extends LabelBase<String> implements HasDirectionalText,
HasDirection, HasClickHandlers, HasDoubleClickHandlers, SourcesClickEvents,
- SourcesMouseEvents, HasAllGestureHandlers, HasAllMouseHandlers,
- HasAllTouchHandlers, IsEditor<LeafValueEditor<String>> {
+ SourcesMouseEvents, HasAllDragAndDropHandlers, HasAllGestureHandlers,
+ HasAllMouseHandlers, HasAllTouchHandlers,
+ IsEditor<LeafValueEditor<String>> {
public static final DirectionEstimator DEFAULT_DIRECTION_ESTIMATOR =
DirectionalTextHelper.DEFAULT_DIRECTION_ESTIMATOR;
@@ -199,6 +209,22 @@
return addDomHandler(handler, DoubleClickEvent.getType());
}
+ public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
+ return addBitlessDomHandler(handler, DragEnterEvent.getType());
+ }
+
+ public HandlerRegistration addDragExitHandler(DragExitHandler handler) {
+ return addBitlessDomHandler(handler, DragExitEvent.getType());
+ }
+
+ public HandlerRegistration addDragOverHandler(DragOverHandler handler) {
+ return addBitlessDomHandler(handler, DragOverEvent.getType());
+ }
+
+ public HandlerRegistration addDropHandler(DropHandler handler) {
+ return addBitlessDomHandler(handler, DropEvent.getType());
+ }
+
public HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler) {
return addDomHandler(handler, GestureChangeEvent.getType());
}
diff --git a/user/test/com/google/gwt/user/UISuite.java b/user/test/com/google/gwt/user/UISuite.java
index bb342be..5ab2004 100644
--- a/user/test/com/google/gwt/user/UISuite.java
+++ b/user/test/com/google/gwt/user/UISuite.java
@@ -21,6 +21,7 @@
import com.google.gwt.user.client.CommandExecutorTest;
import com.google.gwt.user.client.CookieTest;
import com.google.gwt.user.client.DoubleClickEventSinkTest;
+import com.google.gwt.user.client.DragAndDropEventsSinkTest;
import com.google.gwt.user.client.EventTest;
import com.google.gwt.user.client.GestureEventSinkTest;
import com.google.gwt.user.client.HistoryDisabledTest;
@@ -163,6 +164,7 @@
suite.addTestSuite(DoubleClickEventSinkTest.class);
suite.addTestSuite(DOMTest.class);
suite.addTestSuite(DOMRtlTest.class);
+ suite.addTestSuite(DragAndDropEventsSinkTest.class);
suite.addTestSuite(ElementWrappingTest.class);
suite.addTestSuite(EventTest.class);
suite.addTestSuite(FastStringMapTest.class);
diff --git a/user/test/com/google/gwt/user/client/DragAndDropEventsSinkTest.java b/user/test/com/google/gwt/user/client/DragAndDropEventsSinkTest.java
new file mode 100644
index 0000000..4e9fa10
--- /dev/null
+++ b/user/test/com/google/gwt/user/client/DragAndDropEventsSinkTest.java
@@ -0,0 +1,258 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.gwt.user.client;
+
+import com.google.gwt.event.dom.client.DragEnterEvent;
+import com.google.gwt.event.dom.client.DragEnterHandler;
+import com.google.gwt.event.dom.client.DragExitEvent;
+import com.google.gwt.event.dom.client.DragExitHandler;
+import com.google.gwt.event.dom.client.DragOverEvent;
+import com.google.gwt.event.dom.client.DragOverHandler;
+import com.google.gwt.event.dom.client.DropEvent;
+import com.google.gwt.event.dom.client.DropHandler;
+import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers;
+import com.google.gwt.junit.client.GWTTestCase;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FocusPanel;
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.PasswordTextBox;
+import com.google.gwt.user.client.ui.RichTextArea;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.SimpleRadioButton;
+import com.google.gwt.user.client.ui.TextArea;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.ToggleButton;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Test Case for sinking of drag and drop events.
+ */
+public class DragAndDropEventsSinkTest extends GWTTestCase {
+
+ private static class DragEnterHandlerImpl extends HandlerImpl implements
+ DragEnterHandler {
+ public void onDragEnter(DragEnterEvent event) {
+ eventFired();
+ }
+ }
+
+ private static class DragExitHandlerImpl extends HandlerImpl implements
+ DragExitHandler {
+ public void onDragExit(DragExitEvent event) {
+ eventFired();
+ }
+ }
+
+ private static class DragOverHandlerImpl extends HandlerImpl implements
+ DragOverHandler {
+ public void onDragOver(DragOverEvent event) {
+ eventFired();
+ }
+ }
+
+ private static class DropHandlerImpl extends HandlerImpl implements
+ DropHandler {
+ public void onDrop(DropEvent event) {
+ eventFired();
+ }
+ }
+
+ private static class HandlerImpl {
+ private boolean fired = false;
+
+ public void eventFired() {
+ fired = true;
+ }
+
+ boolean hasEventFired() {
+ return fired;
+ }
+ }
+
+ public static native boolean isEventSupported(String eventName) /*-{
+ var div = $doc.createElement("div");
+ return ("on" + eventName) in div;
+ }-*/;
+
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.user.User";
+ }
+
+ public void testFocusPanelEventSink() {
+ // skip tests on browsers that do not support native drag events
+ if (!isEventSupported("dragstart")) {
+ return;
+ }
+
+ verifyDragEnterEventSink(new FocusPanel());
+ verifyDragExitEventSink(new FocusPanel());
+ verifyDragOverEventSink(new FocusPanel());
+ verifyDropEventSink(new FocusPanel());
+ }
+
+ public void testFocusWidgetEventSink() {
+ // skip tests on browsers that do not support native drag events
+ if (!isEventSupported("dragstart")) {
+ return;
+ }
+
+ verifyDragEnterEventSink(new Anchor());
+ verifyDragExitEventSink(new Anchor());
+ verifyDragOverEventSink(new Anchor());
+ verifyDropEventSink(new Anchor());
+
+ verifyDragEnterEventSink(new Button());
+ verifyDragExitEventSink(new Button());
+ verifyDragOverEventSink(new Button());
+ verifyDropEventSink(new Button());
+
+ verifyDragEnterEventSink(new CheckBox());
+ verifyDragExitEventSink(new CheckBox());
+ verifyDragOverEventSink(new CheckBox());
+ verifyDropEventSink(new CheckBox());
+
+ verifyDragEnterEventSink(new ToggleButton());
+ verifyDragExitEventSink(new ToggleButton());
+ verifyDragOverEventSink(new ToggleButton());
+ verifyDropEventSink(new ToggleButton());
+
+ verifyDragEnterEventSink(new ListBox());
+ verifyDragExitEventSink(new ListBox());
+ verifyDragOverEventSink(new ListBox());
+ verifyDropEventSink(new ListBox());
+
+ verifyDragEnterEventSink(new RichTextArea());
+ verifyDragExitEventSink(new RichTextArea());
+ verifyDragOverEventSink(new RichTextArea());
+ verifyDropEventSink(new RichTextArea());
+
+ verifyDragEnterEventSink(new TextArea());
+ verifyDragExitEventSink(new TextArea());
+ verifyDragOverEventSink(new TextArea());
+ verifyDropEventSink(new TextArea());
+
+ verifyDragEnterEventSink(new PasswordTextBox());
+ verifyDragExitEventSink(new PasswordTextBox());
+ verifyDragOverEventSink(new PasswordTextBox());
+ verifyDropEventSink(new PasswordTextBox());
+
+ verifyDragEnterEventSink(new TextBox());
+ verifyDragExitEventSink(new TextBox());
+ verifyDragOverEventSink(new TextBox());
+ verifyDropEventSink(new TextBox());
+
+ verifyDragEnterEventSink(new SimpleRadioButton("foo"));
+ verifyDragExitEventSink(new SimpleRadioButton("foo"));
+ verifyDragOverEventSink(new SimpleRadioButton("foo"));
+ verifyDropEventSink(new SimpleRadioButton("foo"));
+ }
+
+ public void testHTMLTableEventSink() {
+ // skip tests on browsers that do not support native drag events
+ if (!isEventSupported("dragstart")) {
+ return;
+ }
+
+ verifyDragEnterEventSink(new Grid());
+ verifyDragExitEventSink(new Grid());
+ verifyDragOverEventSink(new Grid());
+ verifyDropEventSink(new Grid());
+
+ verifyDragEnterEventSink(new FlexTable());
+ verifyDragExitEventSink(new FlexTable());
+ verifyDragOverEventSink(new FlexTable());
+ verifyDropEventSink(new FlexTable());
+ }
+
+ public void testImageEventSink() {
+ // skip tests on browsers that do not support native drag events
+ if (!isEventSupported("dragstart")) {
+ return;
+ }
+
+ verifyDragEnterEventSink(new Image());
+ verifyDragExitEventSink(new Image());
+ verifyDragOverEventSink(new Image());
+ verifyDropEventSink(new Image());
+ }
+
+ public void testLabelEventSink() {
+ // skip tests on browsers that do not support native drag events
+ if (!isEventSupported("dragstart")) {
+ return;
+ }
+
+ verifyDragEnterEventSink(new Label());
+ verifyDragExitEventSink(new Label());
+ verifyDragOverEventSink(new Label());
+ verifyDropEventSink(new Label());
+ }
+
+ @Override
+ protected void gwtTearDown() throws Exception {
+ // clean up after ourselves
+ RootPanel.get().clear();
+ super.gwtTearDown();
+ }
+
+ private <W extends Widget & HasAllDragAndDropHandlers> void verifyDragEnterEventSink(W w) {
+ DragEnterHandlerImpl handler = new DragEnterHandlerImpl();
+ w.addDragEnterHandler(handler);
+
+ assertFalse(handler.hasEventFired());
+ w.fireEvent(new DragEnterEvent() {
+ });
+ assertTrue(handler.hasEventFired());
+ }
+
+ private <W extends Widget & HasAllDragAndDropHandlers> void verifyDragExitEventSink(W w) {
+ DragExitHandlerImpl handler = new DragExitHandlerImpl();
+ w.addDragExitHandler(handler);
+
+ assertFalse(handler.hasEventFired());
+ w.fireEvent(new DragExitEvent() {
+ });
+ assertTrue(handler.hasEventFired());
+ }
+
+ private <W extends Widget & HasAllDragAndDropHandlers> void verifyDragOverEventSink(W w) {
+ DragOverHandlerImpl handler = new DragOverHandlerImpl();
+ w.addDragOverHandler(handler);
+
+ assertFalse(handler.hasEventFired());
+ w.fireEvent(new DragOverEvent() {
+ });
+ assertTrue(handler.hasEventFired());
+ }
+
+ private <W extends Widget & HasAllDragAndDropHandlers> void verifyDropEventSink(W w) {
+ DropHandlerImpl handler = new DropHandlerImpl();
+ w.addDropHandler(handler);
+
+ assertFalse(handler.hasEventFired());
+ w.fireEvent(new DropEvent() {
+ });
+ assertTrue(handler.hasEventFired());
+ }
+}
\ No newline at end of file