H
- interface implemented by handlers of this kind of eventpublic abstract class Event<H>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Event.Type<H>
Type class used to register events with an
EventBus . |
Modifier | Constructor and Description |
---|---|
protected |
Event()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
dispatch(H handler)
Implemented by subclasses to to invoke their handlers in a type safe
manner.
|
abstract Event.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 void |
setSource(java.lang.Object source)
Set the source that triggered this event.
|
java.lang.String |
toDebugString()
This is a method used primarily for debugging.
|
java.lang.String |
toString()
The toString() for abstract event is overridden to avoid accidently
including class literals in the compiled output.
|
public abstract Event.Type<H> getAssociatedType()
Event.Type
used to register this event, allowing an
EventBus
to find handlers of the appropriate class.public java.lang.Object getSource()
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)
.
public java.lang.String toDebugString()
public java.lang.String toString()
Event
#toDebugString to get more information about the event.toString
in class java.lang.Object
protected abstract void dispatch(H handler)
EventBus.fireEvent(Event)
or
EventBus.fireEventFromSource(Event, Object)
.handler
- handlerEventBus.dispatchEvent(Event, Object)
protected void setSource(java.lang.Object source)
EventBus
during dispatch.source
- the source of this event.EventBus.fireEventFromSource(Event, Object)
,
EventBus.setSourceOfEvent(Event, Object)