H
- handler typepublic abstract class GwtEvent<H extends EventHandler> extends Event<H>
HandlerManager
.
All GWT events are considered dead and should no longer be accessed once the
HandlerManager
which originally fired the event finishes with it.
That is, don't hold on to event objects outside of your handler methods.
There is no need for an application's custom event types to extend GwtEvent.
Prefer Event
instead.
Modifier and Type | Class and Description |
---|---|
static class |
GwtEvent.Type<H>
Type class used to register events with the
HandlerManager . |
Modifier | Constructor and Description |
---|---|
protected |
GwtEvent()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertLive()
Asserts that the event still should be accessed.
|
protected abstract void |
dispatch(H handler)
Should only be called by
HandlerManager . |
abstract GwtEvent.Type<H> |
getAssociatedType()
Returns the
Event.Type used to register this event, allowing an
EventBus to find handlers of the appropriate class. |
java.lang.Object |
getSource()
Returns the source for this event.
|
protected boolean |
isLive()
Is the event current live?
|
protected void |
kill()
Kill the event.
|
(package private) void |
overrideSource(java.lang.Object source) |
protected void |
revive()
Revives the event.
|
setSource, toDebugString, toString
public abstract GwtEvent.Type<H> getAssociatedType()
Event
Event.Type
used to register this event, allowing an
EventBus
to find handlers of the appropriate class.getAssociatedType
in class Event<H extends EventHandler>
public java.lang.Object getSource()
Event
EventBus.addHandlerToSource(com.google.web.bindery.event.shared.Event.Type<H>, java.lang.Object, H)
, which allows a handler to
register for events of a particular type, tied to a particular source.)
Note that the source is actually set at dispatch time, e.g. via
EventBus.fireEventFromSource(Event, Object)
.
getSource
in class Event<H extends EventHandler>
protected void assertLive()
revive()
.protected abstract void dispatch(H handler)
HandlerManager
. In other words, do not use
or call.dispatch
in class Event<H extends EventHandler>
handler
- handlerEventBus.dispatchEvent(Event, Object)
protected final boolean isLive()
protected void kill()
protected void revive()
void overrideSource(java.lang.Object source)