Question about mediatorMap#hasMediatorForView

jiri's Avatar


01 Sep, 2010 07:48 AM

I have the following question.
I use the following mapping

mediatorMap.mapView( WindowViewA , WindowAMediator , IWindowView);
mediatorMap.mapView( WindowViewB , WindowBMediator , IWindowView);

in a command I would then like to check if a mapping is made for a particular view, as a safety measure.

var window:IWindowView = new WindowViewA();
mediatorMap.hasMediatorForView( window)

This always seem to return false. Am I doing something wrong? Is it because I use the IwindowView in the mapping?



  1. 1 Posted by Stray on 01 Sep, 2010 09:46 AM

    Stray's Avatar

    Hi Jiri,

    what you're doing doesn't really make sense to me.

    The mediator is only created for the view at the moment when it is added to the contextView display list - so you would always get a false result here as your view is not yet on the display list, and thus cannot be mediated.

    Why do you need to check it? If you're creating the view in the command itself then surely you know which view type you're creating, and whether it has been mapped... unless this is some sort of async issue? Either way, this makes me wonder whether there's some better way to solve your 'checking' problem.

    Do you want to describe your problem more generally? Maybe we can suggest something else?


  2. 2 Posted by jiri on 01 Sep, 2010 06:02 PM

    jiri's Avatar

    Yes you are right. I realized is a bit later. Also if the mapping should not be there, then robotlegs is throwing an error, so that is sufficient.

    Thank you for your reply.

  3. Stray closed this discussion on 10 Feb, 2011 05:44 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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