Package com.google.gwt.event.shared
Class HandlerManager
java.lang.Object
com.google.gwt.event.shared.HandlerManager
- All Implemented Interfaces:
HasHandlers
Manager responsible for adding handlers to event sources and firing those
handlers on passed in events. Primitive ancestor of
EventBus
, and
used at the core of {com.google.gwt.user.client.ui.Widget}.
While widget authors should continue to use
Widget.addDomHandler(EventHandler, com.google.gwt.event.dom.client.DomEvent.Type)
and
Widget.addHandler(EventHandler, com.google.gwt.event.shared.GwtEvent.Type)
, application developers are strongly discouraged from using a HandlerManager
instance as a global event dispatch mechanism.
-
Constructor Summary
ConstructorDescriptionHandlerManager
(Object source) Creates a handler manager with a source to be set on all events fired viafireEvent(GwtEvent)
.HandlerManager
(Object source, boolean fireInReverseOrder) Creates a handler manager with the given source, specifying the order in which handlers are fired. -
Method Summary
Modifier and TypeMethodDescription<H extends EventHandler>
HandlerRegistrationaddHandler
(GwtEvent.Type<H> type, H handler) Adds a handler.void
Fires the given event to the handlers listening to the event's type.<H extends EventHandler>
HgetHandler
(GwtEvent.Type<H> type, int index) Gets the handler at the given index.int
getHandlerCount
(GwtEvent.Type<?> type) Gets the number of handlers listening to the event type.boolean
isEventHandled
(GwtEvent.Type<?> e) Does this handler manager handle the given event type?<H extends EventHandler>
voidremoveHandler
(GwtEvent.Type<H> type, H handler) Removes the given handler from the specified event type.
-
Constructor Details
-
HandlerManager
Creates a handler manager with a source to be set on all events fired viafireEvent(GwtEvent)
. Handlers will be fired in the order that they are added.- Parameters:
source
- the default event source
-
HandlerManager
Creates a handler manager with the given source, specifying the order in which handlers are fired.- Parameters:
source
- the event sourcefireInReverseOrder
- true to fire handlers in reverse order
-
-
Method Details