Title: TreeItemRenderer - Mediators. Post by: yeremy on September 04, 2008, 10:46:13 Hi All!
i've been working with a Tree Control. now i need to add some funtionallity to each item of the tree, to do this is necesary to integrate with the rest of the application, send notifications, get the proxies, etc. i've created a itemRenderer and a mediator for this. public class TreeItemFormRenderer extends TreeItemRenderer it is called from the itemRenderer property : //TreeContainer.mxml and i setup the Tree in the Mediator for treeConteiner.
I need to integrate each TreeItemRenderer to the rest of the application. my question is : Where i can put the called to the notification which call to "Create Mediator Command" ? this is the notification : sendNotification( ApplicationFacade.MEDIATOR_CREATE, [ TreeItemFormRendererMediator.NAME, this ] ); Any Help is good received!! thanks! yeremy. Title: Re: TreeItemRenderer - Mediators. Post by: puremvc on September 05, 2008, 04:03:14 Hi yeremy,
You want to send the notification from the TreeContainerMediator not from the actual tree item renderer. Use a bubbling event at the end of the renderer's constructor to notify the TreeContainerMediator that the notification should be sent. in TreeItemFormRenderer: public class TreeItemFormRenderer extends TreeItemRenderer in TreeContainerMediator: import flash.events.Event; I assume you have a command listening for that MEDIATOR_CREATE that is a factory for creating and registering any type of mediator based on the name. However If you're only doing this one registration, you could skip the external command and just register the mediator from within the TreeContainerMediator: override private function onRendererCreated ( event:Event ):void -=Cliff> Title: Re: TreeItemRenderer - Mediators. Post by: yeremy on September 06, 2008, 08:33:37 hey Cliff!
Thanks for your help!...i tried to do that you recommended me. but for some reason, it doesn't work correctly. in TreeItemFormRenderer. public class TreeItemFormRenderer extends TreeItemRenderer in TreeContainerMediator override public function onRegister():void i did exactly that you told me. it seems like onRendererCreated is not being called when the event is sent. do you know what is wrong in this? Thanks in Advance! yeremy. Title: Re: TreeItemRenderer - Mediators. Post by: yeremy on September 06, 2008, 11:15:05 it is working now!!!
i moved the call to the dispatchEvent from the constructor method to initializationComplete method. in TreeItemFormRenderer public class TreeItemFormRenderer extends TreeItemRenderer Thanks for your help Cliff!!! yeremy. |