tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/112-map-different-instances-of-the-same-view-class-to-different-mediator-classRobotlegs: Discussion 2018-10-18T16:35:13Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/20011452010-06-18T17:47:12Z2010-06-18T17:47:12Zmap different instances of the same view class to different mediator class<div><p>Hi Peter,</p>
<p>It's one-view-to-one-mediator.</p>
<p>But you can easily use strongly typed classes that just extend
your view class, or contain it, to achieve the same goal.</p>
<p>I've done that in my current app and it does also make the code
clearer / easier to follow in my opinion.</p>
<p>Hope that helps,</p>
<p>Stray</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/20011452010-06-18T18:16:53Z2010-06-18T18:16:55Zmap different instances of the same view class to different mediator class<div><p>The other alternative, if you can potentially have any number of
different instances of the given view (e.g., you have a
TabNavigator full of different application-created instances of
your View), is to look at modular contexts in Modular RL (even if
your app does not actually use Flex modules).</p></div>Maciektag:robotlegs.tenderapp.com,2009-10-18:Comment/20011452010-06-18T22:20:59Z2010-06-18T22:21:02Zmap different instances of the same view class to different mediator class<div><p>Thank for the feedback guys. I guess a one to one mapping
between view class and mediator class would make code easier to
follow. I am just not too comfortable with creating empty subclass
for the sole purpose of view to mediator mapping. But overall I
find Robotlegs framework to be very enjoyable to work with. And one
to one mapping is certainly something that I can live with.</p></div>peterctag:robotlegs.tenderapp.com,2009-10-18:Comment/20011452010-06-19T10:27:12Z2010-06-19T10:27:12Zmap different instances of the same view class to different mediator class<div><p>If you think of it in terms of objects rather than code, it's
fine to have your two views wrapped in specific types - as well as
creating the right mediator mappings, they clearly behave pretty
differently (if they need diff mediators!) so in my mind that
absolutely fits that they're different types of the same
superclass.</p>
<p>By subclassing them you declare that very clearly. I think it's
a win, not a lose.</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/20011452010-06-21T22:20:47Z2010-06-21T22:20:48Zmap different instances of the same view class to different mediator class<div><p>Thanks Stray, that make sense. It might just be my personal
coding style that is getting in the way.</p></div>peterc