package com.mariusht.shellModuleDemo.shell.view { import com.mariusht.shellModuleDemo.common.IPipeAwareModule; import com.mariusht.shellModuleDemo.common.PipeAwareModuleConstants; import com.mariusht.shellModuleDemo.shell.ShellFacade; import org.puremvc.as3.multicore.interfaces.INotification; import org.puremvc.as3.multicore.utilities.pipes.plumbing.Junction; import org.puremvc.as3.multicore.utilities.pipes.plumbing.JunctionMediator; import org.puremvc.as3.multicore.utilities.pipes.plumbing.Pipe; public class ShellJunctionMediator extends JunctionMediator { public static const NAME:String = 'ShellJunctionMediator'; public function ShellJunctionMediator() { super(NAME, new Junction()); } override public function listNotificationInterests():Array { var interests:Array = super.listNotificationInterests(); interests.push(ShellFacade.MODULE_ADDED); return interests; } override public function handleNotification(note:INotification):void { switch(note.getName()) { case ShellFacade.MODULE_ADDED: connectModule(note.getBody() as IPipeAwareModule); break; } } private function connectModule(module:IPipeAwareModule):void { var pipe:Pipe = new Pipe(); junction.registerPipe(PipeAwareModuleConstants.SHELL_TO_MODULE_PIPE, Junction.OUTPUT, pipe); module.acceptInputPipe(PipeAwareModuleConstants.SHELL_TO_MODULE_PIPE, pipe); } } }