GWT sinkEvent

Here is a very good example using sinkEvent(). 

* GWT places global JavaScript event handlers at the window level for
your application and effectively handles the event mechanism itself –
look at the init() and sinkEvent() methods in the various DOMImpl*
classes.

* The sinkEvent() method is the internal process of registering that a
widget wishes to listen to particular events. Each event type you
wish a widget to listen to has to be added via its sinkEvent()
method. In the DOM implementation classes you’ll see that the
sinkEvent() method is implemented by placing an appropriate event
handler on the widget’s DOM element that points directly to GWT’s
global event handlers ($wnd.__dispatchEvent, for example).

* When an event happens on your widget that it has sunk, then the GWT
global event handler receives notification. That handler then performs
some validity checking (for example look at the IE6 implementation of
$wnd.__dispatchEvent which is created/defined in the DOMImplIE6 init()
method), and then, after jumping around between a few classes, the
widget’s onBrowserEvent() method is called.

* The code that you have written in the onBrowserEvent() method for
the event that has been passed is then executed.

gwt

sinkevent

Bubble

SinkEvent exists to allow a specific element say it wants to receive the following events. AS per event bubbling if the element doesnt consume the event its parent is given a go. THis continues until the top of the heirarchy is found or some element consumes the event and cancels the bubble.

From HERE

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s