Author: j...@google.com Date: Tue Jan 20 09:18:24 2009 New Revision: 4494 Added: releases/1.6/user/src/com/google/gwt/event/EventBase.gwt.xml releases/1.6/user/src/com/google/gwt/event/dom/DomEvent.gwt.xml releases/1.6/user/src/com/google/gwt/event/logical/LogicalEvent.gwt.xml Modified: releases/1.6/user/src/com/google/gwt/event/Event.gwt.xml releases/1.6/user/src/com/google/gwt/event/dom/client/DomEvent.java releases/1.6/user/src/com/google/gwt/event/logical/shared/BeforeSelectionEvent.java releases/1.6/user/src/com/google/gwt/event/logical/shared/CloseEvent.java releases/1.6/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java releases/1.6/user/src/com/google/gwt/event/logical/shared/OpenEvent.java releases/1.6/user/src/com/google/gwt/event/logical/shared/ResizeEvent.java releases/1.6/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java releases/1.6/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java releases/1.6/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java releases/1.6/user/src/com/google/gwt/event/shared/HandlerManager.java releases/1.6/user/src/com/google/gwt/event/shared/HasHandlers.java releases/1.6/user/src/com/google/gwt/user/User.gwt.xml releases/1.6/user/src/com/google/gwt/user/client/impl/HistoryImpl.java releases/1.6/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java releases/1.6/user/src/com/google/gwt/user/client/ui/Widget.java releases/1.6/user/src/com/google/gwt/user/datepicker/client/DateChangeEvent.java releases/1.6/user/test/com/google/gwt/user/client/ui/DisclosurePanelTest.java releases/1.6/user/test/com/google/gwt/user/datepicker/client/DateChangeEventTest.java
Log: Refactors event infrastructure, to simplify the firing mechanism and allow users to cherry-pick the non-Dom events. Patch by: jgw Review by: ecc, rjrjr Modified: releases/1.6/user/src/com/google/gwt/event/Event.gwt.xml ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/Event.gwt.xml (original) +++ releases/1.6/user/src/com/google/gwt/event/Event.gwt.xml Tue Jan 20 09:18:24 2009 @@ -1,6 +1,5 @@ <module> - <!-- This module could be broken down into much finer detail --> - <source path="shared"/> - <source path="logical/shared"/> - <source path="dom/client"/> -</module> \ No newline at end of file + <inherits name="com.google.gwt.event.EventBase" /> + <inherits name="com.google.gwt.event.dom.DomEvent" /> + <inherits name="com.google.gwt.event.logical.LogicalEvent" /> +</module> Added: releases/1.6/user/src/com/google/gwt/event/EventBase.gwt.xml ============================================================================== --- (empty file) +++ releases/1.6/user/src/com/google/gwt/event/EventBase.gwt.xml Tue Jan 20 09:18:24 2009 @@ -0,0 +1,5 @@ +<module> + <inherits name="com.google.gwt.core.Core" /> + + <source path="shared" /> +</module> Added: releases/1.6/user/src/com/google/gwt/event/dom/DomEvent.gwt.xml ============================================================================== --- (empty file) +++ releases/1.6/user/src/com/google/gwt/event/dom/DomEvent.gwt.xml Tue Jan 20 09:18:24 2009 @@ -0,0 +1,6 @@ +<module> + <inherits name="com.google.gwt.event.EventBase" /> + <inherits name="com.google.gwt.user.Dom" /> + + <source path="client"/> +</module> Modified: releases/1.6/user/src/com/google/gwt/event/dom/client/DomEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/dom/client/DomEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/dom/client/DomEvent.java Tue Jan 20 09:18:24 2009 @@ -17,7 +17,7 @@ import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; +import com.google.gwt.event.shared.HasHandlers; import com.google.gwt.user.client.Event; /** @@ -31,6 +31,7 @@ */ public abstract class DomEvent<H extends EventHandler> extends GwtEvent<H> implements HasNativeEvent { + /** * Type class used by dom event subclasses. Type is specialized for dom in * order to carry information about the native event. @@ -53,7 +54,7 @@ /** * This constructor allows dom event types to be triggered by the - * {...@link DomEvent#fireNativeEvent(Event, HandlerManager)} method. It should + * {...@link DomEvent#fireNativeEvent(Event, HasHandlers)} method. It should * only be used by implementors supporting new dom events. * <p> * Any such dom event type must act as a flyweight around a native event @@ -109,7 +110,7 @@ * @param handlers the event manager containing the handlers to fire (may be * null) */ - public static void fireNativeEvent(Event nativeEvent, HandlerManager handlers) { + public static void fireNativeEvent(Event nativeEvent, HasHandlers handlers) { assert nativeEvent != null : "nativeEvent must not be null"; if (registered != null && handlers != null) { final DomEvent.Type<?> typeKey = registered.unsafeGet(nativeEvent.getType()); Added: releases/1.6/user/src/com/google/gwt/event/logical/LogicalEvent.gwt.xml ============================================================================== --- (empty file) +++ releases/1.6/user/src/com/google/gwt/event/logical/LogicalEvent.gwt.xml Tue Jan 20 09:18:24 2009 @@ -0,0 +1,5 @@ +<module> + <inherits name="com.google.gwt.event.EventBase" /> + + <source path="shared" /> +</module> Modified: releases/1.6/user/src/com/google/gwt/event/logical/shared/BeforeSelectionEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/logical/shared/BeforeSelectionEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/logical/shared/BeforeSelectionEvent.java Tue Jan 20 09:18:24 2009 @@ -16,7 +16,6 @@ package com.google.gwt.event.logical.shared; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; /** * Represents a before selection event. @@ -45,13 +44,10 @@ HasBeforeSelectionHandlers<I> source, I item) { // If no handlers exist, then type can be null. if (TYPE != null) { - HandlerManager handlers = source.getHandlers(); - if (handlers != null) { - BeforeSelectionEvent<I> event = new BeforeSelectionEvent<I>(); - event.setItem(item); - handlers.fireEvent(event); - return event; - } + BeforeSelectionEvent<I> event = new BeforeSelectionEvent<I>(); + event.setItem(item); + source.fireEvent(event); + return event; } return null; } Modified: releases/1.6/user/src/com/google/gwt/event/logical/shared/CloseEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/logical/shared/CloseEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/logical/shared/CloseEvent.java Tue Jan 20 09:18:24 2009 @@ -16,7 +16,6 @@ package com.google.gwt.event.logical.shared; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; /** * Represents a close event. @@ -53,11 +52,8 @@ public static <T> void fire(HasCloseHandlers<T> source, T target, boolean autoClosed) { if (TYPE != null) { - HandlerManager handlers = source.getHandlers(); - if (handlers != null) { - CloseEvent<T> event = new CloseEvent<T>(target, autoClosed); - handlers.fireEvent(event); - } + CloseEvent<T> event = new CloseEvent<T>(target, autoClosed); + source.fireEvent(event); } } Modified: releases/1.6/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java Tue Jan 20 09:18:24 2009 @@ -16,7 +16,6 @@ package com.google.gwt.event.logical.shared; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HasHandlers; /** @@ -42,11 +41,8 @@ public static <V, S extends HasHighlightHandlers<V> & HasHandlers> void fire( S source, V highlighted) { if (TYPE != null) { - HandlerManager handlers = source.getHandlers(); - if (handlers != null) { - HighlightEvent<V> event = new HighlightEvent<V>(highlighted); - handlers.fireEvent(event); - } + HighlightEvent<V> event = new HighlightEvent<V>(highlighted); + source.fireEvent(event); } } Modified: releases/1.6/user/src/com/google/gwt/event/logical/shared/OpenEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/logical/shared/OpenEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/logical/shared/OpenEvent.java Tue Jan 20 09:18:24 2009 @@ -16,7 +16,6 @@ package com.google.gwt.event.logical.shared; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; /** * Represents a open event. @@ -40,11 +39,8 @@ */ public static <T> void fire(HasOpenHandlers<T> source, T target) { if (TYPE != null) { - HandlerManager handlers = source.getHandlers(); - if (handlers != null) { - OpenEvent<T> event = new OpenEvent<T>(target); - handlers.fireEvent(event); - } + OpenEvent<T> event = new OpenEvent<T>(target); + source.fireEvent(event); } } Modified: releases/1.6/user/src/com/google/gwt/event/logical/shared/ResizeEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/logical/shared/ResizeEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/logical/shared/ResizeEvent.java Tue Jan 20 09:18:24 2009 @@ -17,7 +17,6 @@ package com.google.gwt.event.logical.shared; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HasHandlers; /** @@ -41,11 +40,8 @@ public static <S extends HasResizeHandlers & HasHandlers> void fire(S source, int width, int height) { if (TYPE != null) { - HandlerManager handlers = source.getHandlers(); - if (handlers != null) { - ResizeEvent event = new ResizeEvent(width, height); - handlers.fireEvent(event); - } + ResizeEvent event = new ResizeEvent(width, height); + source.fireEvent(event); } } Modified: releases/1.6/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java Tue Jan 20 09:18:24 2009 @@ -16,7 +16,6 @@ package com.google.gwt.event.logical.shared; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; /** * Represents a selection event. @@ -41,11 +40,8 @@ */ public static <I> void fire(HasSelectionHandlers<I> source, I selectedItem) { if (TYPE != null) { - HandlerManager handlers = source.getHandlers(); - if (handlers != null) { - SelectionEvent<I> event = new SelectionEvent<I>(selectedItem); - handlers.fireEvent(event); - } + SelectionEvent<I> event = new SelectionEvent<I>(selectedItem); + source.fireEvent(event); } } Modified: releases/1.6/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java Tue Jan 20 09:18:24 2009 @@ -16,7 +16,6 @@ package com.google.gwt.event.logical.shared; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HasHandlers; /** @@ -44,11 +43,8 @@ public static <V, S extends HasShowRangeHandlers<V> & HasHandlers> void fire( S source, V start, V end) { if (TYPE != null) { - HandlerManager handlers = source.getHandlers(); - if (handlers != null) { - ShowRangeEvent<V> event = new ShowRangeEvent<V>(start, end); - handlers.fireEvent(event); - } + ShowRangeEvent<V> event = new ShowRangeEvent<V>(start, end); + source.fireEvent(event); } } Modified: releases/1.6/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java Tue Jan 20 09:18:24 2009 @@ -16,7 +16,6 @@ package com.google.gwt.event.logical.shared; import com.google.gwt.event.shared.GwtEvent; -import com.google.gwt.event.shared.HandlerManager; /** * Represents a value change event. @@ -40,11 +39,8 @@ */ public static <I> void fire(HasValueChangeHandlers<I> source, I value) { if (TYPE != null) { - HandlerManager handlers = source.getHandlers(); - if (handlers != null && handlers.isEventHandled(TYPE)) { - ValueChangeEvent<I> event = new ValueChangeEvent<I>(value); - handlers.fireEvent(event); - } + ValueChangeEvent<I> event = new ValueChangeEvent<I>(value); + source.fireEvent(event); } } @@ -62,7 +58,7 @@ I oldValue, I newValue) { if (shouldFire(source, oldValue, newValue)) { ValueChangeEvent<I> event = new ValueChangeEvent<I>(newValue); - source.getHandlers().fireEvent(event); + source.fireEvent(event); } } @@ -90,7 +86,7 @@ */ protected static <I> boolean shouldFire(HasValueChangeHandlers<I> source, I oldValue, I newValue) { - return TYPE != null && source.getHandlers() != null && oldValue != newValue + return TYPE != null && oldValue != newValue && (oldValue == null || !oldValue.equals(newValue)); } Modified: releases/1.6/user/src/com/google/gwt/event/shared/HandlerManager.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/shared/HandlerManager.java (original) +++ releases/1.6/user/src/com/google/gwt/event/shared/HandlerManager.java Tue Jan 20 09:18:24 2009 @@ -15,15 +15,14 @@ */ package com.google.gwt.event.shared; -import com.google.gwt.event.shared.GwtEvent.Type; -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.ui.RootPanel; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.google.gwt.event.shared.GwtEvent.Type; +import com.google.gwt.user.client.Command; + /** * Manager responsible for adding handlers to event sources and firing those * handlers on passed in events. @@ -139,6 +138,7 @@ } else { doAdd(type, handler); } + return new DefaultHandlerRegistration(this, type, handler); } @@ -151,7 +151,6 @@ * * @param event the event */ - public void fireEvent(GwtEvent<?> event) { // If it not live we should revive it. if (!event.isLive()) { @@ -244,8 +243,7 @@ * @return a map of all handlers in this handler manager */ Map<GwtEvent.Type<?>, ArrayList<?>> createHandlerInfo() { - HandlerManager manager = RootPanel.get().getHandlers(); - return manager.registry.map; + return registry.map; } private void defer(Command command) { Modified: releases/1.6/user/src/com/google/gwt/event/shared/HasHandlers.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/event/shared/HasHandlers.java (original) +++ releases/1.6/user/src/com/google/gwt/event/shared/HasHandlers.java Tue Jan 20 09:18:24 2009 @@ -13,20 +13,29 @@ * License for the specific language governing permissions and limitations under * the License. */ - package com.google.gwt.event.shared; +import com.google.gwt.event.shared.GwtEvent.Type; /** - * An object that implements this interface has a collection of handlers stored - * in a {...@link HandlerManager}. + * An object that implements this interface has a collection of event handlers + * associated with it. */ - public interface HasHandlers { + + /** + * Determines whether the there are any handlers of the given type. This may + * be used to avoid creating events for which there are no handlers. + * + * @param type the type of event to be queried + * @return <code>true</code> if there are any handlers for this event type + */ + boolean isEventHandled(Type<?> type); + /** - * Gets this object's handlers. May return null if there are no handlers. + * Fires the given event to all the appropriate handlers. * - * @return the handlers + * @param event the event to be fired */ - HandlerManager getHandlers(); + void fireEvent(GwtEvent<?> event); } Modified: releases/1.6/user/src/com/google/gwt/user/User.gwt.xml ============================================================================== --- releases/1.6/user/src/com/google/gwt/user/User.gwt.xml (original) +++ releases/1.6/user/src/com/google/gwt/user/User.gwt.xml Tue Jan 20 09:18:24 2009 @@ -41,7 +41,7 @@ <inherits name="com.google.gwt.user.Tree"/> <inherits name="com.google.gwt.user.Hyperlink"/> <inherits name="com.google.gwt.user.datepicker.DatePicker"/> - <super-source path="translatable"/> - <source path="client"/> - + + <super-source path="translatable"/> + <source path="client"/> </module> Modified: releases/1.6/user/src/com/google/gwt/user/client/impl/HistoryImpl.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/user/client/impl/HistoryImpl.java (original) +++ releases/1.6/user/src/com/google/gwt/user/client/impl/HistoryImpl.java Tue Jan 20 09:18:24 2009 @@ -20,9 +20,11 @@ import com.google.gwt.event.logical.shared.HasValueChangeHandlers; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; +import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.event.shared.HasHandlers; +import com.google.gwt.event.shared.GwtEvent.Type; /** * Native implementation associated with @@ -54,6 +56,10 @@ return handlers.addHandler(ValueChangeEvent.getType(), handler); } + public void fireEvent(GwtEvent<?> event) { + handlers.fireEvent(event); + } + /** * Fires the {...@link ValueChangeEvent} to all handlers with the given tokens. */ @@ -66,6 +72,10 @@ } public abstract boolean init(); + + public boolean isEventHandled(Type<?> type) { + return handlers.isEventHandled(type); + } public final void newItem(String historyToken, boolean issueEvent) { historyToken = (historyToken == null) ? "" : historyToken; Modified: releases/1.6/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java (original) +++ releases/1.6/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java Tue Jan 20 09:18:24 2009 @@ -528,7 +528,7 @@ @SuppressWarnings("unchecked") static <H extends EventHandler> void baseRemove(Widget eventSource, EventListener listener, Type... keys) { - HandlerManager manager = eventSource.getHandlers(); + HandlerManager manager = eventSource.getHandlerManager(); if (manager != null) { // This is a direct copy of the baseRemove from // com.google.gwt.user.client.ListenerWrapper. Change in parallel. Modified: releases/1.6/user/src/com/google/gwt/user/client/ui/Widget.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/user/client/ui/Widget.java (original) +++ releases/1.6/user/src/com/google/gwt/user/client/ui/Widget.java Tue Jan 20 09:18:24 2009 @@ -32,6 +32,7 @@ * {...@link com.google.gwt.user.client.ui.Panel panels}. */ public class Widget extends UIObject implements EventListener, HasHandlers { + /** * A bit-map of the events that should be sunk when the widget is attached to * the DOM. (We delay the sinking of events to improve startup performance.) @@ -45,13 +46,10 @@ private Widget parent; private HandlerManager handlerManager; - /** - * Returns this widget's {...@link HandlerManager} used for event management. - * - * @return the handler manager - */ - public final HandlerManager getHandlers() { - return handlerManager; + public void fireEvent(GwtEvent<?> event) { + if (handlerManager != null) { + handlerManager.fireEvent(event); + } } /** @@ -74,16 +72,6 @@ return attached; } - /** - * Returns true if the widget has handlers of the given type. Used by some - * widget implementations to be lazy about initializing dom event handlers - * (e.g. a click handler on a checkbox) until the first relevant logical event - * handler is attached (e.g. in the <code>addValueChangeHandler</code> - * method). - * - * @param type the event type - * @return true if the widget has handlers of the give type - */ public boolean isEventHandled(GwtEvent.Type<?> type) { return handlerManager != null && handlerManager.isEventHandled(type); } @@ -106,7 +94,7 @@ return; } } - DomEvent.fireNativeEvent(event, handlerManager); + DomEvent.fireNativeEvent(event, this); } /** @@ -215,18 +203,6 @@ } /** - * Fires an event. Usually used when passing an event from one source to - * another. - * - * @param event the event - */ - protected void fireEvent(GwtEvent<?> event) { - if (handlerManager != null) { - handlerManager.fireEvent(event); - } - } - - /** * Has this widget ever been attached? * * @return true if this widget ever been attached to the DOM, false otherwise @@ -326,6 +302,10 @@ HandlerManager ensureHandlers() { return handlerManager == null ? handlerManager = new HandlerManager(this) : handlerManager; + } + + HandlerManager getHandlerManager() { + return handlerManager; } /** Modified: releases/1.6/user/src/com/google/gwt/user/datepicker/client/DateChangeEvent.java ============================================================================== --- releases/1.6/user/src/com/google/gwt/user/datepicker/client/DateChangeEvent.java (original) +++ releases/1.6/user/src/com/google/gwt/user/datepicker/client/DateChangeEvent.java Tue Jan 20 09:18:24 2009 @@ -41,7 +41,7 @@ public static <S extends HasValueChangeHandlers<Date> & HasHandlers> void fireIfNotEqualDates( S source, Date oldValue, Date newValue) { if (ValueChangeEvent.shouldFire(source, oldValue, newValue)) { - source.getHandlers().fireEvent(new DateChangeEvent(newValue)); + source.fireEvent(new DateChangeEvent(newValue)); } } Modified: releases/1.6/user/test/com/google/gwt/user/client/ui/DisclosurePanelTest.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/user/client/ui/DisclosurePanelTest.java (original) +++ releases/1.6/user/test/com/google/gwt/user/client/ui/DisclosurePanelTest.java Tue Jan 20 09:18:24 2009 @@ -81,14 +81,14 @@ public void testEvents() { final DisclosurePanel panel = createTestPanel(); - assertEquals(1, panel.getHandlers().getHandlerCount(CloseEvent.getType())); + assertEquals(1, panel.getHandlerManager().getHandlerCount(CloseEvent.getType())); panel.addCloseHandler(new CloseHandler<DisclosurePanel>() { public void onClose(CloseEvent<DisclosurePanel> event) { // for now nothing. } }); - assertEquals(2, panel.getHandlers().getHandlerCount(CloseEvent.getType())); + assertEquals(2, panel.getHandlerManager().getHandlerCount(CloseEvent.getType())); } /** @@ -126,8 +126,8 @@ panel.addEventHandler(handleA); panel.addEventHandler(handleB); // There is one to begin with. - assertEquals(3, panel.getHandlers().getHandlerCount(CloseEvent.getType())); - assertEquals(3, panel.getHandlers().getHandlerCount(OpenEvent.getType())); + assertEquals(3, panel.getHandlerManager().getHandlerCount(CloseEvent.getType())); + assertEquals(3, panel.getHandlerManager().getHandlerCount(OpenEvent.getType())); panel.setOpen(true); // We expect onOpen to fire and onClose to not fire. @@ -144,8 +144,8 @@ aDidFire[OPEN] = bDidFire[CLOSE] = false; panel.removeEventHandler(handleB); - assertEquals(2, panel.getHandlers().getHandlerCount(OpenEvent.getType())); - assertEquals(2, panel.getHandlers().getHandlerCount(CloseEvent.getType())); + assertEquals(2, panel.getHandlerManager().getHandlerCount(OpenEvent.getType())); + assertEquals(2, panel.getHandlerManager().getHandlerCount(CloseEvent.getType())); panel.setOpen(true); panel.setOpen(false); Modified: releases/1.6/user/test/com/google/gwt/user/datepicker/client/DateChangeEventTest.java ============================================================================== --- releases/1.6/user/test/com/google/gwt/user/datepicker/client/DateChangeEventTest.java (original) +++ releases/1.6/user/test/com/google/gwt/user/datepicker/client/DateChangeEventTest.java Tue Jan 20 09:18:24 2009 @@ -18,8 +18,10 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; +import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.event.shared.GwtEvent.Type; import com.google.gwt.user.client.ui.DateValueChangeTester; import com.google.gwt.user.client.ui.HasValue; @@ -41,6 +43,10 @@ return handlers.addHandler(ValueChangeEvent.getType(), handler); } + public void fireEvent(GwtEvent<?> event) { + handlers.fireEvent(event); + } + public HandlerManager getHandlers() { return handlers; } @@ -49,6 +55,10 @@ return value; } + public boolean isEventHandled(Type<?> type) { + return handlers.isEventHandled(type); + } + public void setValue(Date value) { setValue(value, false); } @@ -65,5 +75,4 @@ public void testValueChangeViaHasValue() { new DateValueChangeTester(new MockWidget()).run(); } - } --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---