This content has been marked as final.
Show 4 replies
-
1. Re: Quick Observer Questions
jamathison May 1, 2008 2:09 AM (in response to darthmaul)The object that you pass in to raiseEvent will get passed in to your observer.
Here is one of my event handlers:
@Observer("deviceImported") public void importObserver (Device device) { int id = device.getId(); // do stuff.... }
And the raiseEvent that invokes it:
Device device = new Device(); // do stuff to device, then fire event... Events.instance().raiseEvent ("deviceImported", device);
-
2. Re: Quick Observer Questions
darthmaul May 1, 2008 9:46 AM (in response to darthmaul)Thanks, Al. That makes sense. Just to follow up, does the event get raised precisely when you call raiseEvent? Or at the completion of the method where raiseEvent is called?
Also, if you have tested your component, how do you do it?
Thanks again.
-
3. Re: Quick Observer Questions
danielc.roth May 1, 2008 2:24 PM (in response to darthmaul)The event is raised directly. You'll see that if you set a breakpoint before the Events.instance()... and one in the observer method, and then just step.
-
4. Re: Quick Observer Questions
binnyg May 12, 2008 9:11 PM (in response to darthmaul)FYI. You can also raise Asynchronous events if you don't want your execution to wait until all listening code(@Observer) is executed.
Events.instance().raiseAsynchronousEvent(type, parameters).