imageaid
|
|
« on: January 22, 2009, 10:37:48 » |
|
Hi,
Really starting to get into PureMVC with a large project at the moment and, while I have read the PureMVC PDFs, I am a little unclear on best practices for relationships between views (and mediators) and their data (and proxies). Sorry for the long post.
In my application, a user needs to first be authenticated (no problem here). When authentication is complete, I send a notification "to" the ApplicationFacade, passing the authenticated data as the notification body. The command registered to receive/act upon this notification sends a request to a web service to get some basic (initial) data about the authenticated user.
When the user's data comes back, I apply some basic data to a user VO (first name, etc.). From here, I need to output this on the "screen". Basically, I need to set a value inside a particular view. For the moment, my Command executes two methods on the related proxy. The first method call on my proxy populates the user VO object. The second method call on the proxy is designed to output some of this user's data to the view.
This second method takes the User VO as a parameter and, inside the method, retrieves the view's mediator. Once the mediator is retrieved, I access the view as a property of the mediator and then set the user data to the particular component within the view (just an mx:Label's text property).
Where I'm uncertain about my approach is whether this interaction between proxy, mediator, and view is the correct or "best practice" for setting values in the view component. Am I on the right track? Does such an approach couple classes too tightly?
Any thoughts or direction (a particular tutorial or code snippet on the PureMVC site to review) is most appreciated.
Thank you, Craig
|