|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gwt.event.shared.HandlerManager
public class HandlerManager
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 | |
---|---|
HandlerManager(java.lang.Object source)
Creates a handler manager with a source to be set on all events fired via fireEvent(GwtEvent) . |
|
HandlerManager(java.lang.Object source,
boolean fireInReverseOrder)
Creates a handler manager with the given source, specifying the order in which handlers are fired. |
Method Summary | ||
---|---|---|
|
addHandler(GwtEvent.Type<H> type,
H handler)
Adds a handler. |
|
void |
fireEvent(GwtEvent<?> event)
Fires the given event to the handlers listening to the event's type. |
|
|
getHandler(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? |
|
|
removeHandler(GwtEvent.Type<H> type,
H handler)
Removes the given handler from the specified event type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HandlerManager(java.lang.Object source)
fireEvent(GwtEvent)
. Handlers will be fired in the order that they
are added.
source
- the default event sourcepublic HandlerManager(java.lang.Object source, boolean fireInReverseOrder)
source
- the event sourcefireInReverseOrder
- true to fire handlers in reverse orderMethod Detail |
---|
public <H extends EventHandler> HandlerRegistration addHandler(GwtEvent.Type<H> type, H handler)
H
- The type of handlertype
- the event type associated with this handlerhandler
- the handler
public void fireEvent(GwtEvent<?> event)
Any exceptions thrown by handlers will be bundled into a
UmbrellaException
and then re-thrown after all handlers have
completed. An exception thrown by a handler will not prevent other handlers
from executing.
Note, any subclass should be very careful about overriding this method, as adds/removes of handlers will not be safe except within this implementation.
fireEvent
in interface HasHandlers
event
- the eventpublic <H extends EventHandler> H getHandler(GwtEvent.Type<H> type, int index)
H
- the event handler typeindex
- the indextype
- the handler's event type
public int getHandlerCount(GwtEvent.Type<?> type)
type
- the event type
public boolean isEventHandled(GwtEvent.Type<?> e)
e
- the event type
public <H extends EventHandler> void removeHandler(GwtEvent.Type<H> type, H handler)
H
- handler typetype
- the event typehandler
- the handler
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |