You don't need to retrieve the MyComponentMediator, you just need to send a notification it is interested in. Yes, both instances of MyComponentMediator will respond to the note, so you pass something in the type property of the notification that will allow the two instances of MyComponentMediator to discriminate and only act on notes meant for the right instance. This could be a bit of information shared between MyComponent and MySubComponent, for example. MyComponentMediator could look at the type property and if it is equal to some property on its view component, then it acts on the note.
I get the point! But this implies a kind of hard coupling between MyComponent and MySubComponent. But I imagine that we don't have any other choice that indicating which Mediator we need at one time or another anyway.
Here is my question to you: is there a good reason for you to build this big mediation loop? Why doesn't MyComponent listen to MySubComponent for the same event, and change its state in the handler? Why go the long way around the barn?
The program I am currently coding is actually a test required by a company to test my knowledges in framework usage. So my interest here was to code it as lose as possible! I admit that this kind of shortcut that you mention is probably smarter in some case like that where components are nested and no command or data exchange is required
Your explanations can't be more clear!
Thanks for your post.... number 2581!