Managing multiple galleries on the stage
I am trying to solve this logic with RL – let's say we've
got multiple image galleries on the stage at the same time.
Each gallery contains a few images. For each gallery only one image
is focused at time and that happens after clicking the
thumbnail.
So currently each image has its own VO (with dimensions, current
state etc.) and also holds the reference to the view.
An image view mediator listens to the image mouse click event, then
it needs to dispatch the Signal with the image VO. Each gallery
listens to that event and if it contains that VO, it should focus
that view.
How to solve that? Mediators don't know about the VOs, only the
views. But the view itself contains no information about the
VO.
Also should I have separate models for each gallery with current
focussed image VO?
I am totally puzzled with this. RL seems to be a nice way to
have this working but I am clueless.
Thanks!
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Stray on 28 Oct, 2011 11:48 AM
Quickest clean-ish fix I can think of:
wrap the vos in a model with a method:
Inject that model as a read-only interface (showing only this method) into the mediators. Let the mediator retrieve the VO for the view using this API. (Inside the model you use a dictionary where the views are the keys and the VOs are the values).
It's not ideal, and it feels as little as though your design is a bit upside down, but this will fix it without causing much spaghetti.
As you implement that it should become clear how to separate the galleries - I wouldn't make a call on that until you've fixed the first problem.
hth,
Stray
3 Posted by Og2t on 28 Oct, 2011 12:20 PM
Thanks Stray! It's not too late yet to refactor everything.
How would you organise this if written from scratch?
Ondina D.F. closed this discussion on 23 Dec, 2011 08:55 AM.