Class Event<H>
java.lang.Object
com.google.web.bindery.event.shared.Event<H>
- Type Parameters:
H
- interface implemented by handlers of this kind of event
- Direct Known Subclasses:
EntityProxyChange
,GwtEvent
Base Event object.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Type class used to register events with anEventBus
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Implemented by subclasses to to invoke their handlers in a type safe manner.abstract Event.Type
<H> Returns theEvent.Type
used to register this event, allowing anEventBus
to find handlers of the appropriate class.Returns the source for this event.protected void
Set the source that triggered this event.This is a method used primarily for debugging.toString()
The toString() for abstract event is overridden to avoid accidently including class literals in the compiled output.
-
Constructor Details
-
Event
protected Event()Constructor.
-
-
Method Details
-
getAssociatedType
Returns theEvent.Type
used to register this event, allowing anEventBus
to find handlers of the appropriate class.- Returns:
- the type
-
getSource
Returns the source for this event. The type and meaning of the source is arbitrary, and is most useful as a secondary key for handler registration. (SeeEventBus.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)
.- Returns:
- object representing the source of this event
-
toDebugString
This is a method used primarily for debugging. It gives a string representation of the event details. This does not override the toString method because the compiler cannot always optimize toString out correctly. Event types should override as desired.- Returns:
- a string representing the event's specifics.
-
toString
The toString() for abstract event is overridden to avoid accidently including class literals in the compiled output. UseEvent
#toDebugString to get more information about the event. -
dispatch
Implemented by subclasses to to invoke their handlers in a type safe manner. Intended to be called byEventBus.fireEvent(Event)
orEventBus.fireEventFromSource(Event, Object)
.- Parameters:
handler
- handler- See Also:
-
setSource
Set the source that triggered this event. Intended to be called by theEventBus
during dispatch.- Parameters:
source
- the source of this event.- See Also:
-