tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/7842-mediator-mapping-and-override-errorRobotlegs: Discussion 2013-11-15T11:46:17Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/297990152013-11-05T09:32:19Z2013-11-05T09:32:19ZMediator mapping and override error<div><p>Hey dada,</p>
<p>Instead of the mediatorMap, use the viewProcessorMap, like
this:</p>
<pre>
<code>injector.map(SomeView).asSingleton();
viewProcessorMap.map(SomeView).toProcess(new MediatorCreator(SomeMediator));
mediatorMap.map(AnotherView).toMediator(AnotherMediator);
mediatorMap.map(ShellContextView).toMediator(ShellContextMediator);</code>
</pre>
<p>or instead of mapping the view as singleton, you can map it like
so:</p>
<pre>
<code>var someView:SomeView = new SomeView();
injector.map(SomeView).toValue(someView);</code>
</pre>
<p>You could as well inject SomeView directly into views:</p>
<pre>
<code>Inside of AnotheView and ShellContextView:
[Inject]
public var someView:SomeView;</code>
</pre>
<p>Mappings:</p>
<pre>
<code>var someView:SomeView = new SomeView();
injector.map(SomeView).toValue(someView);
viewProcessorMap.map(AnotherView).toInjection();
viewProcessorMap.map(ShellContextView).toInjection();</code>
</pre>
<p>Now, you have to know that when you add SomeView to
ShellContextView, and then you want to add it to AnotherView as
well, SomeView will be re-parented, i.e. first removed from
ShellContextView and then added to AnotherView, and vice versa when
you add it again to ShellContextView, so SomeMediator will be
destroyed and created again.</p>
<p>Does that answer your question?</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/297990152013-11-05T11:53:26Z2013-11-05T11:53:26ZMediator mapping and override error<div><p>Yes, that works fine with the MediatorCreator, thank you for
your help.</p>
<p>Have a nice day|night.</p></div>dadatag:robotlegs.tenderapp.com,2009-10-18:Comment/297990152013-11-05T12:05:31Z2013-11-05T12:05:31ZMediator mapping and override error<div><p>Glad it works.</p>
<p>Thanks for the wishes, have a nice day/night, too :)</p>
<p>I forgot to give you this link for more info on
viewProcessorMap's usage:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/tree/master/src/robotlegs/bender/extensions/viewProcessorMap">
https://github.com/robotlegs/robotlegs-framework/tree/master/src/ro...</a></p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/297990152013-11-05T12:06:32Z2013-11-05T12:06:32ZMediator mapping and override error<div><p>Thanks for the link, I'll have a look at it.</p></div>dada