GWT 2.7.0

com.google.web.bindery.event.shared
Class Event<H>

java.lang.Object
  extended by 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

public abstract class Event<H>
extends java.lang.Object

Base Event object.


Nested Class Summary
static class Event.Type<H>
          Type class used to register events with an EventBus.
 
Constructor Summary
protected Event()
          Constructor.
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Event

protected Event()
Constructor.

Method Detail

getAssociatedType

public abstract Event.Type<H> getAssociatedType()
Returns the Event.Type used to register this event, allowing an EventBus to find handlers of the appropriate class.

Returns:
the type

getSource

public java.lang.Object 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. (See EventBus.addHandlerToSource(com.google.web.bindery.event.shared.Event.Type, 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

public java.lang.String 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

public java.lang.String toString()
The toString() for abstract event is overridden to avoid accidently including class literals in the compiled output. Use Event #toDebugString to get more information about the event.

Overrides:
toString in class java.lang.Object

dispatch

protected abstract void dispatch(H handler)
Implemented by subclasses to to invoke their handlers in a type safe manner. Intended to be called by EventBus.fireEvent(Event) or EventBus.fireEventFromSource(Event, Object).

Parameters:
handler - handler
See Also:
EventBus.dispatchEvent(Event, Object)

setSource

protected void setSource(java.lang.Object source)
Set the source that triggered this event. Intended to be called by the EventBus during dispatch.

Parameters:
source - the source of this event.
See Also:
EventBus.fireEventFromSource(Event, Object), EventBus.setSourceOfEvent(Event, Object)

GWT 2.7.0