[google-web-toolkit commit] r3782 - in releases/1.6/events: eclipse/samples/Hello eclipse/user/.settings user/src/com/google/...

0 views
Skip to first unread message

codesite...@google.com

unread,
Oct 18, 2008, 6:37:27 PM10/18/08
to gwt...@gmail.com
Author: e...@google.com
Date: Sat Oct 18 15:33:44 2008
New Revision: 3782

Added:
releases/1.6/events/eclipse/user/.settings/

releases/1.6/events/eclipse/user/.settings/org.eclipse.core.resources.prefs
releases/1.6/events/user/src/com/google/gwt/event/
releases/1.6/events/user/src/com/google/gwt/event/Event.gwt.xml
releases/1.6/events/user/src/com/google/gwt/event/dom/
releases/1.6/events/user/src/com/google/gwt/event/dom/client/

releases/1.6/events/user/src/com/google/gwt/event/dom/client/BlurEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/BlurHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/ChangeEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/ChangeHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/ClickEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/ClickHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/DomEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/DoubleClickHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/ErrorEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/ErrorHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/FocusEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/FocusHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllKeyHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasBlurHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasChangeHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasClickHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasDoubleClickHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasErrorHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasFocusHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyCodes.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyDownHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyPressHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyUpHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasLoadHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasLoseCaptureHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseDownHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseMoveHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseOutHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseOverHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseUpHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseWheelHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasScrollHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyDownHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyPressHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyUpHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoadEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoadHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoseCaptureHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseDownHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseMoveHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOutHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOverHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseUpHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseWheelHandler.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/RawJsStringMapImpl.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/ScrollEvent.java

releases/1.6/events/user/src/com/google/gwt/event/dom/client/ScrollHandler.java
releases/1.6/events/user/src/com/google/gwt/event/logical/
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/BeforeShowEvent.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/BeforeShowHandler.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasBeforeShowHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasHideHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasHighlightHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasSelectionHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasShowRangeHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasUnhighlightHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasWrongFormatHandlers.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HideEvent.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HideHandler.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HighlightHandler.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/SelectionHandler.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ShowRangeHandler.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/UnhighlightEvent.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/UnhighlightHandler.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ValueEvent.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/WrongFormatEvent.java

releases/1.6/events/user/src/com/google/gwt/event/logical/shared/WrongFormatHandler.java
releases/1.6/events/user/src/com/google/gwt/event/shared/

releases/1.6/events/user/src/com/google/gwt/event/shared/AbstractEvent.java

releases/1.6/events/user/src/com/google/gwt/event/shared/EventHandler.java

releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerAdaptor.java

releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerManager.java

releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerRegistration.java

releases/1.6/events/user/src/com/google/gwt/event/shared/HasHandlerManager.java

releases/1.6/events/user/src/com/google/gwt/event/shared/JavaHandlerRegistry.java

releases/1.6/events/user/src/com/google/gwt/event/shared/JsHandlerRegistry.java
releases/1.6/events/user/src/com/google/gwt/user/client/ui/L.java

releases/1.6/events/user/src/com/google/gwt/user/client/ui/MousableWidget.java
Modified:
releases/1.6/events/eclipse/samples/Hello/ (props changed)

Log:
Committing new files to event branch (note, L class will be renamed, L is a
placeholder name)

Added:
releases/1.6/events/eclipse/user/.settings/org.eclipse.core.resources.prefs
==============================================================================
--- (empty file)
+++
releases/1.6/events/eclipse/user/.settings/org.eclipse.core.resources.prefs
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,3 @@
+#Thu Oct 16 10:50:42 EDT 2008
+eclipse.preferences.version=1
+encoding//core/src/com/google/gwt/i18n/client/DateTimeFormat.java=UTF-8

