Mediators not receiving updates from RelaxedEventMap
I'm using (and LOVING) the relaxedEventMap, but am running into an issue where some of my mediators are not receiving updates from the relaxedEventMap. I'm adding my listeners in the onRegister event like this:
relaxedEventMap.mapRelaxedListener( AuthenticationEvent.USER_AUTHENTICATED, handleUserAuthentication, AuthenticationEvent, this );
..and everything else seems to be setup correctly (I'm even getting the events in other mediators). I've checked the mapping in my context file, and even moved the relaxedEvent mappings above my command mappings, as this seems to have been an issue in other projects. I guess I'm just looking for any potential "gotchas" that I might be missing.
Thanks!
-Kyle
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Stray on 02 Feb, 2011 08:14 PM
Hi Kyle,
hmm... nothing springs to mind.
Obviously there are the usual things: you need to be making sure your relaxedEventMap isn't getting garbage collected, which could happen if it was a property of the context and the context was being garbage collect just as the mediator was being created...
When you say 'some' of your mediators aren't receiving the relaxedEventMap updates - is there a consistent difference between either:
1) The mediators that are/aren't receiving
2) The events that are / aren't being received
I would start with the things that impact on the normal eventMap as well - for example have you definitely overridden clone in the custom events?
Also - are these updates that should be in the history (and so you're expecting them as soon as you register the handler in the mediator's onRegister) or is it later updates that occur after the mediator is on stage that you're not seeing consistently? Obviously the relaxedEventMap should work for both.
If you want to bundle up your code and email it to dailystraying at gmail dot com I can take a look straight away.
Cheers,
Stray
2 Posted by Kyle on 02 Feb, 2011 09:58 PM
Hey Stray,
I really appreciate the help man (or at least the offer to help ha), but I
walked away for an hour to get some lunch and (as usual) upon return, I
rather quickly found the ridiculous cause of my error. When I was
registering my relaxed events in the context, I accidentally (due to
copy/paste error) set the event types to the wrong class.
ex (note the type FeedEvent):
relaxedEventMap.rememberEvent(AuthenticationEvent.USER_AUTHENTICATED,
FeedEvent);
Should have been:
relaxedEventMap.rememberEvent(AuthenticationEvent.USER_AUTHENTICATED,
AuthenticationEvent);
As soon as I mapped it to the correct event type it work (go figure)! Thanks
again!
On a side note, Robotlegs Gotcha #4 is now up on my site:
http://www.geekgonenomad.com/2011/02/02/robotlegs-gotcha-4-relaxedeventmap-and-unmaplistenersfor/
-Kyle
On Wed, Feb 2, 2011 at 12:15 PM, Stray <
[email blocked]<tender%[email blocked]>
> wrote:
3 Posted by Stray on 02 Feb, 2011 10:07 PM
Excellent!
About 99% of my errors are those kind of MRTEs (Mental Run Time Errors).
Glad you got it sorted,
Stray
Stray closed this discussion on 10 Feb, 2011 04:51 PM.