Wednesday, June 30, 2010

Re: GWTEvent, sinking own events

On Wed, Jun 30, 2010 at 4:41 AM, Johan Rydberg <> wrote:
On 6/30/10 11:57 AM, Roy wrote:If the answer is that View A *will* catch its own event, any

recommendations on how to identify the event in such a way that View A
knows it was the originator?
Maybe you can use this;

If the event source isn't a widget, the result will be null.

Consider adding a parameter to the event that identifies the event source. For example:

eventBus.fireEvent(new MyEvent(MyIndentifier myIndentifier));

Perhaps MyIdentifier is an enum.

Then, in the event class:

public void MyEvent(MyIdentifier myIdentifier) {
this.myIdentifier = myIdentifier;

public MyIdentifier getMyIdentifier() {
return myIdentifier;

Then, in the event handler:

switch e.getMyIdentifier {
 case MYIDENTIFIER1: break;

Also, see the current thread subject "How to simplify your GwtEvent classes and have fun doing it!" for another implementation technique.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment