API Reference 0.3.24dart_web_toolkit_eventDwtEvent<H>

DwtEvent<H> abstract class

Root of all GWT widget and dom events sourced by a {@link HandlerManager}. All GWT events are considered dead and should no longer be accessed once the {@link 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 {@link Event} instead.

@param <H> handler type

abstract class DwtEvent<H> extends IEvent<H> {

 bool _dead = false;

 Object getSource() {
   assertLive();
   return super.getSource();
 }

 /**
  * 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 calling {@link GwtEvent#revive()}.
  */
 void assertLive() {
   assert (!_dead) ; //: "This event has already finished being processed by its original handler manager, so you can no longer access it";
 }

 /**
  * Is the event current live?
  *
  * @return whether the event is live
  */
 bool isLive() {
   return !_dead;
 }

 /**
  * Kill the event. After the event has been killed, users cannot really on its
  * values or functions being available.
  */
 void kill() {
   _dead = true;
   setSource(null);
 }

 /**
  * Revives the event. Used when recycling event instances.
  */
 void revive() {
   _dead = false;
   setSource(null);
 }

 void overrideSource(Object source) {
   super.setSource(source);
 }
}

Extends

IEvent<H> > DwtEvent<H>

Subclasses

AttachEvent, BeforeSelectionEvent<T>, CloseEvent<T>, ClosingEvent, DomEvent, NativePreviewEvent, OpenEvent<T>, PlaceChangeEvent, PlaceChangeRequestEvent, ResizeEvent, SelectionEvent<T>, ValueChangeEvent<T>

Methods

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 calling {@link GwtEvent#revive()}.

void assertLive() {
 assert (!_dead) ; //: "This event has already finished being processed by its original handler manager, so you can no longer access it";
}

abstract void dispatch(H handler) #

inherited from IEvent

Implemented by subclasses to invoke their handlers in a type safe manner. Intended to be called by EventBus#fireEvent(Event) or EventBus#fireEventFromSource(Event, Object).

@param handler handler @see EventBus#dispatchEvent(Event, Object)

abstract EventType<H> getAssociatedType() #

inherited from IEvent

Returns the EventType used to register this event, allowing an EventBus to find handlers of the appropriate class.

@return the type

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, 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).

@return object representing the source of this event

docs inherited from IEvent<H>
Object getSource() {
 assertLive();
 return super.getSource();
}

bool isLive() #

Is the event current live?

@return whether the event is live

bool isLive() {
 return !_dead;
}

void kill() #

Kill the event. After the event has been killed, users cannot really on its values or functions being available.

void kill() {
 _dead = true;
 setSource(null);
}

void overrideSource(Object source) #

void overrideSource(Object source) {
 super.setSource(source);
}

void revive() #

Revives the event. Used when recycling event instances.

void revive() {
 _dead = false;
 setSource(null);
}

void setSource(source) #

inherited from IEvent

Set the source that triggered this event. Intended to be called by the EventBus during dispatch.

@param source the source of this event. @see EventBus#fireEventFromSource(Event, Object) @see EventBus#setSourceOfEvent(Event, Object)

void setSource(dynamic source) {
 this._source = source;
}

String toString() #

inherited from IEvent

The toString() for abstract event is overridden to avoid accidently including class literals in the the compiled output. Use Event

toDebugString to get more information about the event.

String toString() {
 return "An event type";
}