|
|
Show Posts
|
Pages: [1]
|
1
|
PureMVC Manifold / Standard Version / How to register Mediator of children components
|
on: July 20, 2010, 02:40:47
|
My main view component is call children components as follows:
var classRefrence:Class=getDefinitionByName(podList[i].podcomponent) as Class; var myvbox:Object=new classRefrence() as Object; myvbox.dataProvider=mlotterylist; pod.addChild(myvbox as DisplayObject); myvbox is load the children component.Now, I have a children component named "AddRecordForm" and the mediator named "AddRecordListMediator".How do register AddRecordListMediator?
|
|
|
2
|
PureMVC Manifold / MultiCore Version / Re: why module don't connect to shell?
|
on: May 27, 2010, 09:29:12
|
Hi Tek
For you example,on HelloModuleJunctionMediator
override public function onRegister():void { //We need the color of the current module to setup the color filter. var helloModuleMediator:HelloModuleMediator = facade.retrieveMediator( HelloModuleMediator.NAME ) as HelloModuleMediator; var color:String = helloModuleMediator.getModuleColor();
/* * Setup for the input pipe tee merge. All input pipes registered * with as PipeConstants.STDIN will be merged on it. */ var filter:Filter = new Filter( HelloModuleColorFilterMessage.COLOR_FILTER_NAME ); trace("filter"+String(filter)); filter.setFilter( HelloModuleColorFilterMessage.filterMessageByColor as Function ); filter.setParams( { color:color }); filter.connect(new PipeListener(this,handlePipeMessage));
var teeMerge:TeeMerge = new TeeMerge(); teeMerge.connect(filter); junction.registerPipe( PipeNames.STDIN, Junction.INPUT, teeMerge ); var teeSplit:TeeSplit = new TeeSplit(); junction.registerPipe( PipeNames.HELLO_OUT_TO_HELLO, Junction.OUTPUT, teeSplit ); } If there is no filter, how do teeMerge connect to Pipe.And if there is no module to module,how can teeSplit write.
|
|
|
5
|
PureMVC Manifold / MultiCore Version / why module don't connect to shell?
|
on: May 26, 2010, 09:01:16
|
I have a difficult to use puremvc multicore core now.blow is my code: 1.ShellJunctionMediator
package com.czw.apps.shell.view { import com.czw.apps.common.HelloMsg; import com.czw.apps.common.PipeNames; import com.czw.apps.shell.ShellFacade; import org.puremvc.as3.multicore.interfaces.INotification; import org.puremvc.as3.multicore.patterns.facade.Facade; import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeAware; import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeMessage; import org.puremvc.as3.multicore.utilities.pipes.messages.Message; 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; import org.puremvc.as3.multicore.utilities.pipes.plumbing.TeeMerge; import org.puremvc.as3.multicore.utilities.pipes.plumbing.TeeSplit;
public class ShellJunctionMediator extends JunctionMediator { public static const NAME:String="ShellJunctionMediator"; private var outMap:Object={};
public function ShellJunctionMediator() { super(NAME, new Junction()); }
override public function onRegister():void { junction.registerPipe(PipeNames.STDIN,Junction.INPUT,new TeeMerge()); junction.registerPipe(PipeNames.STDOUT,Junction.OUTPUT,new TeeSplit()); junction.addPipeListener(PipeNames.STDIN,this,handlePipeMessage);
}
override public function listNotificationInterests():Array { var Interests:Array=super.listNotificationInterests(); Interests.push(ShellFacade.CONNECT_MODULE_TO_SHELL); Interests.push(ShellFacade.DISCONNECT_MODULE_TO_SHELL); Interests.push(ShellFacade.SEND_MSG_TO_MODULE); return Interests;
}
override public function handleNotification(note:INotification):void { var moduleID:String; var moduleFacade:IPipeAware;
switch (note.getName()) { case ShellFacade.CONNECT_MODULE_TO_SHELL: moduleID=note.getBody() as String; moduleFacade=Facade.getInstance(moduleID) as IPipeAware; // module -> shell var moduleToShell:Pipe=new Pipe(); //moduleFacade.acceptOutputPipe(PipeNames.MODULE_TO_SHELL_PIPE, moduleToShell); moduleFacade.acceptOutputPipe(PipeNames.ANY_MODULE_TO_SHELL,moduleToShell);
var shellInFitting:TeeMerge=junction.retrievePipe(PipeNames.STDIN) as TeeMerge; shellInFitting.connect(moduleToShell);
// shell -> module var shellToModule:Pipe=new Pipe(); moduleFacade.acceptInputPipe(PipeNames.STDIN, shellToModule);
var shellOutFitting:TeeSplit=junction.retrievePipe(PipeNames.STDOUT) as TeeSplit; shellOutFitting.connect(shellToModule);
outMap[moduleID]=shellOutFitting;
break; case ShellFacade.DISCONNECT_MODULE_TO_SHELL: break; case ShellFacade.SEND_MSG_TO_MODULE: //trace(note.getBody() as String); var helloMsg:HelloMsg=new HelloMsg("shell",note.getBody() as String); junction.sendMessage(PipeNames.STDOUT,helloMsg); break; default: super.handleNotification(note); }
}
override public function handlePipeMessage(message:IPipeMessage):void { //trace("kkkk"); trace(Message(message).getBody() as String);
} } } 2. HelloModuleJunctionMediator
package com.czw.apps.modules.hello.view { import com.czw.apps.common.HelloMsg; import com.czw.apps.common.PipeNames; import com.czw.apps.modules.hello.HelloFacade; import org.puremvc.as3.multicore.interfaces.INotification; import org.puremvc.as3.multicore.utilities.pipes.messages.Message; import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeMessage; import org.puremvc.as3.multicore.utilities.pipes.plumbing.Junction; import org.puremvc.as3.multicore.utilities.pipes.plumbing.JunctionMediator;
public class HelloModuleJunctionMediator extends JunctionMediator { public static const NAME:String="HelloModuleJunctionMediator";
public function HelloModuleJunctionMediator() { super(NAME, new Junction()); }
override public function onRegister():void {
}
override public function listNotificationInterests():Array { var Interests:Array=super.listNotificationInterests(); Interests.push(HelloFacade.SEND_MSG_TO_SHELL); return Interests; }
override public function handleNotification(note:INotification):void { switch (note.getName()) { case HelloFacade.SEND_MSG_TO_SHELL: var sendId:String=this.multitonKey; var body:String=note.getBody() as String; var helloMsg:HelloMsg=new HelloMsg(sendId, body); junction.sendMessage(PipeNames.ANY_MODULE_TO_SHELL, helloMsg); break; default: super.handleNotification(note); }
}
override public function handlePipeMessage(message:IPipeMessage):void { this.sendNotification(HelloFacade.SENS_MSG_TO_LABLE, Message(message).getBody() as String); } } } 3.HelloFacade
package com.czw.apps.modules.hello { import com.czw.apps.modules.hello.controller.StartupCommand; import com.czw.apps.modules.hello.controller.SendMsgToShellCommand; import com.czw.apps.modules.hello.view.components.Hello;
import org.puremvc.as3.multicore.patterns.facade.Facade; import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeAware; import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeFitting; import org.puremvc.as3.multicore.utilities.pipes.plumbing.JunctionMediator;
public class HelloFacade extends Facade implements IPipeAware { public static const STARTUP:String="startup";
public static const SEND_MSG_TO_SHELL:String="sendMsgToShell";
public static const SENS_MSG_TO_LABLE:String="snedMsgToLable";
public function HelloFacade(key:String) { super(key); }
public static function getInstance(key:String):HelloFacade { if (instanceMap[key] == null) { instanceMap[key]=new HelloFacade(key); } return instanceMap[key] as HelloFacade; }
override protected function initializeController():void { super.initializeController(); this.registerCommand(STARTUP, StartupCommand); //this.registerCommand(SEND_MSG_TO_SHELL, SendMsgToShellCommand); }
public function startup(app:Hello):void { this.sendNotification(STARTUP, app); }
public function acceptInputPipe(name:String, pipe:IPipeFitting):void {
sendNotification(JunctionMediator.ACCEPT_INPUT_PIPE, pipe, name);
}
public function acceptOutputPipe(name:String, pipe:IPipeFitting):void {
sendNotification(JunctionMediator.ACCEPT_OUTPUT_PIPE, pipe, name);
}
} } 4.Hello.mxml
<?xml version="1.0" encoding="utf-8"?> <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" layout="vertical" width="100%" height="100%" implements="com.czw.apps.common.czwIModule"> <fx:Script> <![CDATA[ import com.czw.apps.common.czwIModule; import com.czw.apps.modules.hello.HelloFacade;
import org.puremvc.as3.multicore.interfaces.IFacade; import org.puremvc.as3.multicore.patterns.facade.Facade;
public static const NAME:String="Hello"; private static var serial:Number=0;
public static const SENDMSG:String="sendMessage";
var facade:IFacade;
var moduleID:String=Hello.getNextID();
public function getID():String { return moduleID; }
public function setup():void { facade=HelloFacade.getInstance(moduleID); HelloFacade(facade).startup(this);
}
public function treadown():void {
}
private static function getNextID():String { return NAME + "/" + serial++; }
private function sendEvent(name:String):void { switch (name) { case SENDMSG: this.dispatchEvent(new Event(SENDMSG, true)); break; } } ]]> </fx:Script> <fx:Declarations> </fx:Declarations> <s:TextInput id="sMsg"/> <s:Label id="rMsg" color="#FB0404"/> <s:Button label="Send Msg" click="sendEvent(SENDMSG)"/> <s:Label text="{getID()}"/> </mx:Module>
why i can from module send message to shell,but can not from shell send message to module ?Do you have the error before?Please help to me!!!!
|
|
|
6
|
PureMVC Manifold / Demos and Utils / Pipe Demo: Mortgage App
|
on: May 18, 2010, 12:04:52
|
I have a difficult to use pipes version of the mortgage app now.Below is throw error when I click load module button:
[ProgressEvent type=”error” bubbles=false cancelable=false eventPhase=2 bytesLoaded=0 bytesTotal=0] at com.dl.modules.pipes.proxies::ModuleManagementProxy/onError()[E:\CBank\MortgageAppPipesDemo\src\com\dl\modules\pipes\proxies\ModuleManagementProxy.as:90] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at ModuleInfoProxy/moduleEventHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\modules\ModuleManager.as:1101] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at ModuleInfo/errorHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\modules\ModuleManager.as:734]
Do you have the error before?
|
|
|
7
|
PureMVC Manifold / Standard Version / why onFault not call?
|
on: April 08, 2010, 06:29:58
|
I have a difficult to use puremvc+Blazeds now . First see blow's code: OrgchartDelegate:
package com.czw.apps.cbank.model.business { import com.czw.apps.cbank.model.vo.OrgchartVO; import mx.rpc.IResponder; import mx.rpc.remoting.RemoteObject;
public class OrgchartDelegate { private var responder:IResponder; private var service:Object; public function OrgchartDelegate(responder:IResponder) { service=new RemoteObject(); service.destination="myOrgchartLogicFlex"; service.makeObjectsBindable=true; service.showBusyCursor=true; this.responder=responder; } public function getAllOrgchart():void{ var call:Object=service.getAllOrgchart(); call.addResponder(this.responder); } public function getParentOrgchart(departmentid:String):void{ var call:Object=service.getAllOrgchart(departmentid); call.addResponder(this.responder); } public function updateOrgchart(orgchartVO:OrgchartVO):void{ var call:Object=service.updateOrgchart(orgchartVO); call.addResponder(this.responder); } } }
OrgchartProxy:
package com.czw.apps.cbank.model { import com.czw.apps.cbank.ApplicationFacade; import com.czw.apps.cbank.model.business.OrgchartDelegate; import com.czw.apps.cbank.model.vo.OrgchartVO; import mx.collections.ArrayCollection; import mx.rpc.Responder; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.controls.Alert; import org.flexunit.runner.Result; import org.puremvc.as3.interfaces.IProxy; import org.puremvc.as3.patterns.proxy.Proxy;
public class OrgchartProxy extends Proxy implements IProxy { public static const NAME:String="OrgchartProxy"; public var errorStatus:String; public var currentOrgchart:OrgchartVO; public function OrgchartProxy(data:Object=null) { super(NAME,data); } public function getAllOrgchart():void{ var delegate:OrgchartDelegate=new OrgchartDelegate(new Responder(ongetAllOrgchartResult,onFault)); delegate.getAllOrgchart(); } public function ongetAllOrgchartResult(event:ResultEvent):void{ data =event.result as ArrayCollection; this.sendNotification(ApplicationFacade.GET_ALL_ORGCHART_SUCESS); } public function getParentOrgchart(departmentid:String):void{ var delegate:OrgchartDelegate=new OrgchartDelegate(new Responder(ongetParentResult,onFault)); delegate.getParentOrgchart(departmentid); } public function ongetParentResult(event:ResultEvent):void{ currentOrgchart=event.result as OrgchartVO; this.sendNotification(ApplicationFacade.GET_PARENT_ORGCHART_SUCESS); } public function updateOrgchart(orgchartVO:OrgchartVO):void{ var delegate:OrgchartDelegate=new OrgchartDelegate(new Responder(onUpdateResult,onFault)); delegate.updateOrgchart(orgchartVO); } public function onUpdateResult(event:ResultEvent):void{ this.sendNotification(ApplicationFacade.UPDATE_ORGCHART_SUCESS); } public function onFault(event:FaultEvent):void{ this.errorStatus=event.fault.faultString; Alert.show(this.errorStatus,"Error"); } public function get orgchartList():ArrayCollection{ return data as ArrayCollection; } } }
if call OrgchartProxy .getAllOrgchart()when I disconnection the database,the getAllOrgchart function will call onFault function. but if call OrgchartProxy.updateOrgchart(vo) when I disconnection the database,the updateOrgchart function not call onFault.
|
|
|
|
|