you said:
view -> mediator -> notification (carrying a VO) -> instantiation of the new view -> creation of its mediator.
* ViewComponent dispatches an event
* Mediator hears, takes the data from the ViewComponent (or custom event) and sends Notification
* Notification is an array containing a reference to the new component, and the VO
* Command responds:
* Creating Mediator passing in new component
* Registers Mediator
* Sends new Notification that the new Mediator is interested in, with VO as body
* New Mediator, just registered gets this Notification and acts on it, setting the data on the new component.
Is it possible that this same event happens again later, but we don't know if it creation has taken place or not?
* ViewComponent dispatches an event
* Mediator hears, takes the data from the ViewComponent (or custom event) and sends Notification
* Notification is an array containing a reference to the new component, and the VO
* Command responds:
* If (! facade.hasMediator(NewMediator.NAME) )
* Creating Mediator passing in new component
* Registers Mediator
* Sends new Notification that the new Mediator is interested in, with VO as body
* New Mediator, just registered gets this Notification and acts on it, setting the data on the new component.
This is business logic, which belongs in Commands.
-=Cliff>
You weren't clear on your flow in the original post and the above is how I understood it. Something has happened at the view and a mediator needs to be