Qwaak
|
|
« on: October 18, 2010, 08:27:20 » |
|
Hi
I've just started to work with puremvc and a love it so far. There are just some questions, where I'm not sure to get the things right done. One of it ist perhaps the same question, as crilbit wrote before me. I just want to get sure.
On Startup, I first register the proxies. Now I register a mediator, which handels the Navigation. Is it a good way, to call the loading/update-function in the proxy directly from the mediator?
For Exapmple:
public class NavigationViewMediator extends Mediator implements IMediator { public static const NAME:String = 'NavigationViewMediator'; private var _navigationView:NavigationView; private var _familyProxy:FamilyProxy; public function NavigationViewMediator(viewComponent:Object=null) { super(NAME, viewComponent); } override public function onRegister():void { _familyProxy = facade.retrieveProxy( FamilyProxy.NAME ) as FamilyProxy; _familyProxy.loadData(); _navigationView = new NavigationView; viewComponent.addChild( _navigationView ); } override public function listNotificationInterests():Array { return [ FamilyProxy.FAMILY_LOADED ]; } override public function handleNotification(note:INotification):void { switch(note.getName()) { case FamilyProxy.FAMILY_LOADED: renderData(); break; } } private function renderData():void { var data:FamilyVO; for(var i:int = 0; i < _familyProxy.length; i++) { data = _familyProxy.getFamilyAt(i); _navigationView.addNode(data.familyname, data.id); } } }
|