setSource(Object source) in class GwtEvent

17 views
Skip to first unread message

wahaha

unread,
Dec 6, 2011, 8:06:23 AM12/6/11
to Google Web Toolkit
in the class GwtEvent,there is a method setSource(Object source),its
not a public method,so we can not call it in subclass.
then what's the meaning of its existence.

Ed

unread,
Dec 6, 2011, 8:59:47 AM12/6/11
to Google Web Toolkit
I had the same problem and wrote my own event bus to be able to set
the source.
See also this issue: 6525
http://code.google.com/p/google-web-toolkit/issues/detail?id=6525
- Ed

Ed

unread,
Dec 6, 2011, 9:01:12 AM12/6/11
to Google Web Toolkit
BTW: the meaning is that the source should be set on the event bus,
see SimpleEventBus, through the constructor.
The bus is able to set the source. YOu aren't allowed to do that.
Such that you must change the bus to be able to change it (that's what
I did).
- Ed

On Dec 6, 2:06 pm, wahaha <il...@yahoo.com.cn> wrote:

Jens

unread,
Dec 6, 2011, 12:29:47 PM12/6/11
to google-we...@googlegroups.com
If you fire an event via the EventBus, you can fire it with or without a specific source (EventBus.fire() and EventBus.fireFromSource() ). The same applies to listening for events on the EventBus. You can listen for every Event of a given Type or you can only listen for Events of a given Type and from a specific source.

If you use a custom Event inside a custom Widget using Widget.addHandler() and Widget.fire(), GWT will set widget as source automatically.

So you don't really need access to setSource() because its already handled for you.

-- J.
Reply all
Reply to author
Forward
0 new messages