Package com.google.gwt.event.shared
Class GwtEvent<H extends EventHandler>
- java.lang.Object
-
- com.google.web.bindery.event.shared.Event<H>
-
- com.google.gwt.event.shared.GwtEvent<H>
-
- Type Parameters:
H
- handler type
- Direct Known Subclasses:
AbstractHasData.RedrawEvent
,AttachEvent
,BeforeSelectionEvent
,CellPreviewEvent
,CloseEvent
,ColumnSortEvent
,DomEvent
,Event.NativePreviewEvent
,FormPanel.SubmitCompleteEvent
,FormPanel.SubmitEvent
,HighlightEvent
,InitializeEvent
,LoadingStateChangeEvent
,OpenEvent
,PlaceChangeEvent
,PlaceChangeRequestEvent
,RangeChangeEvent
,ResizeEvent
,RowCountChangeEvent
,RowHoverEvent
,SelectionChangeEvent
,SelectionEvent
,ShowRangeEvent
,ValueChangeEvent
,Window.ClosingEvent
,Window.ScrollEvent
public abstract class GwtEvent<H extends EventHandler> extends Event<H>
Root of all GWT widget and dom events sourced by aHandlerManager
. All GWT events are considered dead and should no longer be accessed once theHandlerManager
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GwtEvent.Type<H>
Type class used to register events with theHandlerManager
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
GwtEvent()
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
assertLive()
Asserts that the event still should be accessed.protected abstract void
dispatch(H handler)
Should only be called byHandlerManager
.abstract GwtEvent.Type<H>
getAssociatedType()
Returns theEvent.Type
used to register this event, allowing anEventBus
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.-
Methods inherited from class com.google.web.bindery.event.shared.Event
setSource, toDebugString, toString
-
-
-
-
Method Detail
-
getAssociatedType
public abstract GwtEvent.Type<H> getAssociatedType()
Description copied from class:Event
Returns theEvent.Type
used to register this event, allowing anEventBus
to find handlers of the appropriate class.- Specified by:
getAssociatedType
in classEvent<H extends EventHandler>
- Returns:
- the type
-
getSource
public java.lang.Object getSource()
Description copied from class:Event
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)
.- Overrides:
getSource
in classEvent<H extends EventHandler>
- Returns:
- object representing the source of this event
-
assertLive
protected void assertLive()
Asserts that the event still should be accessed. All events are considered to be "dead" after their original handler manager finishes firing them. An event can be revived by callingrevive()
.
-
dispatch
protected abstract void dispatch(H handler)
Should only be called byHandlerManager
. In other words, do not use or call.- Specified by:
dispatch
in classEvent<H extends EventHandler>
- Parameters:
handler
- handler- See Also:
EventBus.dispatchEvent(Event, Object)
-
isLive
protected final boolean isLive()
Is the event current live?- Returns:
- whether the event is live
-
kill
protected void kill()
Kill the event. After the event has been killed, users cannot really on its values or functions being available.
-
revive
protected void revive()
Revives the event. Used when recycling event instances.
-
overrideSource
void overrideSource(java.lang.Object source)
-
-