Hello,
I've some problems to find a good architecture for a SuperTabNavigator based application.
The basics regarding the tabs and dynamically proxy/mediator creation/registration are clear.
(Described in this post:
http://forums.puremvc.org/index.php?topic=596.msg2626#msg2626 )
To explain the problem assume we'd build an SuperTabNavigator based application for a car rental service:
Please imagine following course of action:
First Tab "Cars":
We open a first tab named "Cars" that display's all available cars of our car rental service.
With opening the tab we dynamically create and register a "CarListMediator" and a "CarCollectionProxy" with unique id's.
The data came from a Remote Service, the RemoteService returns an ArrayCollection of CarVO
and populates the "CarCollectionProxy" data object. The data grid's data provider is bound to the model, it's all fine.
Second Tab "Customers":
We open a second tab named "Customers" that display's all customers of our car rental service.
With opening the tab we dynamically create and register a "CustomerListMediator" and a "CustomerCollectionProxy" with unique id's.
The data came from a Remote Service, the RemoteService returns an ArrayCollection of CustomerVO
and populates the dynamically created "CustomerCollectionProxy's" data object. The data grid's data provider is bound to the model, it's all fine.
Third Tab "Peter Miles":
We double click the customer "Peter Miles" that is listet in the second tab "Customers".
This action opens a third tab named "Peter Miles" that displays detailed informations of "Peter Miles" inside a form and a history of all cars that he ever rent until now inside a DataGrid.
With opening the tab we dynamically create and register a "CustomerFormMediator", "CustomerCarsListMediator" and a "CustomerProxy" and "CustomerCarsProxy" with unique id's. To make sure that the displayed data are up-to-date (perhaps an other logged-in user has modified the customer data) we call an other RemoteService that returns a CustomerVO and populates the CustomerProxy data object.
Moreover we get all cars that ever rent by the customer as an ArrayCollection of CarVO from a RemoteService wich poulates the "CustomerCarsProxy's" data object.
Fourth Tab "Ford Mustang":
We double click the car "Ford Mustang" that is listet in the first first tab "Cars".
This action opens a fourth tab named "Ford Mustang" that displays detailed information of the "Ford Mustang" (e.g. the mileage) inside a form and a list of all customers that ever rent this car until now inside a DataGrid.
With opening the tab we dynamically create and register a "CarFormMediator", "CarCustomersListMediator" and a "CarProxy" and "CarCustomersProxy" with unique id's. To make sure that the displayed data are up-to-date (perhaps an other logged-in user has modified the car data) we call an RemoteService that returns a CarVO and populates the "CarProxy's" data object.
Moreover we get all customers that ever rent the "Ford Mustang" as an ArrayCollection of CustomerVO from a RemoteService wich poulates the "CarCustomersProxy's" data object.
Now we modify the milage value inside the "Ford Mustang" tab e.g. from 15300 to 15400.
To update our backend with this new milage value we call a RemoteSercice "UpdateCar".
And here's my question:
To keep all the data in different tabs and proxies consitency and up-to-date, we must update the "CarProxy", the "CarCollectionProxy" and the "CustomerCarsProxy" with our modified CarVO.
What's the best way to to this ?
Or is the proxy model as described above not the best one ?
Is it a good idea to keep the data redundant in the different proxies ?
I've take a look at RoleProxy inside the EmployeeAdmin's Demo, but I think this solution doesn't work here, cause we need different views to the data.
Sorry for the mass of text, hope you understand my problem.
Perhaps there's anybody out there who can help !
Many thanks in advance
Olaf