tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/3677-get-the-mediator-instance-for-a-given-view-instance-or-classRobotlegs: Discussion 2013-07-18T13:31:34Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/275641212013-07-03T12:42:46Z2013-07-03T12:42:46ZGet the mediator instance for a given view instance or class<div><p>Hi Matan,</p>
<p>Sorry for the delay - I've been a little under the weather. I'll
take a look and get back to you asap.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/275641212013-07-03T12:54:33Z2013-07-03T12:54:33ZGet the mediator instance for a given view instance or class<div><blockquote>
<p>The current MediatorMap implementation is not exposing the
MediatorFactory. Is there a specific reason why we can't access the
API?</p>
</blockquote>
<p>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.</p>
<p>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.</p>
<p>As a matter of interest, what is your use case for this
requirement?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/275641212013-07-03T13:01:00Z2013-07-03T13:01:00ZGet the mediator instance for a given view instance or class<div><p>I've opened a new issue for this: <a href=
"https://github.com/robotlegs/robotlegs-framework/issues/147">https://github.com/robotlegs/robotlegs-framework/issues/147</a></p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/275641212013-07-03T13:15:02Z2013-07-03T14:21:30ZGet the mediator instance for a given view instance or class<div><p>Hi Shaun,</p>
<p>Sorry to hear you're feeling under the weather, hope you feel
better soon. :)</p>
<p>EDIT: Ok, you've opened the ticket, below is my reasoning
anyway. :)</p>
<p>I've written a RL2 extension called StateMap which piggy backs
off the MediatorMap. The resulting api looks like this:</p>
<p>
<code>stateMap.map(MainScreen).toMediator(MainScreenMediator).withStates(SecId.MAIN_SCREEN);</code></p>
<p>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.</p>
<p>Luckily I've got a work-a-round by using my custom
implementation of <code>StarlingMediatorMap</code> which simply
exposes the factory.</p>
<p>The resulting "dirty" code with my <code>StateMapping</code>
looks like this:<br></p>
<pre>
<code>public function get responder() : INavigationResponder
{
return INavigationResponder(StarlingMediatorMap(_mediatorMap).factory.getMediator(view, IMediatorMapping(_mediatorConfigurator)));
}</code>
</pre>
<p>Thanks,<br>
Matan</p></div>Matan Uberstein