package de.sonntagsfarben.puremvc.as3.mediator { import org.puremvc.as3.multicore.interfaces.INotification; import org.puremvc.as3.multicore.patterns.mediator.Mediator; import flash.utils.Dictionary; /** * @author Soenke Kluth */ public class AbstractMediator extends Mediator { protected var notificationMap : Dictionary; public function AbstractMediator(name : String = null, viewComponent : Object = null) { super(name, viewComponent); notificationMap = new Dictionary(); } public function registerNotificationHandler(notificationName : String, handler : Function) : void { notificationMap[ notificationName ] = handler; } override public function listNotificationInterests() : Array { var a:Array = new Array(); for (var note : String in notificationMap) { a.push(note); } return a; } override public function handleNotification(notification : INotification) : void { notificationMap[ notification.getName() ].apply(null, [notification]); } } }