get reference to mediatorMap

virat's Avatar

virat

23 Apr, 2014 09:32 PM

Hi

I have an existing project that uses robotlegs and its working great.

I now have to integrate this project into a partner product which uses its own view-mediator framework. I need to use the partner's framework to retrieve certain context variables. The partner framework initializes a mediator for each view. I want to register that same mediator as a robotlegs mediator. But I am unable to figure out how to get a reference to the mediatorMap so that I can do the following

mediatorMap.registerMediator(view, this);

It looks like the mediatorMap is only available within an instance of Context or Mediator class. The automatic mediation does not seem to work.

  1. Support Staff 1 Posted by Ondina D.F. on 24 Apr, 2014 08:30 AM

    Ondina D.F.'s Avatar

    Hello,

    I don't think that is a good idea to use mediatorMap.registerMediator.
    See this discussion:
    http://knowledge.robotlegs.org/discussions/problems/3743-map-a-movi...

    mediatorMap.registerMediator(view, this);
    

    "this" doesn't make much sense in your mapping, because the second parameter is expected to be an IMediator

    It looks like the mediatorMap is only available within an instance of Context or Mediator class.

    The mediatorMap is also available in Commands. Or, you can let the injector get an instance of the mediatorMap.

    The automatic mediation does not seem to work.

    It seems like there are some issues with your contextView and the way you create the context.
    First thing to check is whether you have a context at all!
    You said that your app worked just fine as a standalone project. How are you instantiating the context when you integrate it into the other project? What are you using as a contextView? Are your views added to your contextView (put a trace statement inside your added to stage handlers to see their parent)?

    Ondina

  2. 2 Posted by virat on 28 Apr, 2014 06:44 PM

    virat's Avatar

    Thanks for the quick response. I realized that I was initializing the context in a non-UI class. Once I moved it to a UI-component, everything started working.

  3. Support Staff 3 Posted by Ondina D.F. on 30 Apr, 2014 08:23 AM

    Ondina D.F.'s Avatar

    No problem! Glad you found the culprit ;)

  4. Ondina D.F. closed this discussion on 30 Apr, 2014 08:23 AM.

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