thx for the detailed explanation.
Had some time to experiment a bit and came to more or less the same solution. I'll try to highlight the things i did different:
Remove mediators
Remove mediators when a view is removed. My thought why this is important: If you keep the mediator, you keep a reference to the view. So the view can never be garbage collected until the mediator is also removed.
In your solution, you keep the current mediator until the next time a view of the same Class is created. This implies that once your application has visited all views, you use the same amount of memory as creating all views on startup and keep a fixed reference to them.
No centralized registration of mediators
I'm registering my mediators by listening to the ElementExistenceEvent.ELEMENT_ADD events of the viewNavigator and TabbedViewNavigator.
I'm removing my mediators by listening to the ElementExistenceEvent.ELEMENT_REMOVE events.
This way, you can reuse the same View Class in for example two different ViewNavigators in one TabbedViewNavigator.
Example: You have an application with a View that can represent a list of persons: PersonListView. In one Tab you display family in a family viewNavigator, in a second tab you display friends in a friends viewNavigator, .. By splitting the registration of the mediators, you can reuse the same View: When a PersonListView view is created in the family viewNavigator, you create a family mediator which populates the view with family data. When the a PersonListView is created in the friends viewNavigator, your create a friend mediator which populates the view with friends data.
When you register your mediators in one centralized command, you can not know with what data that view should be populated.. or is there an other way to do this? If you could do this in any other way, i would prefer the centralized solution.. I don't think you can use the id property, cause there is no way to set it when you call the navigator.pushView(View) method...
EDIT: Just noticed that the third parameter of the pushView method, 'context' can be used in order to reuse view components. Going for the centralized approach..