Get the mediator instance for a given view instance or class

Matan Uberstein's Avatar

Matan Uberstein

01 Jul, 2013 11:32 AM

Hi,

The current MediatorMap implementation is not exposing the MediatorFactory. Is there a specific reason why we can't access the API? Specifically I need some way of accessing mediator instances.

Thanks,
Matan

  1. Support Staff 1 Posted by Shaun Smith on 03 Jul, 2013 12:42 PM

    Shaun Smith's Avatar

    Hi Matan,

    Sorry for the delay - I've been a little under the weather. I'll take a look and get back to you asap.

  2. Support Staff 2 Posted by Shaun Smith on 03 Jul, 2013 12:54 PM

    Shaun Smith's Avatar

    The current MediatorMap implementation is not exposing the MediatorFactory. Is there a specific reason why we can't access the API?

    Yup. The MediatorFactory is a private class - to keep the library maintainable going forward we have to reduce the API footprint that we officially support. The MediatorFactory and MediatorManager classes are internal implementation details that may be wildly changed or even completely dropped in the future.

    I think we need to find a solution to your actual need (getting the list of mediators for a given view) without exposing framework internals.

    As a matter of interest, what is your use case for this requirement?

  3. Support Staff 3 Posted by Shaun Smith on 03 Jul, 2013 01:01 PM

    Shaun Smith's Avatar
  4. 4 Posted by Matan Uberstein on 03 Jul, 2013 01:15 PM

    Matan Uberstein's Avatar

    Hi Shaun,

    Sorry to hear you're feeling under the weather, hope you feel better soon. :)

    EDIT: Ok, you've opened the ticket, below is my reasoning anyway. :)

    I've written a RL2 extension called StateMap which piggy backs off the MediatorMap. The resulting api looks like this:

    stateMap.map(MainScreen).toMediator(MainScreenMediator).withStates(SecId.MAIN_SCREEN);

    I'm using AS3Navigator as my internal state handler. In order to map the state, I need to provide an instance of a "INavigationResponder". Which in this case will always be a Mediator instance.

    Luckily I've got a work-a-round by using my custom implementation of StarlingMediatorMap which simply exposes the factory.

    The resulting "dirty" code with my StateMapping looks like this:

    public function get responder() : INavigationResponder
    {
        return INavigationResponder(StarlingMediatorMap(_mediatorMap).factory.getMediator(view, IMediatorMapping(_mediatorConfigurator)));
    }
    

    Thanks,
    Matan

  5. Ondina D.F. closed this discussion on 18 Jul, 2013 01:31 PM.

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