tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/2280-reusing-mediators-with-viewsRobotlegs: Discussion 2013-04-29T12:31:48Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/266010402013-04-28T09:27:05Z2013-04-28T09:35:33ZReusing mediators with views<div><p>Hello,</p>
<p>Would it be a solution for you to inject the views and models as
an interface into your mediator?<br>
Of course, you’d have to map them accordingly.<br>
mediatorMap.mapView(FirstView, SomeMediator, ISomeView);<br>
mediatorMap.mapView(SecondView, SomeMediator, ISomeView);</p>
<p>For rl1 see this utility: <a href=
"https://github.com/piercer/robotlegs-extensions-ViewInterfaceMediatorMap">
https://github.com/piercer/robotlegs-extensions-ViewInterfaceMediat...</a></p>
<p>Also, read Stray’s answer about using factories in this
discussion:<br>
<a href=
"http://knowledge.robotlegs.org/discussions/questions/290-mediating-views-as-interfaces#comment_3076929">
http://knowledge.robotlegs.org/discussions/questions/290-mediating-...</a></p>
<p>Some interesting discussions as well:<br>
<a href=
"http://knowledge.robotlegs.org/discussions/problems/165-mediators-and-inheritance-maximizing-code-reuse-minimizing-hacky-casting">
http://knowledge.robotlegs.org/discussions/problems/165-mediators-a...</a></p>
<p><a href=
"http://knowledge.robotlegs.org/discussions/problems/142-issue-subclassing-a-mediator">
http://knowledge.robotlegs.org/discussions/problems/142-issue-subcl...</a></p>
<p>No idea if this is working, but you can take a look at it:<br>
<a href=
"http://knowledge.robotlegs.org/discussions/suggestions/34-mapping-a-mediator-to-an-interface">
http://knowledge.robotlegs.org/discussions/suggestions/34-mapping-a...</a></p>
<p>Let me know whether your question has been answered or not.</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/266010402013-04-28T21:33:44Z2013-04-28T21:33:45ZReusing mediators with views<div><p>Thanks. Those links helped a lot. I started to go down the path
of injecting the views and models as interfaces, but it felt like I
was adding a lot of glue code (making a view implement an interface
for accessing its elements). I ended up just copying the
code...it's very lightweight, and like one of those links
mentioned, it's simply linking up basic view behaviors with a
model.</p>
<p>Thanks a lot!</p></div>xIketag:robotlegs.tenderapp.com,2009-10-18:Comment/266010402013-04-29T12:31:46Z2013-04-29T12:31:46ZReusing mediators with views<div><p>Glad it was helpful :)</p></div>Ondina D.F.