Added: releases/1.6/events/user/src/com/google/gwt/event/Event.gwt.xml
==============================================================================
--- (empty file)
+++ releases/1.6/events/user/src/com/google/gwt/event/Event.gwt.xml Sat Oct
18 15:33:44 2008
@@ -0,0 +1,7 @@
+<module>
+ <!-- This module could be broken down into much finer detail -->
+ <source path="shared"/>
+ <source path="virtual/shared"/>
+ <source path="logical/shared"/>
+ <source path="dom/client"/>
+</module>
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/BlurEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/BlurEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native blur event.
+ */
+public class BlurEvent extends DomEvent {
+
+ /**
+ Event type for blur events. Represents the meta-data associated with
this event.
+ */
+ public static final Type<BlurEvent, BlurHandler> TYPE = new
Type<BlurEvent,BlurHandler>(
+ Event.ONBLUR) {
+ @Override
+ public void fire(BlurHandler handler, BlurEvent event) {
+ handler.onBlur(event);
+ }
+
+ @Override
+ BlurEvent wrap(Event nativeEvent) {
+ return new BlurEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public BlurEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/BlurHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/BlurHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 BlurEvent} events.
+ */
+public interface BlurHandler extends EventHandler {
+
+ /**
+ * Called when BlurEvent is fired.
+ *
+ * @param event the {@link BlurEvent} that was fired
+ */
+ void onBlur(BlurEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ChangeEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ChangeEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native change event.
+ */
+public class ChangeEvent extends DomEvent {
+
+ /**
+ Event type for change events. Represents the meta-data associated with
this event.
+ */
+ public static final Type<ChangeEvent, ChangeHandler> TYPE = new
Type<ChangeEvent,ChangeHandler>(
+ Event.ONCHANGE) {
+ @Override
+ public void fire(ChangeHandler handler, ChangeEvent event) {
+ handler.onChange(event);
+ }
+
+ @Override
+ ChangeEvent wrap(Event nativeEvent) {
+ return new ChangeEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public ChangeEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ChangeHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ChangeHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 for {@link ChangeEvent} events.
+ */
+public interface ChangeHandler extends EventHandler {
+
+ /**
+ * Called when a change event is fired.
+ *
+ * @param event the {@link ChangeEvent} that was fired
+ */
+ void onChange(ChangeEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ClickEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ClickEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native click event.
+ */
+public class ClickEvent extends DomEvent {
+
+ /**
+ Event type for click events. Represents the meta-data associated with
this event.
+ */
+ public static final Type<ClickEvent, ClickHandler> TYPE = new
Type<ClickEvent,ClickHandler>(
+ Event.ONCLICK) {
+ @Override
+ public void fire(ClickHandler handler, ClickEvent event) {
+ handler.onClick(event);
+ }
+
+ @Override
+ ClickEvent wrap(Event nativeEvent) {
+ return new ClickEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public ClickEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ClickHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ClickHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 for {@link ClickEvent} events.
+ */
+public interface ClickHandler extends EventHandler {
+ /**
+ * Called when a native click event is fired.
+ *
+ * @param event the {@link ClickEvent} that was fired
+ */
+ void onClick(ClickEvent event);
+
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/DomEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/DomEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2008 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.AbstractEvent;
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.user.client.Event;
+
+/**
+ * {@link DomEvent} is a subclass of AbstractEvent that provides events
that map
+ * to DOM Level 2 Events. It provides an additional method to access the
+ * underlying native browser event object as well as a subclass of
+ * AbstractEvent.Key that understands GWT event bits used by sinkEvents().
+ *
+ */
+public abstract class DomEvent extends AbstractEvent {
+
+ /**
+ * Type class used by dom event subclasses.
+ *
+ * @param <EventType> event type
+ * @param <HandlerType> handler type
+ */
+ public abstract static class Type<EventType extends DomEvent,
HandlerType extends EventHandler>
+ extends AbstractEvent.Type<EventType, HandlerType> {
+ private int nativeEventTypeInt;
+ DomEvent cached;
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEventType the native event type
+ */
+ public Type(int nativeEventType) {
+ // All clinit activity should take place here for DomEvent.
+ if (registered == null) {
+ registered = new RawJsStringMapImpl();
+ }
+ this.nativeEventTypeInt = nativeEventType;
+ registered.put(getType(nativeEventType), this);
+ }
+
+ /**
+ * Gets the native {@link Event} type integer corresponding to the
native
+ * event.
+ *
+ * @return the native event type
+ */
+ public int getNativeEventTypeInt() {
+ return nativeEventTypeInt;
+ }
+
+ /**
+ * Wraps the native event.
+ *
+ * @param nativeEvent the native event
+ * @return the wrapped native event
+ */
+ abstract EventType wrap(Event nativeEvent);
+ }
+
+ private static RawJsStringMapImpl<Type> registered;
+
+ /**
+ * Fires the given native event on the manager with a null underlying
native
+ * event.
+ *
+ * <p>
+ * This method is used in the rare case that GWT widgets have to fire
native
+ * events but do not have access to the corresponding native event. It
allows
+ * the compiler to avoid instantiating event types that are never
handlers.
+ * </p>
+ *
+ * @param eventType the GWT event type representing the type of the
native
+ * event.
+ * @param manager the event manager
+ */
+ public static void fireNativeEvent(int eventType, HandlerManager
manager) {
+ if (registered != null) {
+ DomEvent.Type typeKey = registered.get(getType(eventType));
+ if (typeKey != null && manager.isEventHandled(typeKey)) {
+ if (typeKey.cached == null || typeKey.cached.isLive()) {
+ typeKey.cached = typeKey.wrap(null);
+ } else {
+ typeKey.cached.reset(null);
+ }
+ manager.fireEvent(typeKey.cached);
+ }
+ }
+ }
+
+ /**
+ * Fires the given native event on the manager.
+ *
+ * @param nativeEvent the native event
+ * @param manager the event manager
+ */
+ public static void fireNativeEvent(Event nativeEvent, HandlerManager
manager) {
+ if (registered != null) {
+ DomEvent.Type typeKey = registered.get(nativeEvent.getType());
+ if (typeKey != null && manager.isEventHandled(typeKey)) {
+ if (typeKey.cached == null || typeKey.cached.isLive()) {
+ typeKey.cached = typeKey.wrap(nativeEvent);
+ } else {
+ typeKey.cached.reset(nativeEvent);
+ }
+ manager.fireEvent(typeKey.cached);
+ }
+ }
+ }
+
+ private static String getType(int type) {
+ switch (type) {
+ case 0x01000:
+ return "blur";
+ case 0x00400:
+ return "change";
+ case 0x00001:
+ return "click";
+ case 0x00002:
+ return "dblclick";
+ case 0x00800:
+ return "focus";
+ case 0x00080:
+ return "keydown";
+ case 0x00100:
+ return "keypress";
+ case 0x00200:
+ return "keyup";
+ case 0x08000:
+ return "load";
+ case 0x02000:
+ return "losecapture";
+ case 0x00004:
+ return "mousedown";
+ case 0x00040:
+ return "mousemove";
+ case 0x00020:
+ return "mouseout";
+ case 0x00010:
+ return "mouseover";
+ case 0x00008:
+ return "mouseup";
+ case 0x04000:
+ return "scroll";
+ case 0x10000:
+ return "error";
+ case 0x20000:
+ return "mousewheel";
+ case 0x40000:
+ return "contextmenu";
+ default:
+ return null;
+ }
+ }
+
+ private Event nativeEvent;
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event
+ */
+ protected DomEvent(Event nativeEvent) {
+ this.nativeEvent = nativeEvent;
+ }
+
+ /**
+ * Gets the underlying native event for this {@link DomEvent}.
+ *
+ * @return gets the native event
+ */
+ public final Event getNativeEvent() {
+ assertLive();
+ return nativeEvent;
+ }
+
+ /**
+ * Prevents the wrapped native event's default action.
+ */
+ public void preventDefault() {
+ assertLive();
+ nativeEvent.preventDefault();
+ }
+
+ /**
+ * Stops the propagation of the underlying native event.
+ */
+ public void stopPropagation() {
+ assertLive();
+ nativeEvent.cancelBubble(true);
+ }
+
+ @Override
+ public String toString() {
+ return getType(getType().getNativeEventTypeInt()) + " event";
+ }
+
+ @Override
+ protected abstract DomEvent.Type getType();
+
+ void reset(Event event) {
+ super.revive();
+ nativeEvent = event;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native double click event.
+ */
+public class DoubleClickEvent extends DomEvent {
+
+ /**
+ Event type for double click events. Represents the meta-data
associated with this event.
+ */
+ public static final Type<DoubleClickEvent, DoubleClickHandler> TYPE =
new Type<DoubleClickEvent,DoubleClickHandler>(
+ Event.ONDBLCLICK) {
+ @Override
+ public void fire(DoubleClickHandler handler, DoubleClickEvent event) {
+ handler.onDoubleClick(event);
+ }
+
+ @Override
+ DoubleClickEvent wrap(Event nativeEvent) {
+ return new DoubleClickEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public DoubleClickEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/DoubleClickHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/DoubleClickHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 DoubleClickEvent} events.
+ */
+public interface DoubleClickHandler extends EventHandler {
+
+ /**
+ * Called when a {@link DoubleClickEvent} is fired.
+ *
+ * @param event the {@link DoubleClickEvent} that was fired
+ */
+ void onDoubleClick(DoubleClickEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ErrorEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ErrorEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native error event.
+ */
+public class ErrorEvent extends DomEvent {
+
+ /**
+ Event type for error events. Represents the meta-data associated with
this event.
+ */
+ public static final Type<ErrorEvent, ErrorHandler> TYPE = new
Type<ErrorEvent,ErrorHandler>(
+ Event.ONERROR) {
+ @Override
+ public void fire(ErrorHandler handler, ErrorEvent event) {
+ handler.onError(event);
+ }
+
+ @Override
+ ErrorEvent wrap(Event nativeEvent) {
+ return new ErrorEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public ErrorEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ErrorHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ErrorHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 ErrorEvent} events.
+ */
+public interface ErrorHandler extends EventHandler {
+
+ /**
+ * Called when ErrorEvent is fired.
+ *
+ * @param event the {@link ErrorEvent} that was fired
+ */
+ void onError(ErrorEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/FocusEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/FocusEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native focus event.
+ */
+public class FocusEvent extends DomEvent {
+
+ /**
+ Event type for focus events. Represents the meta-data associated with
this event.
+ */
+ public static final Type<FocusEvent, FocusHandler> TYPE = new
Type<FocusEvent,FocusHandler>(
+ Event.ONFOCUS) {
+ @Override
+ public void fire(FocusHandler handler, FocusEvent event) {
+ handler.onFocus(event);
+ }
+
+ @Override
+ FocusEvent wrap(Event nativeEvent) {
+ return new FocusEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public FocusEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/FocusHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/FocusHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 FocusEvent} events.
+ */
+public interface FocusHandler extends EventHandler {
+
+ /**
+ * Called when FocusEvent is fired.
+ *
+ * @param event the {@link FocusEvent} that was fired
+ */
+ void onFocus(FocusEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 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.HandlerAdaptor;
+import com.google.gwt.event.shared.HasHandlerManager;
+
+/**
+ * This is a convenience interface that includes all focus handlers
defined by
+ * the core GWT system.
+ *
+ * <br/> WARNING, PLEASE READ: As this interface is intended for
developers who
+ * wish to handle all focus events in GWT, in the unlikely event that a new
+ * focus event is added, this interface will change.
+ *
+ */
+public interface HasAllFocusHandlers extends HasFocusHandlers,
HasBlurHandlers {
+ /**
+ * Adaptor used to implement both {@link FocusHandler} and {@link
BlurHandler}
+ * .
+ */
+ public abstract static class Adaptor extends HandlerAdaptor implements
+ FocusHandler, BlurHandler {
+
+ /**
+ * Convenience method to add both focus handlers at once to an event
source.
+ *
+ * @param <EventSourceType> the event source to add the handlers to.
+ * @param <EventHandlerType>
+ * @param source the event source
+ * @param handlers the focus handlers
+ */
+ public static <EventSourceType extends HasHandlerManager &
HasAllFocusHandlers, EventHandlerType extends BlurHandler & FocusHandler>
void addHandlers(
+ EventSourceType source, EventHandlerType handlers) {
+ source.addBlurHandler(handlers);
+ source.addFocusHandler(handlers);
+ }
+
+ /**
+ * Constructor.
+ */
+ public Adaptor() {
+ }
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllKeyHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllKeyHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 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.HandlerAdaptor;
+import com.google.gwt.event.shared.HasHandlerManager;
+
+/**
+ * Convenience interface used to implement all key handlers at once. In the
+ * unlikely event that more key handler subtypes are added to GWT, this
+ * interface will be expanded, so only implement this interface if you
wish to
+ * have your widget break if a new key event type is introduced.
+ *
+ */
+public interface HasAllKeyHandlers extends HasKeyUpHandlers,
+ HasKeyDownHandlers, HasKeyPressHandlers {
+
+ /**
+ * Adaptor used to create and add all the Keyboard events at once.
+ */
+ public abstract static class Adaptor extends HandlerAdaptor implements
+ KeyDownHandler, KeyUpHandler, KeyPressHandler {
+
+ /**
+ * Convenience method to add all key handlers at once.
+ *
+ * @param <EventSourceType> event source type
+ * @param <EventHandler> event handler type
+ * @param source event source
+ * @param handlers handlers to add
+ */
+ public static <EventSourceType extends HasHandlerManager &
HasAllKeyHandlers, EventHandler extends KeyDownHandler & KeyUpHandler &
KeyPressHandler> void addHandlers(
+ EventSourceType source, EventHandler handlers) {
+ source.addKeyDownHandler(handlers);
+ source.addKeyPressHandler(handlers);
+ source.addKeyUpHandler(handlers);
+ }
+
+ /**
+ * Constructor.
+ */
+ public Adaptor() {
+ }
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008 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.HandlerAdaptor;
+import com.google.gwt.event.shared.HasHandlerManager;
+
+/**
+ * This is a convenience interface that includes all mouse handlers
defined by
+ * the core GWT system.
+ *
+ * <br/> WARNING, PLEASE READ: As this interface is intended for
developers who
+ * wish to handle all mouse events in GWT, new mouse event handlers will be
+ * added to it. Therefore, updates can cause breaking API changes.
+ *
+ */
+public interface HasAllMouseHandlers extends HasMouseDownHandlers,
+ HasMouseUpHandlers, HasMouseOutHandlers, HasMouseOverHandlers,
+ HasMouseMoveHandlers, HasMouseWheelHandlers {
+
+ /**
+ * Adaptor used to create and add all the Keyboard events at once.
+ *
+ */
+ public abstract static class Adaptor extends HandlerAdaptor implements
+ HasMouseDownHandlers, HasMouseUpHandlers, HasMouseOutHandlers,
+ HasMouseOverHandlers, HasMouseMoveHandlers, HasMouseWheelHandlers {
+
+ /**
+ * Convenience method to add all key handlers at once.
+ *
+ * @param <EventSourceType> event source type
+ * @param <EventHandler> event handler type
+ * @param source event source
+ * @param handlers handlers to add
+ */
+ public static <EventSourceType extends HasHandlerManager &
HasAllMouseHandlers, EventHandler extends MouseDownHandler & MouseUpHandler
& MouseOutHandler & MouseOverHandler & MouseMoveHandler &
MouseWheelHandler> void addHandlers(
+ EventSourceType source, EventHandler handlers) {
+ source.addMouseDownHandler(handlers);
+ source.addMouseUpHandler(handlers);
+ source.addMouseOutHandler(handlers);
+ source.addMouseOverHandler(handlers);
+ source.addMouseMoveHandler(handlers);
+ source.addMouseWheelHandler(handlers);
+ }
+
+ /**
+ * Creates an adaptor to implement all the {@link HasAllKeyHandlers}
handler
+ * types.
+ */
+ public Adaptor() {
+ }
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasBlurHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasBlurHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link BlurEvent} events.
+ */
+public interface HasBlurHandlers {
+ /**
+ * Adds a {@link BlurEvent} handler.
+ *
+ * @param handler the blur handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addBlurHandler(BlurHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasChangeHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasChangeHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link ChangeEvent} events.
+ */
+public interface HasChangeHandlers {
+ /**
+ * Adds a {@link ChangeEvent} handler.
+ *
+ * @param handler the change handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addChangeHandler(ChangeHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasClickHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasClickHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link ClickEvent} events.
+ */
+public interface HasClickHandlers {
+ /**
+ * Adds a {@link ClickEvent} handler.
+ *
+ * @param handler the click handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addClickHandler(ClickHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasDoubleClickHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasDoubleClickHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link DoubleClickEvent} events.
+ */
+public interface HasDoubleClickHandlers {
+ /**
+ * Adds a {@link DoubleClickEvent} handler.
+ *
+ * @param handler the double click handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasErrorHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasErrorHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link ErrorEvent} events.
+ */
+public interface HasErrorHandlers {
+ /**
+ * Adds a {@link ErrorEvent} handler.
+ *
+ * @param handler the error handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addErrorHandler(ErrorHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasFocusHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasFocusHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link FocusEvent} events.
+ */
+public interface HasFocusHandlers {
+ /**
+ * Adds a {@link FocusEvent} handler.
+ *
+ * @param handler the focus handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addFocusHandler(FocusHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyCodes.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyCodes.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * Adapting from {@link com.google.gwt.user.client.ui.KeyboardListener}.
Without
+ * this interface the migration headache from keyboard listeners to key
handlers
+ * becomes a pain, as almost all current listeners use the short form
+ * <codE>KEY_ALT</code> when referring to key codes.
+ */
+// CHECKSTYLE_OFF
+@SuppressWarnings("all")
+public interface HasKeyCodes {
+ /**
+ * Alt key code.
+ */
+ public static final int KEY_ALT = 18;
+
+ /**
+ * Backspace key code.
+ */
+ public static final int KEY_BACKSPACE = 8;
+
+ /**
+ * Control key code.
+ */
+ public static final int KEY_CTRL = 17;
+
+ /**
+ * Delete key code.
+ */
+ public static final int KEY_DELETE = 46;
+
+ /**
+ * Down arrow code.
+ */
+ public static final int KEY_DOWN = 40;
+
+ /**
+ * End key code.
+ */
+ public static final int KEY_END = 35;
+ /**
+ * Enter key code.
+ */
+ public static final int KEY_ENTER = 13;
+ /**
+ * Escape key code.
+ */
+ public static final int KEY_ESCAPE = 27;
+ /**
+ * Home key code.
+ */
+ public static final int KEY_HOME = 36;
+ /**
+ * Left key code.
+ */
+ public static final int KEY_LEFT = 37;
+ /**
+ * Page down key code.
+ */
+ public static final int KEY_PAGEDOWN = 34;
+ /**
+ * Page up key code.
+ */
+ public static final int KEY_PAGEUP = 33;
+ /**
+ * Right arrow key code.
+ */
+ public static final int KEY_RIGHT = 39;
+
+ /**
+ * Shift key code.
+ */
+ public static final int KEY_SHIFT = 16;
+ /**
+ * Tab key code.
+ */
+ public static final int KEY_TAB = 9;
+
+ /**
+ * Up Arrow key code.
+ */
+ public static final int KEY_UP = 38;
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyDownHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyDownHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link KeyDownEvent} events.
+ */
+public interface HasKeyDownHandlers {
+ /**
+ * Adds a {@link KeyDownEvent} handler.
+ *
+ * @param handler the key down handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addKeyDownHandler(KeyDownHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyPressHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyPressHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link KeyPressEvent} events.
+ */
+public interface HasKeyPressHandlers {
+ /**
+ * Adds a {@link KeyPressEvent} handler.
+ *
+ * @param handler the key press handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addKeyPressHandler(KeyPressHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyUpHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasKeyUpHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link KeyUpEvent} events.
+ */
+public interface HasKeyUpHandlers {
+ /**
+ * Adds a {@link KeyUpEvent} handler.
+ *
+ * @param handler the key up handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addKeyUpHandler(KeyUpHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasLoadHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasLoadHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link LoadEvent} events.
+ */
+public interface HasLoadHandlers {
+ /**
+ * Adds a {@link LoadEvent} handler.
+ *
+ * @param handler the load handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addLoadHandler(LoadHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasLoseCaptureHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasLoseCaptureHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link LoseCaptureEvent} events.
+ */
+public interface HasLoseCaptureHandlers {
+ /**
+ * Adds a {@link LoseCaptureEvent} handler.
+ *
+ * @param handler the lose capture handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addLoseCaptureHandler(LoseCaptureHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseDownHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseDownHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link MouseDownEvent} events.
+ */
+public interface HasMouseDownHandlers {
+ /**
+ * Adds a {@link MouseDownEvent} handler.
+ *
+ * @param handler the mouse down handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addMouseDownHandler(MouseDownHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseMoveHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseMoveHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link MouseMoveEvent} events.
+ */
+public interface HasMouseMoveHandlers {
+ /**
+ * Adds a {@link MouseMoveEvent} handler.
+ *
+ * @param handler the mouse move handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseOutHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseOutHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link MouseOutEvent} events.
+ */
+public interface HasMouseOutHandlers {
+ /**
+ * Adds a {@link MouseOutEvent} handler.
+ *
+ * @param handler the mouse out handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addMouseOutHandler(MouseOutHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseOverHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseOverHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link MouseOverEvent} events.
+ */
+public interface HasMouseOverHandlers {
+ /**
+ * Adds a {@link MouseOverEvent} handler.
+ *
+ * @param handler the mouse over handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addMouseOverHandler(MouseOverHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseUpHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseUpHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link MouseUpEvent} events.
+ */
+public interface HasMouseUpHandlers {
+ /**
+ * Adds a {@link MouseUpEvent} handler.
+ *
+ * @param handler the mouse up handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addMouseUpHandler(MouseUpHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseWheelHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasMouseWheelHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link MouseWheelEvent} events.
+ */
+public interface HasMouseWheelHandlers {
+ /**
+ * Adds a {@link MouseWheelEvent} handler.
+ *
+ * @param handler the mouse wheel handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasScrollHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/HasScrollHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link ScrollEvent} events.
+ */
+public interface HasScrollHandlers {
+ /**
+ * Adds a {@link ScrollEvent} handler.
+ *
+ * @param handler the scroll handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addScrollHandler(ScrollHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Key up and key down are both events based upon a given key code.
+ */
+public abstract class KeyCodeEvent extends KeyEvent implements HasKeyCodes
{
+ /**
+ * Does the key code represent an arrow key?
+ *
+ * @param keyCode the key code
+ * @return if it is an arrow key code
+ */
+ public static boolean isArrow(int keyCode) {
+ switch (keyCode) {
+ case KEY_DOWN:
+ case KEY_RIGHT:
+ case KEY_UP:
+ case KEY_LEFT:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the wrapped native event
+ */
+ protected KeyCodeEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ /**
+ * Gets the current key code.
+ *
+ * @return the key code
+ */
+ public int getKeyCode() {
+ return getNativeEvent().getKeyCode();
+ }
+
+ /**
+ * Is the key code alpha-numeric (i.e. A-z or 0-9)?
+ *
+ * @return is the key code alpha numeric.
+ */
+ public boolean isAlphaNumeric() {
+ int keycode = getKeyCode();
+ return (48 <= keycode && keycode <= 57) || (65 <= keycode && keycode
<= 90);
+ }
+
+ /**
+ * Is this a key down arrow?
+ *
+ * @return whether this is a down arrow key event
+ */
+ public boolean isDownArrow() {
+ return getKeyCode() == KEY_DOWN;
+ }
+
+ /**
+ * Is this a left arrow?
+ *
+ * @return whether this is a left arrow key event
+ */
+ public boolean isLeftArrow() {
+ return getKeyCode() == KEY_LEFT;
+ }
+
+ /**
+ * Is this a right arrow?
+ *
+ * @return whether this is a right arrow key event
+ */
+ public boolean isRightArrow() {
+ return getKeyCode() == KEY_RIGHT;
+ }
+
+ /**
+ * Is this a up arrow?
+ *
+ * @return whether this is a right arrow key event
+ */
+ public boolean isUpArrow() {
+ return getKeyCode() == KEY_UP;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native key down event.
+ */
+public class KeyDownEvent extends KeyCodeEvent {
+
+ /**
+ Event type for key down events. Represents the meta-data associated
with this event.
+ */
+ public static final Type<KeyDownEvent, KeyDownHandler> TYPE = new
Type<KeyDownEvent,KeyDownHandler>(
+ Event.ONKEYDOWN) {
+ @Override
+ public void fire(KeyDownHandler handler, KeyDownEvent event) {
+ handler.onKeyDown(event);
+ }
+
+ @Override
+ KeyDownEvent wrap(Event nativeEvent) {
+ return new KeyDownEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public KeyDownEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyDownHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyDownHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2008 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 KeyDownEvent} events.
+ */
+public interface KeyDownHandler extends EventHandler, HasKeyCodes {
+ /**
+ * Called when {@link KeyDownEvent} is fired.
+ *
+ * @param event the {@link KeyDownEvent} that was fired
+ */
+ void onKeyDown(KeyDownEvent event);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2008 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.user.client.DOM;
+import com.google.gwt.user.client.Event;
+
+/**
+ * Base class for Key events. The native keyboard events are somewhat a
mess
+ * (http://www.quirksmode.org/js/keys.html), we do some trivial
normalization
+ * here, but do not attempt any complex patching, so user be warned.
+ */
+public abstract class KeyEvent extends DomEvent {
+
+ /**
+ * Alt modifier.
+ */
+ public static final int MODIFIER_ALT = 4;
+ /**
+ * Control modifier.
+ */
+ public static final int MODIFIER_CTRL = 2;
+ /**
+ * Meta modifier.
+ */
+ public static final int MODIFIER_META = 8;
+ /**
+ * Shift modifier.
+ */
+ public static final int MODIFIER_SHIFT = 1;
+
+ /**
+ * Gets the key modifiers associated with this event.
+ *
+ * @param event the event
+ *
+ * @return the modifiers as defined in {@link KeyCodeEvent}.
+ */
+ public static int getKeyModifiers(Event event) {
+ return (DOM.eventGetShiftKey(event) ? MODIFIER_SHIFT : 0)
+ | (DOM.eventGetMetaKey(event) ? MODIFIER_META : 0)
+ | (DOM.eventGetCtrlKey(event) ? MODIFIER_CTRL : 0)
+ | (DOM.eventGetAltKey(event) ? MODIFIER_ALT : 0);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the wrapped native event
+ */
+ protected KeyEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ /**
+ * Gets the key modifiers associated with this event.
+ *
+ * @return the modifiers as defined in {@link KeyCodeEvent}.
+ */
+ public int getKeyModifiers() {
+ return getKeyModifiers(this.getNativeEvent());
+ }
+
+ /**
+ * Is the <code>alt</code> key down?
+ *
+ * @return whether the alt key is down
+ */
+ public boolean isAltKeyDown() {
+ return getNativeEvent().getAltKey();
+ }
+
+ /**
+ * Gets the key-repeat state of this event.
+ *
+ * @return <code>true</code> if this key event was an auto-repeat
+ */
+ public boolean isAutoRepeat() {
+ return getNativeEvent().getRepeat();
+ }
+
+ /**
+ * Is the <code>control</code> key down?
+ *
+ * @return whether the control key is down
+ */
+ public boolean isControlKeyDown() {
+ return getNativeEvent().getCtrlKey();
+ }
+
+ /**
+ * Is the <code>shift</code> key down?
+ *
+ * @return whether the shift key is down
+ */
+ public boolean isShiftKeyDown() {
+ return getNativeEvent().getShiftKey();
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native key press event.
+ */
+public class KeyPressEvent extends KeyEvent {
+
+ /**
+ * Event type for key press events. Represents the meta-data associated
with
+ * this event.
+ */
+ public static final Type<KeyPressEvent, KeyPressHandler> TYPE = new
Type<KeyPressEvent, KeyPressHandler>(
+ Event.ONKEYPRESS) {
+ @Override
+ public void fire(KeyPressHandler handler, KeyPressEvent event) {
+ handler.onKeyPress(event);
+ }
+
+ @Override
+ KeyPressEvent wrap(Event nativeEvent) {
+ return new KeyPressEvent(nativeEvent);
+ }
+ };
+ private static final int OTHER_KEY_DOWN = 63233;
+ private static final int OTHER_KEY_LEFT = 63234;
+ private static final int OTHER_KEY_RIGHT = 63235;
+ private static final int OTHER_KEY_UP = 63232;
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public KeyPressEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ /**
+ * Gets the char code for this event.
+ *
+ * @return the char code
+ */
+ public char getCharCode() {
+ return getCharCode(getNativeEvent());
+ }
+
+ /**
+ * Is this a key down arrow?
+ *
+ * @return whether this is a down arrow key event
+ */
+ public boolean isDownArrow() {
+ return getKeyCode() == KeyCodeEvent.KEY_DOWN
+ || getKeyCode() == OTHER_KEY_DOWN;
+ }
+
+ /**
+ * Is this a left arrow?
+ *
+ * @return whether this is a left arrow key event
+ */
+ public boolean isLeftArrow() {
+ return getKeyCode() == KeyCodeEvent.KEY_LEFT
+ || getKeyCode() == OTHER_KEY_LEFT;
+ }
+
+ /**
+ * Is this a right arrow?
+ *
+ * @return whether this is a right arrow key event
+ */
+ public boolean isRightArrow() {
+ return getKeyCode() == KeyCodeEvent.KEY_RIGHT
+ || getKeyCode() == OTHER_KEY_RIGHT;
+ }
+
+ /**
+ * Is this a up arrow?
+ *
+ * @return whether this is a right arrow key event
+ */
+ public boolean isUpArrow() {
+ return getKeyCode() == KeyCodeEvent.KEY_UP || getKeyCode() ==
OTHER_KEY_UP;
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+ private native char getCharCode(Event e)/*-{
+ return e.charCode || e.keyCode;
+ }-*/;
+
+ private int getKeyCode() {
+ return getNativeEvent().getKeyCode();
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyPressHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyPressHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 KeyPressEvent} events.
+ */
+public interface KeyPressHandler extends EventHandler {
+
+ /**
+ * Called when KeyPressEvent is fired.
+ *
+ * @param event the {@link KeyPressEvent} that was fired
+ */
+ void onKeyPress(KeyPressEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native key up event.
+ */
+public class KeyUpEvent extends KeyCodeEvent {
+
+ /**
+ Event type for key up events. Represents the meta-data associated with
this event.
+ */
+ public static final Type<KeyUpEvent, KeyUpHandler> TYPE = new
Type<KeyUpEvent,KeyUpHandler>(
+ Event.ONKEYUP) {
+ @Override
+ public void fire(KeyUpHandler handler, KeyUpEvent event) {
+ handler.onKeyUp(event);
+ }
+
+ @Override
+ KeyUpEvent wrap(Event nativeEvent) {
+ return new KeyUpEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public KeyUpEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyUpHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/KeyUpHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 KeyUpEvent} events.
+ */
+public interface KeyUpHandler extends EventHandler, HasKeyCodes {
+
+ /**
+ * Called when KeyUpEvent is fired.
+ *
+ * @param event the {@link KeyUpEvent} that was fired
+ */
+ void onKeyUp(KeyUpEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoadEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoadEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native load event.
+ */
+public class LoadEvent extends DomEvent {
+
+ /**
+ Event type for load events. Represents the meta-data associated with
this event.
+ */
+ public static final Type<LoadEvent, LoadHandler> TYPE = new
Type<LoadEvent,LoadHandler>(
+ Event.ONLOAD) {
+ @Override
+ public void fire(LoadHandler handler, LoadEvent event) {
+ handler.onLoad(event);
+ }
+
+ @Override
+ LoadEvent wrap(Event nativeEvent) {
+ return new LoadEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public LoadEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoadHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoadHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 LoadEvent} events.
+ */
+public interface LoadHandler extends EventHandler {
+
+ /**
+ * Called when LoadEvent is fired.
+ *
+ * @param event the {@link LoadEvent} that was fired
+ */
+ void onLoad(LoadEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native lose capture event.
+ */
+public class LoseCaptureEvent extends DomEvent {
+
+ /**
+ Event type for lose capture events. Represents the meta-data
associated with this event.
+ */
+ public static final Type<LoseCaptureEvent, LoseCaptureHandler> TYPE =
new Type<LoseCaptureEvent,LoseCaptureHandler>(
+ Event.ONLOSECAPTURE) {
+ @Override
+ public void fire(LoseCaptureHandler handler, LoseCaptureEvent event) {
+ handler.onLoseCapture(event);
+ }
+
+ @Override
+ LoseCaptureEvent wrap(Event nativeEvent) {
+ return new LoseCaptureEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public LoseCaptureEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoseCaptureHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/LoseCaptureHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 LoseCaptureEvent} events.
+ */
+public interface LoseCaptureHandler extends EventHandler {
+
+ /**
+ * Called when LoseCaptureEvent is fired.
+ *
+ * @param event the {@link LoseCaptureEvent} that was fired
+ */
+ void onLoseCapture(LoseCaptureEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native mouse down event.
+ */
+public class MouseDownEvent extends MouseEvent {
+
+ /**
+ Event type for mouse down events. Represents the meta-data associated
with this event.
+ */
+ public static final Type<MouseDownEvent, MouseDownHandler> TYPE = new
Type<MouseDownEvent,MouseDownHandler>(
+ Event.ONMOUSEDOWN) {
+ @Override
+ public void fire(MouseDownHandler handler, MouseDownEvent event) {
+ handler.onMouseDown(event);
+ }
+
+ @Override
+ MouseDownEvent wrap(Event nativeEvent) {
+ return new MouseDownEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public MouseDownEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseDownHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseDownHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 MouseDownEvent} events.
+ */
+public interface MouseDownHandler extends EventHandler {
+
+ /**
+ * Called when MouseDown is fired.
+ *
+ * @param event the {@link MouseDownEvent} that was fired
+ */
+ void onMouseDown(MouseDownEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2008 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.dom.client.Element;
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Window;
+
+/**
+ * Abstract class representing mouse events.
+ *
+ * @param <T> event handler type
+ */
+public abstract class MouseEvent<T extends EventHandler> extends DomEvent {
+
+ /**
+ * The native Dom button codes.
+ */
+ public enum Button {
+ /**
+ * Left button.
+ */
+ LEFT,
+ /**
+ * Middle button.
+ */
+ MIDDLE,
+ /**
+ * Right button.
+ */
+ RIGHT;
+
+ /**
+ * Gets the button codes.
+ *
+ * @param buttonCode the button code
+ * @return which button
+ */
+ public static Button valueOf(int buttonCode) {
+ switch (buttonCode) {
+ case Event.BUTTON_LEFT:
+ return LEFT;
+ case Event.BUTTON_RIGHT:
+ return RIGHT;
+ case Event.BUTTON_MIDDLE:
+ return MIDDLE;
+ default:
+ throw new IllegalStateException("Unknown button code " +
buttonCode);
+ }
+ }
+ }
+
+
+
+ /**
+ * Gets the x coordinate relative to the given element.
+ *
+ * @param nativeEvent the native event
+ * @param relativeTo the relative element
+ * @return the relative x
+ */
+ public static int getRelativeX(Event nativeEvent, Element relativeTo) {
+ return nativeEvent.getClientX() - relativeTo.getAbsoluteLeft()
+ + relativeTo.getScrollLeft() + Window.getScrollLeft();
+ }
+
+ /**
+ * Gets the y coordinate relative to the given element.
+ *
+ * @param nativeEvent the native event
+ * @param relativeTo the relative element
+ * @return the relative y
+ */
+ public static int getRelativeY(Event nativeEvent, Element relativeTo) {
+ return nativeEvent.getClientY() - relativeTo.getAbsoluteTop()
+ + relativeTo.getScrollTop() + Window.getScrollTop();
+ }
+
+ MouseEvent(Event e) {
+ super(e);
+ }
+
+ /**
+ * Gets the button value.
+ *
+ * @return gets the button value.
+ */
+ public Button getButton() {
+ return Button.valueOf(getNativeEvent().getButton());
+ }
+
+ /**
+ * Gets the mouse x-position within the browser window's client area.
+ *
+ * @return the mouse x-position
+ */
+ public int getClientX() {
+ return getNativeEvent().getClientX();
+ }
+
+ /**
+ * Gets the mouse y-position within the browser window's client area.
+ *
+ * @return the mouse y-position
+ */
+ public int getClientY() {
+ return getNativeEvent().getClientY();
+ }
+
+
+
+
+ /**
+ * Gets the x coordinate relative to the given element.
+ *
+ * @param relativeTo the relative element
+ * @return the relative x
+ */
+ public int getRelativeX(Element relativeTo) {
+ return getRelativeX(getNativeEvent(), relativeTo);
+ }
+
+ /**
+ * Gets the y coordinate relative to the given element.
+ *
+ *
+ * @param relativeTo the relative element
+ * @return the relative y
+ */
+ public int getRelativeY(Element relativeTo) {
+ return getRelativeY(getNativeEvent(), relativeTo);
+ }
+
+ /**
+ * Gets the mouse x-position on the user's display.
+ *
+ * @return the mouse x-position
+ */
+ public int getScreenX() {
+ return getNativeEvent().getScreenX();
+ }
+
+ /**
+ * Gets the mouse y-position on the user's display.
+ *
+ * @return the mouse y-position
+ */
+ public int getScreenY() {
+ return getNativeEvent().getScreenY();
+ }
+
+ /**
+ * Is <code>alt</code> key down.
+ *
+ * @return whether the alt key is down
+ */
+ public boolean isAltKeyDown() {
+ return getNativeEvent().getAltKey();
+ }
+
+ /**
+ * Is <code>control</code> key down.
+ *
+ * @return whether the control key is down
+ */
+ public boolean isControlKeyDown() {
+ return getNativeEvent().getCtrlKey();
+ }
+
+ /**
+ * Is <code>meta</code> key down.
+ *
+ * @return whether the meta key is down
+ */
+ public boolean isMetaKeyDown() {
+ return getNativeEvent().getMetaKey();
+ }
+
+ /**
+ * Is <code>shift</code> key down.
+ *
+ * @return whether the shift key is down
+ */
+ public boolean isShiftKeyDown() {
+ return getNativeEvent().getShiftKey();
+ }
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native mouse move event.
+ */
+public class MouseMoveEvent extends MouseEvent {
+
+ /**
+ Event type for mouse move events. Represents the meta-data associated
with this event.
+ */
+ public static final Type<MouseMoveEvent, MouseMoveHandler> TYPE = new
Type<MouseMoveEvent,MouseMoveHandler>(
+ Event.ONMOUSEMOVE) {
+ @Override
+ public void fire(MouseMoveHandler handler, MouseMoveEvent event) {
+ handler.onMouseMove(event);
+ }
+
+ @Override
+ MouseMoveEvent wrap(Event nativeEvent) {
+ return new MouseMoveEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public MouseMoveEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseMoveHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseMoveHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 MouseMoveEvent} events.
+ */
+public interface MouseMoveHandler extends EventHandler {
+
+ /**
+ * Called when MouseMoveEvent is fired.
+ *
+ * @param event the {@link MouseMoveEvent} that was fired
+ */
+ void onMouseMove(MouseMoveEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native mouse out event.
+ */
+public class MouseOutEvent extends MouseEvent {
+
+ /**
+ Event type for mouse out events. Represents the meta-data associated
with this event.
+ */
+ public static final Type<MouseOutEvent, MouseOutHandler> TYPE = new
Type<MouseOutEvent,MouseOutHandler>(
+ Event.ONMOUSEOUT) {
+ @Override
+ public void fire(MouseOutHandler handler, MouseOutEvent event) {
+ handler.onMouseOut(event);
+ }
+
+ @Override
+ MouseOutEvent wrap(Event nativeEvent) {
+ return new MouseOutEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public MouseOutEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOutHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOutHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 MouseOutEvent} events.
+ */
+public interface MouseOutHandler extends EventHandler {
+
+ /**
+ * Called when MouseOutEvent is fired.
+ *
+ * @param event the {@link MouseOutEvent} that was fired
+ */
+ void onMouseOut(MouseOutEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native mouse over event.
+ */
+public class MouseOverEvent extends MouseEvent {
+
+ /**
+ Event type for mouse over events. Represents the meta-data associated
with this event.
+ */
+ public static final Type<MouseOverEvent, MouseOverHandler> TYPE = new
Type<MouseOverEvent,MouseOverHandler>(
+ Event.ONMOUSEOVER) {
+ @Override
+ public void fire(MouseOverHandler handler, MouseOverEvent event) {
+ handler.onMouseOver(event);
+ }
+
+ @Override
+ MouseOverEvent wrap(Event nativeEvent) {
+ return new MouseOverEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public MouseOverEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOverHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseOverHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 MouseOverEvent} events.
+ */
+public interface MouseOverHandler extends EventHandler {
+
+ /**
+ * Called when MouseOverEvent is fired.
+ *
+ * @param event the {@link MouseOverEvent} that was fired
+ */
+ void onMouseOver(MouseOverEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native mouse up event.
+ */
+public class MouseUpEvent extends MouseEvent {
+
+ /**
+ Event type for mouse up events. Represents the meta-data associated
with this event.
+ */
+ public static final Type<MouseUpEvent, MouseUpHandler> TYPE = new
Type<MouseUpEvent,MouseUpHandler>(
+ Event.ONMOUSEUP) {
+ @Override
+ public void fire(MouseUpHandler handler, MouseUpEvent event) {
+ handler.onMouseUp(event);
+ }
+
+ @Override
+ MouseUpEvent wrap(Event nativeEvent) {
+ return new MouseUpEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public MouseUpEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseUpHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseUpHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 MouseUpEvent} events.
+ */
+public interface MouseUpHandler extends EventHandler {
+
+ /**
+ * Called when MouseUpEvent is fired.
+ *
+ * @param event the {@link MouseUpEvent} that was fired
+ */
+ void onMouseUp(MouseUpEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2008 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.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.MouseWheelVelocity;
+
+/**
+ * Represents a native mouse wheel event.
+ */
+public class MouseWheelEvent extends MouseEvent {
+
+ /**
+ * Event Type for MouseWheel. Represents the meta-data associated with
this
+ * event.
+ */
+ public static final Type<MouseWheelEvent, MouseWheelHandler> TYPE = new
Type<MouseWheelEvent, MouseWheelHandler>(
+ Event.ONMOUSEWHEEL) {
+ @Override
+ public void fire(MouseWheelHandler handler, MouseWheelEvent event) {
+ handler.onMouseWheel(event);
+ }
+
+ @Override
+ MouseWheelEvent wrap(Event nativeEvent) {
+ return new MouseWheelEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructs a MouseWheelEvent event.
+ *
+ * @param nativeEvent the native event object wrapped by this event
+ */
+ public MouseWheelEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof MouseWheelVelocity) {
+ MouseWheelVelocity v = (MouseWheelVelocity) o;
+ return getDeltaY() == v.getDeltaY();
+ }
+
+ return false;
+ }
+
+ /**
+ * @return the change in the mouse wheel position along the Y-axis;
positive
+ * if the mouse wheel is moving north (toward the top of the
screen)
+ * or negative if the mouse wheel is moving south (toward the
bottom
+ * of the screen)
+ */
+ public int getDeltaY() {
+ return DOM.eventGetMouseWheelVelocityY(getNativeEvent());
+ }
+
+ @Override
+ public int hashCode() {
+ return getDeltaY();
+ }
+
+ /**
+ * Convenience method that returns <code>true</code> if {@link
#getDeltaY()}
+ * is a negative value.
+ *
+ * @return <code>true</code> if the velocity includes a component
directed
+ * toword the top of the screen
+ */
+ public boolean isNorth() {
+ return getDeltaY() < 0;
+ }
+
+ /**
+ * Convenience method that returns <code>true</code> if {@link
#getDeltaY()}
+ * is a positive value.
+ *
+ * @return <code>true</code> if the velocity includes a component
directed
+ * toward the bottom of the screen
+ */
+ public boolean isSouth() {
+ return getDeltaY() > 0;
+ }
+
+ @Override
+ public String toString() {
+ return "<" + getDeltaY() + ">";
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseWheelHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/MouseWheelHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 MouseWheelEvent} events.
+ */
+public interface MouseWheelHandler extends EventHandler {
+
+ /**
+ * Called when MouseWheelEvent is fired.
+ *
+ * @param event the {@link MouseWheelEvent} that was fired
+ */
+ void onMouseWheel(MouseWheelEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/RawJsStringMapImpl.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/RawJsStringMapImpl.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2008 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.core.client.GWT;
+import com.google.gwt.core.client.JavaScriptObject;
+
+import java.util.HashMap;
+
+/**
+ * A raw js string map implementation. public so we can avoid creating
multiple
+ * versions for our internal code, the API is completely unsafe with two
versions of get and put, so
+ * please don't use!
+ *
+ * @param <ValueType> value type
+ */
+public class RawJsStringMapImpl<ValueType> {
+
+ private static class KeyMap<ValueType> extends JavaScriptObject {
+
+ public static RawJsStringMapImpl.KeyMap create() {
+ return (RawJsStringMapImpl.KeyMap) JavaScriptObject.createObject();
+ }
+
+ protected KeyMap() {
+ }
+
+ public final native ValueType get(String key) /*-{
+ return this[key];
+ }-*/;
+
+ public final native void put(String key, ValueType value) /*-{
+ this[key] = value;
+ }-*/;
+ }
+
+ private RawJsStringMapImpl.KeyMap<ValueType> map;
+ private HashMap<String, ValueType> javaMap;
+
+ public RawJsStringMapImpl() {
+ if (GWT.isScript()) {
+ map = KeyMap.create();
+ } else {
+ javaMap = new HashMap<String, ValueType>();
+ }
+ }
+
+ // Raw get, only use for values that are known not to conflict with the
+ // browser's reserved keywords.
+ public final ValueType get(String key) {
+ if (GWT.isScript()) {
+ return map.get(key);
+ } else {
+ return javaMap.get(key);
+ }
+ }
+
+ // Raw put, only use for values that are known not to conflict with the
+ // browser's reserved keywords.
+ public final void put(String key, ValueType value) {
+ if (GWT.isScript()) {
+ map.put(key, value);
+ } else {
+ javaMap.put(key, value);
+ }
+ }
+
+ // ONLY use this for values put with safePut.
+ public final ValueType safeGet(String key) {
+ return get(key + ":");
+ }
+
+ // ONLY use this for values that will be accessed with saveGet.
+ public final void safePut(String key, ValueType value) {
+ put(key + ":", value);
+ }
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ScrollEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ScrollEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 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.user.client.Event;
+
+/**
+ * Represents a native scroll event.
+ */
+public class ScrollEvent extends DomEvent {
+
+ /**
+ Event type for scroll events. Represents the meta-data associated with
this event.
+ */
+ public static final Type<ScrollEvent, ScrollHandler> TYPE = new
Type<ScrollEvent,ScrollHandler>(
+ Event.ONSCROLL) {
+ @Override
+ public void fire(ScrollHandler handler, ScrollEvent event) {
+ handler.onScroll(event);
+ }
+
+ @Override
+ ScrollEvent wrap(Event nativeEvent) {
+ return new ScrollEvent(nativeEvent);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param nativeEvent the native event object
+ */
+ public ScrollEvent(Event nativeEvent) {
+ super(nativeEvent);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ScrollHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/dom/client/ScrollHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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 ScrollEvent} events.
+ */
+public interface ScrollHandler extends EventHandler {
+
+ /**
+ * Called when ScrollEvent is fired.
+ *
+ * @param event the {@link ScrollEvent} that was fired
+ */
+ void onScroll(ScrollEvent event);
+}
\ No newline at end of file

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/BeforeShowEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/BeforeShowEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.AbstractEvent;
+
+/**
+ * Fired directly before an event source's contents are shown.
+ */
+public class BeforeShowEvent extends AbstractEvent {
+
+ /**
+ * Event type for {@link BeforeShowEvent}.
+ */
+ public static final Type<BeforeShowEvent, BeforeShowHandler> TYPE = new
Type<BeforeShowEvent, BeforeShowHandler>() {
+ @Override
+ protected void fire(BeforeShowHandler handler, BeforeShowEvent event) {
+ handler.onBeforeShow(event);
+ }
+ };
+
+ /**
+ * Constructor.
+ */
+ public BeforeShowEvent() {
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/BeforeShowHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/BeforeShowHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link BeforeShowEvent} events.
+ */
+public interface BeforeShowHandler extends EventHandler {
+
+ /**
+ * Called when {@link BeforeShowEvent} is fired.
+ *
+ * @param event the {@link BeforeShowEvent} that was fired
+ */
+ void onBeforeShow(BeforeShowEvent event);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasBeforeShowHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasBeforeShowHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link BeforeShowEvent} events.
+ */
+public interface HasBeforeShowHandlers {
+ /**
+ * Adds a {@link BeforeShowHandler} handler.
+ *
+ * @param handler the handler
+ * @return the handler registration
+ */
+ HandlerRegistration addBeforeShowHandler(BeforeShowHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasHideHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasHideHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * An event source that implements this interface is a public source of
+ * {@link HideEvent} events.
+ */
+public interface HasHideHandlers {
+ /**
+ * Adds a {@link HideEvent} handler.
+ *
+ * @param handler the handler
+ * @return the handler registration
+ */
+ HandlerRegistration addHideHandler(HideHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasHighlightHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasHighlightHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * An event source that implements this interface is a public source of
+ * {@link HighlightEvent} events.
+ *
+ * @param <Value> The value associated with the highlight event
+ */
+public interface HasHighlightHandlers<Value> {
+ /**
+ * Adds a {@link HighlightEvent} handler.
+ *
+ * @param handler the handler
+ * @return the handler registration
+ */
+ HandlerRegistration addHighlightHandler(HighlightHandler<Value> handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasSelectionHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasSelectionHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link SelectionEvent} events.
+ *
+ * @param <ValueType> The type of value being selected
+ */
+public interface HasSelectionHandlers<ValueType> {
+ /**
+ * Adds a {@link SelectionEvent} handler.
+ *
+ * @param handler the handler
+ * @return the handler registration
+ */
+ HandlerRegistration addSelectionHandler(SelectionHandler<ValueType>
handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasShowRangeHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasShowRangeHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link ShowRangeEvent} events.
+ *
+ * @param <Value> type of value
+ */
+public interface HasShowRangeHandlers<Value> {
+ /**
+ * Adds a {@link ShowRangeEvent} handler.
+ *
+ * @param handler the handler
+ * @return the handler registration
+ */
+ HandlerRegistration addShowRangeHandler(ShowRangeHandler<Value> handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasUnhighlightHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasUnhighlightHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link UnhighlightEvent} events.
+ *
+ * @param <Value> The value associated with the UnhighlightEvent
+ */
+public interface HasUnhighlightHandlers<Value> {
+ /**
+ * Adds a {@link UnhighlightHandler}.
+ *
+ * @param handler the handler
+ * @return the handler registration
+ */
+ HandlerRegistration addUnhighlightHandler(UnhighlightHandler<Value>
handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasWrongFormatHandlers.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HasWrongFormatHandlers.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link WrongFormatEvent} events.
+ */
+public interface HasWrongFormatHandlers {
+ /**
+ * Adds a {@link WrongFormatEvent} handler.
+ *
+ * @param handler the handler
+ * @return the handler registration
+ */
+ HandlerRegistration addWrongFormatHandler(WrongFormatHandler handler);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HideEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HideEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.AbstractEvent;
+
+/**
+ * Fired after an event source has hidden its contents.
+ */
+public class HideEvent extends AbstractEvent {
+
+ /**
+ * Event Key for {@link HideEvent}.
+ */
+ public static final Type<HideEvent, HideHandler> TYPE = new
Type<HideEvent, HideHandler>() {
+ @Override
+ protected void fire(HideHandler handler, HideEvent event) {
+ handler.onHide(event);
+ }
+ };
+
+ /**
+ * Constructs a HideEvent event.
+ */
+ public HideEvent() {
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HideHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HideHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link HideEvent} events.
+ */
+public interface HideHandler extends EventHandler {
+
+ /**
+ * Called when a {@link HideEvent} is fired.
+ *
+ * @param event the {@link HideEvent} that was fired
+ */
+ void onHide(HideEvent event);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+/**
+ * Fired when an event source changes its highlighted value.
+ *
+ * @param <Value> the value highlighted
+ */
+public class HighlightEvent<Value> extends ValueEvent<Value> {
+ /**
+ * Event type.
+ */
+ public static final Type<HighlightEvent, HighlightHandler> TYPE = new
Type<HighlightEvent, HighlightHandler>() {
+ @Override
+ protected void fire(HighlightHandler handler, HighlightEvent event) {
+ handler.onHighlight(event);
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param value value highlighted
+ */
+ public HighlightEvent(Value value) {
+ super(value);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HighlightHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/HighlightHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link HighlightEvent} events.
+ *
+ * @param <Value> the value associated with the highlight event
+ */
+public interface HighlightHandler<Value> extends EventHandler {
+
+ /**
+ * Called when HighlightEvent is fired.
+ *
+ * @param event the {@link HighlightEvent} that was fired
+ */
+ void onHighlight(HighlightEvent<Value> event);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.AbstractEvent;
+
+/**
+ * Fired after an event source has selected a new value.
+ *
+ * @param <Value> the type of value the widget has selected
+ */
+public class SelectionEvent<Value> extends AbstractEvent {
+
+ /**
+ * The event type.
+ */
+ public static final Type<SelectionEvent, SelectionHandler> TYPE = new
Type<SelectionEvent, SelectionHandler>() {
+
+ @Override
+ protected void fire(SelectionHandler handler, SelectionEvent event) {
+ handler.onSelection(event);
+ }
+ };
+
+ private Value oldValue;
+ private Value newValue;
+
+ /**
+ * Constructor.
+ *
+ * @param oldValue the old value
+ * @param newValue the new value
+ */
+
+ public SelectionEvent(Value oldValue, Value newValue) {
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+
+ /**
+ * Returns the new value.
+ *
+ * @return the new value
+ */
+ public Value getNewValue() {
+ assertLive();
+ return newValue;
+ }
+
+ /**
+ * Returns the old value.
+ *
+ * @return the old value
+ */
+ public Value getOldValue() {
+ assertLive();
+ return oldValue;
+ }
+
+ @Override
+ public String toDebugString() {
+ assertLive();
+ return super.toDebugString() + " old = " + oldValue + " new =" +
newValue;
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/SelectionHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/SelectionHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler for {@link SelectionEvent} events.
+ *
+ * @param <Value> type of the selected value
+ */
+public interface SelectionHandler<Value> extends EventHandler {
+ /**
+ * Fired once a value has been selected.
+ *
+ * @param event the event
+ */
+ void onSelection(SelectionEvent<Value> event);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.AbstractEvent;
+
+/**
+ * Fired after an event source shows a range of values.
+ *
+ * @param <Value> the type of value shown in the range
+ */
+public class ShowRangeEvent<Value> extends AbstractEvent {
+
+ /**
+ * Event type for {@link ShowRangeEvent}.
+ */
+ public static final Type<ShowRangeEvent, ShowRangeHandler> TYPE = new
Type<ShowRangeEvent, ShowRangeHandler>() {
+ @Override
+ protected void fire(ShowRangeHandler handler, ShowRangeEvent event) {
+ handler.onShowRange(event);
+ }
+ };
+ private Value start;
+ private Value end;
+
+ /**
+ * Constructs a ShowRangeEvent event.
+ *
+ * @param start start of range
+ * @param end end of range
+ */
+ public ShowRangeEvent(Value start, Value end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ /**
+ * Gets the end of the range.
+ *
+ * @return range end
+ */
+ public Value getEnd() {
+ assertLive();
+ return end;
+ }
+
+ /**
+ * Gets the start of the range.
+ *
+ * @return range start
+ */
+ public Value getStart() {
+ assertLive();
+ return start;
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ShowRangeHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ShowRangeHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link ShowRangeEvent} events.
+ *
+ * @param <Value> the range's value
+ */
+public interface ShowRangeHandler<Value> extends EventHandler {
+
+ /**
+ * Called when ShowRangeEvent is fired.
+ *
+ * @param event the {@link ShowRangeEvent} that was fired
+ */
+ void onShowRange(ShowRangeEvent<Value> event);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/UnhighlightEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/UnhighlightEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+/**
+ * Represents an unhighlight event.
+ *
+ * @param <Value> the value of the element unhighlighted
+ */
+public class UnhighlightEvent<Value> extends ValueEvent<Value> {
+ /**
+ * Event type for {@link UnhighlightEvent}.
+ */
+ public static final Type<UnhighlightEvent, UnhighlightHandler> TYPE =
new Type<UnhighlightEvent, UnhighlightHandler>() {
+ @Override
+ protected void fire(UnhighlightHandler handler, UnhighlightEvent
event) {
+ handler.onUnhighlight(event);
+ }
+ };
+
+ /**
+ * Constructs a {@link UnhighlightEvent}.
+ *
+ * @param value value
+ */
+ public UnhighlightEvent(Value value) {
+ super(value);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/UnhighlightHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/UnhighlightHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link HighlightEvent} events.
+ *
+ * @param <Value> the value associated with the unhighlight event
+ */
+public interface UnhighlightHandler<Value> extends EventHandler {
+
+ /**
+ * Called when an {@link UnhighlightEvent} is fired.
+ *
+ * @param event the {@link UnhighlightEvent} that was fired
+ */
+ void onUnhighlight(UnhighlightEvent<Value> event);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ValueEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/ValueEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.AbstractEvent;
+
+/**
+ * Value based event. Not part of the public API.
+ *
+ * @param <Value> value type
+ */
+abstract class ValueEvent<Value> extends AbstractEvent {
+ private Value value;
+
+ public ValueEvent(Value value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets this event's value.
+ *
+ * @return the value
+ */
+ public Value getValue() {
+ assertLive();
+ return value;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/WrongFormatEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/WrongFormatEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+/**
+ * Fired when an event source receives a value in the wrong format.
+ *
+ * @param <Value> the type of value with the wrong format
+ */
+public class WrongFormatEvent<Value> extends ValueEvent<Value> {
+
+ /**
+ * Event type for {@link WrongFormatEvent}.
+ */
+ public static final Type<WrongFormatEvent, WrongFormatHandler> TYPE =
new Type<WrongFormatEvent, WrongFormatHandler>() {
+ @Override
+ protected void fire(WrongFormatHandler handler, WrongFormatEvent
event) {
+ handler.onWrongFormat(event);
+ }
+ };
+
+ /**
+ * Constructs a {@link WrongFormatEvent} event.
+ *
+ * @param value the value with the wrong format
+ */
+ public WrongFormatEvent(Value value) {
+ super(value);
+ }
+
+ @Override
+ protected Type getType() {
+ return TYPE;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/WrongFormatHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/logical/shared/WrongFormatHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 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.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link WrongFormatEvent} events.
+ *
+ * @param <Value> the value with the wrong format
+ */
+public interface WrongFormatHandler<Value> extends EventHandler {
+
+ /**
+ * Called when WrongFormatEvent is fired.
+ *
+ * @param event the {@link WrongFormatEvent} that was fired
+ */
+ void onWrongFormat(WrongFormatEvent<Value> event);
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/shared/AbstractEvent.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/shared/AbstractEvent.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2008 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.shared;
+
+/**
+ * Root of all gwt events. All gwt events are considered dead and should no
+ * longer be accessed once the {@link HandlerManager} which originally
fired the
+ * event finishes with it.
+ *
+ */
+public abstract class AbstractEvent {
+ /**
+ * Type class used to register events with the {@link HandlerManager}.
+ * <p>
+ * Type is parameterized by the event and handler type in order to make
the
+ * addHandler method type safe and to avoid type-casts when implementing
+ * {@link AbstractEvent.Type#fire(EventHandler, AbstractEvent)}.
+ * </p>
+ *
+ * @param <EventType> event type
+ * @param <HandlerType> handler type
+ */
+ public abstract static class Type<EventType extends AbstractEvent,
HandlerType extends EventHandler> {
+
+ private int index;
+
+ /**
+ * Constructor.
+ */
+ public Type() {
+ index = HandlerManager.createKeyIndex();
+ }
+
+ // We override hash code to make it as efficient as possible.
+ @Override
+ public final int hashCode() {
+ return index;
+ }
+
+ @Override
+ public String toString() {
+ return "Event type";
+ }
+
+ /**
+ * Fires the given handler on the supplied event.
+ *
+ * @param handler the handler to fire
+ * @param event the event
+ */
+ protected abstract void fire(HandlerType handler, EventType event);
+ }
+
+ private boolean dead;
+
+ private Object source;
+
+ /**
+ * Constructor.
+ */
+ protected AbstractEvent() {
+ }
+
+ /**
+ * Returns the source that last fired this event.
+ *
+ * @return object representing the source of this event
+ */
+ public Object getSource() {
+ assertLive();
+ return source;
+ }
+
+ /**
+ * This is a method used primarily for debugging. It gives a string
+ * representation of the event details. This does not override the
toString
+ * method because the compiler cannot always optimize toString out
correctly.
+ * Event types should override as desired.
+ *
+ * @return a string representing the event's specifics.
+ */
+ public String toDebugString() {
+ String name = this.getClass().getName();
+ name = name.substring(name.lastIndexOf("."));
+ return name + ": source = " + source;
+ }
+
+ /**
+ * The toString() for abstract event is overridden to avoid accidently
+ * including class literals in the the compiled output. Use
+ * {@link AbstractEvent} #toDebugString to get more information about the
+ * event.
+ */
+ @Override
+ public String toString() {
+ return "An event type";
+ }
+
+ /**
+ * Asserts that the event still should be accessed. All events are
considered
+ * to be "dead" after their original handler manager finishes firing
them. An
+ * event can be revived by calling {@link AbstractEvent#revive()}.
+ */
+ protected void assertLive() {
+ assert (!dead) : "This event has already finished being processed by
its original handler manager, so you can no longer access it";
+ }
+
+ /**
+ * Returns the type used to register this event.
+ *
+ * @return the type
+ */
+ protected abstract Type getType();
+
+ /**
+ * Is the event current live?
+ *
+ * @return whether the event is live
+ */
+ protected boolean isLive() {
+ return !dead;
+ }
+
+ /**
+ * Revives the event. Used when recycling event instances.
+ */
+ protected void revive() {
+ dead = false;
+ }
+
+ /**
+ * Called after the event manager has finished processing the event.
+ */
+ void onRelease() {
+ dead = true;
+ source = null;
+ }
+
+ /**
+ * Set the source that triggered this event.
+ *
+ * @param source the source of this event, should only be set by a
+ * {@link HandlerManager}
+ */
+ void setSource(Object source) {
+ this.source = source;
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/shared/EventHandler.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/shared/EventHandler.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2008 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.shared;
+
+/**
+ * Marker interface for event handlers. All GWT event handlers should
extend
+ * {@link EventHandler}.
+ */
+public interface EventHandler {
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerAdaptor.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerAdaptor.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2008 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.shared;
+
+/**
+ * Base class for all handler adaptors. Handler adaptors are used for
+ * convenience when users want to bundle common handler types together.
The most
+ * commonly used are
+ * {@link com.google.gwt.event.dom.client.HasAllKeyHandlers.Adaptor} and
+ * {@link com.google.gwt.event.dom.client.HasAllMouseHandlers.Adaptor}.
+ */
+public class HandlerAdaptor {
+
+ /**
+ * Human readable debugging string.
+ *
+ * @return debugging string.
+ */
+ public String toDebugString() {
+ return super.toString();
+ }
+
+ /**
+ * The toString() for {@link HandlerAdaptor} is overridden to avoid
accidently
+ * including class literals in the the compiled output. Use
+ * {@link HandlerAdaptor} #toDebugString to get more information about
the
+ * event.
+ */
+ @Override
+ public String toString() {
+ return "handler adaptor";
+ }
+
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerManager.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerManager.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2008 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.shared;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.shared.AbstractEvent.Type;
+
+/**
+ * Manager responsible for adding handlers to event sources and firing
those
+ * handlers on passed in events.
+ */
+public class HandlerManager {
+ // Used to optimize the JavaScript handler container structure.
+ static int EXPECTED_HANDLERS = 5;
+
+ private static final boolean useJs = GWT.isScript();
+ private static int index = -EXPECTED_HANDLERS;
+
+ static int createKeyIndex() {
+ // Need to leave space for the size and the unflattened list if we end
up
+ // needing it.
+ index += EXPECTED_HANDLERS + 2;
+ return index;
+ }
+
+ // Only one of JsHandlerRegistry and JavaHandlerRegistry are live at
once.
+ private final JsHandlerRegistry javaScriptRegistry;
+ private final JavaHandlerRegistry javaRegistry;
+
+ //
+ private final Object source;
+
+ /**
+ * Creates a handler manager with the given source.
+ *
+ * @param source the event source
+ */
+ public HandlerManager(Object source) {
+ if (useJs) {
+ javaScriptRegistry = JsHandlerRegistry.create();
+ javaRegistry = null;
+ } else {
+ javaRegistry = new JavaHandlerRegistry();
+ javaScriptRegistry = null;
+ }
+ this.source = source;
+ }
+
+ /**
+ * Adds a handle.
+ *
+ * @param <HandlerType> The type of handler.
+ * @param type the event type associated with this handler
+ * @param handler the handler
+ * @return the handler registration, can be stored in order to remove the
+ * handler later
+ */
+ public <HandlerType extends EventHandler> HandlerRegistration addHandler(
+ AbstractEvent.Type<?, HandlerType> type, final HandlerType handler) {
+ if (useJs) {
+ javaScriptRegistry.addHandler(type, handler);
+ } else {
+ javaRegistry.addHandler(type, handler);
+ }
+ return new HandlerRegistration(this, type, handler);
+ }
+
+ /**
+ * Clears all the handlers associated with the given type.
+ *
+ * @param type the type
+ */
+ public void clearHandlers(Type<?, ?> type) {
+ if (useJs) {
+ javaScriptRegistry.clearHandlers(type);
+ } else {
+ javaRegistry.clearHandlers(type);
+ }
+ }
+
+ /**
+ * Fires the given event to the handlers listening to the event's type.
+ *
+ * @param event the event
+ */
+ public void fireEvent(AbstractEvent event) {
+ Object oldSource = event.getSource();
+ event.setSource(source);
+ if (useJs) {
+ javaScriptRegistry.fireEvent(event);
+ } else {
+ javaRegistry.fireEvent(event);
+ }
+ if (oldSource == null) {
+ // This was my event, so I should kill it now that I'm done.
+ event.onRelease();
+ } else {
+ // Restoring the source for the next handler to use.
+ event.setSource(oldSource);
+ }
+ }
+
+ /**
+ * Gets the handler at the given index.
+ *
+ * @param <HandlerType> the event handler type
+ * @param index the index
+ * @param type the handler's event type
+ * @return the given handler
+ */
+ public <HandlerType extends EventHandler> HandlerType getHandler(
+ AbstractEvent.Type<?, HandlerType> type, int index) {
+ if (useJs) {
+ return (HandlerType) javaScriptRegistry.getHandler(type, index);
+ } else {
+ return (HandlerType) javaRegistry.getHandler(type, index);
+ }
+ }
+
+ /**
+ * Gets the number of handlers listening to the event type.
+ *
+ * @param type the event type
+ * @return the number of registered handlers
+ */
+ public int getHandlerCount(Type type) {
+ if (useJs) {
+ return javaScriptRegistry.getHandlerCount(type);
+ } else {
+ return javaRegistry.getHandlerCount(type);
+ }
+ }
+
+ /**
+ * Are there handlers in this manager listening to the given event type?
+ *
+ * @param type the event type
+ * @return are handlers listening on the given event type
+ */
+ public boolean isEventHandled(Type type) {
+ return getHandlerCount(type) > 0;
+ }
+
+ /**
+ * Removes the given handler from the specified event type. Normally,
+ * applications should call {@link HandlerRegistration#removeHandler()}
+ * instead. This method is provided primary to support deprecated APIS.
+ *
+ * @param <HandlerType> handler type
+ *
+ * @param type the event type
+ * @param handler the handler
+ */
+ public <HandlerType extends EventHandler> void removeHandler(
+ AbstractEvent.Type<?, HandlerType> type, final HandlerType handler) {
+ if (useJs) {
+ javaScriptRegistry.removeHandler(type, handler);
+ } else {
+ javaRegistry.removeHandler(type, handler);
+ }
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerRegistration.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/shared/HandlerRegistration.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2008 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.shared;
+
+import com.google.gwt.event.shared.AbstractEvent.Type;
+
+/**
+ * HandlerRegistration instances are returned by
+ * HandlerManager.addEventHandler() and used to remove event handler
+ * registrations.
+ */
+public class HandlerRegistration {
+
+ private HandlerManager manager;
+ private EventHandler handler;
+ private Type type;
+
+ /**
+ * Creates a new handler registration.
+ *
+ * @param manager the handler manager
+ * @param type the event type
+ * @param handler the handler
+ */
+ protected HandlerRegistration(HandlerManager manager, Type type,
+ EventHandler handler) {
+ this.manager = manager;
+ this.handler = handler;
+ this.type = type;
+ }
+
+ /**
+ * Removes the given handler from its manager.
+ */
+ public void removeHandler() {
+ manager.removeHandler(type, handler);
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/shared/HasHandlerManager.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/shared/HasHandlerManager.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2008 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.shared;
+
+/**
+ *
+ * Characteristic interface indicating that the given widget fires events
via a
+ * {@link HandlerManager}.
+ *
+ */
+public interface HasHandlerManager {
+ /**
+ * Gets this widget's handler manager.
+ *
+ * @return the manager
+ */
+ HandlerManager getHandlerManager();
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/shared/JavaHandlerRegistry.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/shared/JavaHandlerRegistry.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008 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.shared;
+
+import com.google.gwt.event.shared.AbstractEvent.Type;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * The default Handler manager's handler registry.
+ */
+class JavaHandlerRegistry extends
+ HashMap<AbstractEvent.Type, ArrayList<EventHandler>> {
+
+ public void addHandler(AbstractEvent.Type eventKey, EventHandler
handler) {
+ ArrayList<EventHandler> l = super.get(eventKey);
+ if (l == null) {
+ l = new ArrayList<EventHandler>();
+ super.put(eventKey, l);
+ }
+ l.add(handler);
+ }
+
+ public void clearHandlers(Type<?, ?> type) {
+ super.remove(type);
+ }
+
+ public void fireEvent(AbstractEvent event) {
+ Type type = event.getType();
+ int count = getHandlerCount(type);
+ for (int i = 0; i < count; i++) {
+ EventHandler handler = getHandler(type, i);
+ type.fire(handler, event);
+ }
+ }
+
+ public EventHandler getHandler(AbstractEvent.Type eventKey, int index) {
+ assert (index < getHandlerCount(eventKey));
+ ArrayList<EventHandler> l = super.get(eventKey);
+ return l.get(index);
+ }
+
+ public int getHandlerCount(AbstractEvent.Type eventKey) {
+ ArrayList<EventHandler> l = super.get(eventKey);
+ if (l == null) {
+ return 0;
+ } else {
+ return l.size();
+ }
+ }
+
+ public void removeHandler(AbstractEvent.Type eventKey, EventHandler
handler) {
+ ArrayList<EventHandler> l = super.get(eventKey);
+ if (l != null) {
+ l.remove(handler);
+ }
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/event/shared/JsHandlerRegistry.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/event/shared/JsHandlerRegistry.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2008 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.shared;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.event.shared.AbstractEvent.Type;
+
+/**
+ * Default JavaScript handler registry. This is in the shared package so we
+ * don't have to make it public, should never be called outside of a GWT
runtime
+ * environment.
+ *
+ * Th JsHandlerRegistry makes use of the fact that in the large majority of
+ * cases, only one or two handlers are added for each event type.
Therefore,
+ * rather than storing handlers in a list of lists, we store then in a
single
+ * flattened array with an escape clause to handle the rare case where we
have
+ * more handlers then expected.
+ */
+class JsHandlerRegistry extends JavaScriptObject {
+
+ public static JsHandlerRegistry create() {
+ return (JsHandlerRegistry) JavaScriptObject.createObject();
+ }
+
+ /**
+ * Required constructor.
+ */
+ protected JsHandlerRegistry() {
+ }
+
+ public final void addHandler(AbstractEvent.Type eventKey, EventHandler
handler) {
+ // The base is the equivalent to a c pointer into the flattened
handler data
+ // structure.
+ int base = eventKey.hashCode();
+ int count = getCount(base);
+
+ // If we already have the maximum number of handlers we can store in
the
+ // flattened data structure, store the handlers in an external list
instead.
+ if (count == HandlerManager.EXPECTED_HANDLERS && isFlattened(base)) {
+ unflatten(base);
+ }
+ setHandler(base, count, handler, isFlattened(base));
+ setCount(base, count + 1);
+ }
+
+ public final void clearHandlers(Type<?, ?> type) {
+ int base = type.hashCode();
+ // Clearing handlers is relatively unusual, so the cost of
unflattening the
+ // handler list is justified by the smaller code.
+ unflatten(base);
+
+ // Replace the list of handlers.
+ setHandlerList(base + 1, JavaScriptObject.createArray());
+ setCount(base, 0);
+ }
+
+ public final void fireEvent(AbstractEvent event) {
+ Type type = event.getType();
+ int base = type.hashCode();
+ int count = getCount(base);
+ boolean isFlattened = isFlattened(base);
+
+ for (int i = 0; i < count; i++) {
+ // Gets the given handler to fire.
+ EventHandler handler = getHandler(base, i, isFlattened);
+
+ // Fires the handler.
+ type.fire(handler, event);
+ }
+ }
+
+ public final EventHandler getHandler(AbstractEvent.Type eventKey, int
index) {
+ int base = eventKey.hashCode();
+ int count = getCount(base);
+ if (index >= count) {
+ throw new IndexOutOfBoundsException("index: " + index);
+ }
+ return getHandler(base, index, isFlattened(base));
+ }
+
+ public final int getHandlerCount(AbstractEvent.Type eventKey) {
+ return getCount(eventKey.hashCode());
+ }
+
+ public final void removeHandler(AbstractEvent.Type eventKey,
+ EventHandler handler) {
+ int base = eventKey.hashCode();
+
+ // Removing a handler is unusual, so smaller code is preferable then
+ // handling both flat and dangling list of pointers.
+ if (isFlattened(base)) {
+ unflatten(base);
+ }
+ boolean result = removeHelper(base, handler);
+ // Hiding this behind an assertion as we'd rather not force the
compiler to
+ // have to include all handler.toString() instances.
+ assert result : handler + " did not exist";
+ }
+
+ private native int getCount(int index) /*-{
+ var count = this[index];
+ return count == null? 0:count;
+ }-*/;
+
+ private native EventHandler getHandler(int base, int index, boolean
flattened) /*-{
+ return flattened? this[base + 2 + index]: this[base + 1][index];
+ }-*/;
+
+ private native boolean isFlattened(int base) /*-{
+ return this[base + 1] == null;
+ }-*/;
+
+ private native boolean removeHelper(int base, EventHandler handler) /*-{
+ // Find the handler.
+ var count = this[base];
+ var handlerList = this[base + 1];
+ var handlerIndex = -1;
+ for(var index = 0; index < count; index++){
+ if(handlerList[index] == handler){
+ handlerIndex = index;
+ break;
+ }
+ }
+ if(handlerIndex == -1) {
+ return false;
+ }
+
+ // Remove the handler.
+ var last = count -1;
+ for(; handlerIndex < last; handlerIndex++){
+ handlerList[handlerIndex] = handlerList[handlerIndex+1]
+ }
+ handlerList[last] = null;
+ this[base] = this[base]-1;
+ return true;
+ }-*/;
+
+ private native void setCount(int index, int count) /*-{
+ this[index] = count;
+ }-*/;
+
+ private native void setHandler(int base, int index, EventHandler handler,
+ boolean flattened) /*-{
+ if(flattened) {
+ this[base + 2 + index] = handler;
+ } else {
+ this[base + 1][index] = handler;
+ }
+ }-*/;
+
+ private native void setHandlerList(int base, JavaScriptObject
handlerList) /*-{
+ this[base + 1] = handlerList;
+ }-*/;
+
+ private native void unflatten(int base) /*-{
+ var handlerList = {};
+ var count = this[base];
+ var start = base + 2;
+ for(var i = 0; i < count;i++){
+ handlerList[i] = this[start + i];
+ this[start + i] = null;
+ }
+ this[base + 1] = handlerList;
+ }-*/;
+}
\ No newline at end of file

Added: releases/1.6/events/user/src/com/google/gwt/user/client/ui/L.java
==============================================================================
--- (empty file)
+++ releases/1.6/events/user/src/com/google/gwt/user/client/ui/L.java Sat
Oct 18 15:33:44 2008
@@ -0,0 +1,328 @@
+/*
+ * Copyright 2008 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.ui;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.ErrorEvent;
+import com.google.gwt.event.dom.client.ErrorHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.HasAllFocusHandlers;
+import com.google.gwt.event.dom.client.HasAllKeyHandlers;
+import com.google.gwt.event.dom.client.HasChangeHandlers;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.dom.client.HasMouseDownHandlers;
+import com.google.gwt.event.dom.client.HasMouseMoveHandlers;
+import com.google.gwt.event.dom.client.HasMouseOutHandlers;
+import com.google.gwt.event.dom.client.HasMouseOverHandlers;
+import com.google.gwt.event.dom.client.HasMouseUpHandlers;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.event.dom.client.LoadEvent;
+import com.google.gwt.event.dom.client.LoadHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.dom.client.MouseWheelEvent;
+import com.google.gwt.event.dom.client.MouseWheelHandler;
+import com.google.gwt.event.dom.client.ScrollEvent;
+import com.google.gwt.event.dom.client.ScrollHandler;
+import com.google.gwt.event.logical.shared.HideEvent;
+import com.google.gwt.event.logical.shared.HideHandler;
+import com.google.gwt.event.shared.AbstractEvent;
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.HasHandlerManager;
+import com.google.gwt.event.shared.AbstractEvent.Type;
+
+import java.util.EventListener;
+
+/**
+ * Root of legacy listener support hierarchy.
+ *
+ * @param <ListenerType> listener type
+ *
+ */
+@Deprecated
+abstract class L<ListenerType> implements EventHandler {
+
+ public static class Change extends L<ChangeListener> implements
ChangeHandler {
+ @Deprecated
+ public static <EventSourceType extends HasHandlerManager &
HasChangeHandlers> void add(
+ EventSourceType source, ChangeListener listener) {
+ source.addChangeHandler(new Change(listener));
+ }
+
+ public static void remove(HasHandlerManager eventSource,
+ ChangeListener listener) {
+ baseRemove(eventSource, listener, ChangeEvent.TYPE);
+ }
+
+ protected Change(ChangeListener listener) {
+ super(listener);
+ }
+
+ public void onChange(ChangeEvent event) {
+ listener.onChange(source(event));
+ }
+ }
+ public static class Click extends L<ClickListener> implements
ClickHandler {
+ @Deprecated
+ public static <EventSourceType extends HasHandlerManager &
HasClickHandlers> void add(
+ EventSourceType source, ClickListener listener) {
+ source.addClickHandler(new Click(listener));
+ }
+
+ public static void remove(HasHandlerManager eventSource,
+ ClickListener listener) {
+ baseRemove(eventSource, listener, ClickEvent.TYPE);
+ }
+
+ protected Click(ClickListener listener) {
+ super(listener);
+ }
+
+ public void onClick(ClickEvent event) {
+ listener.onClick(source(event));
+ }
+ }
+
+ /*
+ * Handler wrapper for {@link FocusListener}.
+ */
+ public static class Focus extends L<FocusListener> implements
FocusHandler,
+ BlurHandler {
+
+ public static <EventSourceType extends HasHandlerManager &
HasAllFocusHandlers> void add(
+ EventSourceType source, FocusListener listener) {
+ HasAllFocusHandlers.Adaptor.addHandlers(source, new Focus(listener));
+ }
+
+ public static void remove(HasHandlerManager eventSource,
+ FocusListener listener) {
+ baseRemove(eventSource, listener, LoadEvent.TYPE, ErrorEvent.TYPE);
+ }
+
+ public Focus(FocusListener listener) {
+ super(listener);
+ }
+
+ public void onBlur(BlurEvent event) {
+ listener.onLostFocus(source(event));
+ }
+
+ public void onFocus(FocusEvent event) {
+ listener.onFocus(source(event));
+ }
+ }
+
+ public abstract static class Hide extends L<EventListener> implements
+ HideHandler {
+
+ public static void remove(HasHandlerManager eventSource,
+ EventListener listener) {
+ baseRemove(eventSource, listener, HideEvent.TYPE);
+ }
+
+ protected Hide(EventListener listener) {
+ super(listener);
+ }
+ }
+
+ public static class Load extends L<LoadListener> implements LoadHandler,
+ ErrorHandler {
+
+ public static void remove(HasHandlerManager eventSource,
+ LoadListener listener) {
+ baseRemove(eventSource, listener, LoadEvent.TYPE, ErrorEvent.TYPE);
+ }
+
+ protected Load(LoadListener listener) {
+ super(listener);
+ }
+
+ public void onError(ErrorEvent event) {
+ listener.onError(source(event));
+ }
+
+ public void onLoad(LoadEvent event) {
+ listener.onLoad(source(event));
+ }
+ }
+
+ public static class Mouse extends L<MouseListener> implements
+ MouseDownHandler, MouseUpHandler, MouseOutHandler, MouseOverHandler,
+ MouseMoveHandler {
+
+ public static <EventSourceType extends HasHandlerManager &
HasMouseDownHandlers & HasMouseUpHandlers & HasMouseOutHandlers &
HasMouseOverHandlers & HasMouseMoveHandlers> void add(
+ EventSourceType source, MouseListener listener) {
+ Mouse handlers = new Mouse(listener);
+ source.addMouseDownHandler(handlers);
+ source.addMouseUpHandler(handlers);
+ source.addMouseOutHandler(handlers);
+ source.addMouseOverHandler(handlers);
+ source.addMouseMoveHandler(handlers);
+ }
+
+ public static void remove(HasHandlerManager eventSource,
+ MouseListener listener) {
+ baseRemove(eventSource, listener, MouseDownEvent.TYPE,
MouseUpEvent.TYPE,
+ MouseOverEvent.TYPE, MouseOutEvent.TYPE);
+ }
+
+ protected Mouse(MouseListener listener) {
+ super(listener);
+ }
+
+ public void onMouseDown(MouseDownEvent event) {
+ listener.onMouseDown(source(event), event.getClientX(),
+ event.getScreenY());
+ }
+
+ public void onMouseMove(MouseMoveEvent event) {
+ listener.onMouseMove(source(event), event.getClientX(),
+ event.getClientY());
+ }
+
+ public void onMouseOut(MouseOutEvent event) {
+ listener.onMouseLeave(source(event));
+ }
+
+ public void onMouseOver(MouseOverEvent event) {
+ listener.onMouseEnter(source(event));
+ }
+
+ public void onMouseUp(MouseUpEvent event) {
+ listener.onMouseUp(source(event), event.getClientX(),
event.getClientY());
+ }
+ }
+
+ public static class MouseWheel extends L<MouseWheelListener> implements
+ MouseWheelHandler {
+ public static void remove(HasHandlerManager eventSource,
+ MouseWheelListener listener) {
+ baseRemove(eventSource, listener, MouseWheelEvent.TYPE);
+ }
+
+ protected MouseWheel(MouseWheelListener listener) {
+ super(listener);
+ }
+
+ public void onMouseWheel(MouseWheelEvent event) {
+ listener.onMouseWheel(source(event), new MouseWheelVelocity(
+ event.getNativeEvent()));
+ }
+ }
+
+ public static class Scroll extends L<ScrollListener> implements
ScrollHandler {
+
+ public static void remove(HasHandlerManager eventSource,
+ ScrollListener listener) {
+ baseRemove(eventSource, listener, ScrollEvent.TYPE, ErrorEvent.TYPE);
+ }
+
+ protected Scroll(ScrollListener listener) {
+ super(listener);
+ }
+
+ public void onScroll(ScrollEvent event) {
+ Widget source = source(event);
+ Element elem = source.getElement();
+ listener.onScroll(source(event), elem.getScrollLeft(),
+ elem.getScrollTop());
+ }
+ }
+
+ static class Keyboard extends L<KeyboardListener> implements
KeyDownHandler,
+ KeyUpHandler, KeyPressHandler {
+
+ public static <EventSourceType extends HasHandlerManager &
HasAllKeyHandlers> void add(
+ EventSourceType source, KeyboardListener listener) {
+ HasAllKeyHandlers.Adaptor.addHandlers(source, new
Keyboard(listener));
+ }
+
+ public static void remove(HasHandlerManager eventSource,
+ KeyboardListener listener) {
+ L.baseRemove(eventSource, listener, KeyDownEvent.TYPE,
KeyUpEvent.TYPE,
+ KeyPressEvent.TYPE);
+ }
+
+ public Keyboard(KeyboardListener listener) {
+ super(listener);
+ }
+
+ public void onKeyDown(KeyDownEvent event) {
+ listener.onKeyDown(source(event), (char) event.getKeyCode(),
+ event.getKeyModifiers());
+ }
+
+ public void onKeyPress(KeyPressEvent event) {
+ listener.onKeyPress(source(event),
+ (char) event.getNativeEvent().getKeyCode(),
event.getKeyModifiers());
+ }
+
+ public void onKeyUp(KeyUpEvent event) {
+ source(event);
+ listener.onKeyUp(source(event), (char) event.getKeyCode(),
+ event.getKeyModifiers());
+ }
+ }
+
+ static void baseRemove(HasHandlerManager eventSource, EventListener
listener,
+ Type... keys) {
+ HandlerManager manager = eventSource.getHandlerManager();
+ for (Type key : keys) {
+ int handlerCount = manager.getHandlerCount(key);
+ for (int i = 0; i < handlerCount; i++) {
+ EventHandler handler = manager.getHandler(key, i);
+ if (handler instanceof L && ((L)
handler).listener.equals(listener)) {
+ manager.removeHandler(key, handler);
+ }
+ }
+ }
+ }
+
+ /**
+ * Listener being wrapped.
+ */
+ protected final ListenerType listener;
+
+ protected L(ListenerType listener) {
+ this.listener = listener;
+ }
+
+ Widget source(AbstractEvent event) {
+ return (Widget) event.getSource();
+ }
+}

Added:
releases/1.6/events/user/src/com/google/gwt/user/client/ui/MousableWidget.java
==============================================================================
--- (empty file)
+++
releases/1.6/events/user/src/com/google/gwt/user/client/ui/MousableWidget.java
Sat Oct 18 15:33:44 2008
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 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.ui;
+
+import com.google.gwt.event.dom.client.HasAllMouseHandlers;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.dom.client.MouseWheelEvent;
+import com.google.gwt.event.dom.client.MouseWheelHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * Helper class to reduce code size in core widgets.
+ */
+class MousableWidget extends Widget implements SourcesMouseEvents,
+ HasAllMouseHandlers, SourcesMouseWheelEvents {
+
+ public HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
{
+ return addDomHandler(MouseDownEvent.TYPE, handler);
+ }
+
+ @Deprecated
+ public void addMouseListener(MouseListener listener) {
+ L.Mouse.add(this, listener);
+ }
+
+ public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
{
+ return addDomHandler(MouseMoveEvent.TYPE, handler);
+ }
+
+ public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
+ return addDomHandler(MouseOutEvent.TYPE, handler);
+ }
+
+ public HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
{
+ return addDomHandler(MouseOverEvent.TYPE, handler);
+ }
+
+ public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
+ return addDomHandler(MouseUpEvent.TYPE, handler);
+ }
+
+ public HandlerRegistration addMouseWheelHandler(MouseWheelHandler
handler) {
+ return addDomHandler(MouseWheelEvent.TYPE, handler);
+ }
+
+ @Deprecated
+ public void addMouseWheelListener(MouseWheelListener listener) {
+ addMouseWheelHandler(new L.MouseWheel(listener));
+ }
+
+ @Deprecated
+ public void removeMouseListener(MouseListener listener) {
+ L.Mouse.remove(this, listener);
+ }
+
+ @Deprecated
+ public void removeMouseWheelListener(MouseWheelListener listener

==============================================================================
Diff truncated at 200k characters

Reply all
Reply to author
Forward
0 new messages