I have a class with a property of type object which declared with
[bindable] compiler directive above it. This propert is binded to a
webservice tag in mxml. The problem that I am having is that when any
of the bindable object properties change the new values are never
reassigned when I do a save in the wsdl.

Below is the code:
    <mx:Script>
        <![CDATA[
                import com.processbuilder.managers.CompanyProcessHandler;
           
                [Bindable] 
                private var handler:CompanyProcessHandler;
                
                private function initHandler():void
                {
                        this.handler = new CompanyProcessHandler(this.wsdl, 
this);
                        this.handler.setUI(this.dg, this.newBtn);
                }
        ]]>
    </mx:Script>
        <mx:WebService id="wsdl" wsdl="http://mydomainFlexUIService?wsdl";
fault="e.show(event.fault.toString());" showBusyCursor="true" >
        
        <mx:operation name="getCompany"
result="this.handler.setCompany(event.result);">
          <mx:request>
            <payload>{this.handler.companyID}</payload>
          </mx:request>
        </mx:operation>
        <mx:operation name="findProcessesByCompany"
result="this.handler.setProcesses(event.result);">
          <mx:request>
            <payload>{this.handler.companyID}</payload>
          </mx:request>
        </mx:operation>
        <mx:operation name="saveProcess"
result="this.handler.saveProcessResult(event.result);" >
          <mx:request>
            <payload>
              <id>{this.handler.processObject.id}</id>
<updateDate>{this.handler.processObject.updateDate}</updateDate>     
 <companyId>{this.handler.processObject.companyId}</companyId>       
 <description>{this.handler.processObject.description}</description> 
 <lastValidated>{this.handler.processObject.lastValidated}</lastValidated>
              <name>{this.handler.processObject.name}</name>
              <status>{this.handler.processObject.status}</status>
            </payload>
          </mx:request>
        </mx:operation>
        <mx:operation name="deleteProcess"
result="this.handler.deleteProcessResult(event.result);" >
          <mx:request>
            <payload>{this.handler.processObject.id}</payload>
          </mx:request>
        </mx:operation>    
    </mx:WebService>


Class:


 
package com.processbuilder.managers {
        
        import com.processbuilder.dataProviders.CompanyProcessDataProvider;
        import com.processbuilder.displays.PopUpWindowHandler;
        import com.processbuilder.managers.EventManager;
        import mx.rpc.soap.mxml.WebService;
        import mx.controls.DataGrid;
        import mx.controls.Button;
        import components.popup.*;
        import mx.binding.utils.*;
        import flash.events.*;
        
        public class CompanyProcessHandler implements IHandler {

                [Bindable]
                public var companyID:Number;
                [Bindable]
                public var processObject:Object;
                [Bindable]
                public var companyObject:Object;
                private var type:String;
                private var wsdl:WebService;
                private var dg:DataGrid;
                private var newBtn:Button;
                private var em:EventManager;
                private var parent:*;
                
                public function CompanyProcessHandler(wsdl:WebService, parent:*)
                {
                        this.initEM();

                        this.companyID = 1021;
            
                        this.wsdl = wsdl;
                        this.parent = parent;
                        
                        this.call("getCompany");
                        this.call("findProcessesByCompany");            
                }
                
                public function call(methodName:String):void
                {
                        this.wsdl[methodName].send();
                }
            
                public function setUI(...args):void
                {
                        this.dg = args[0];

                        this.newBtn = args[1];
                        this.newBtn.addEventListener(MouseEvent.MOUSE_DOWN,
this.createNewProcess);
                }
                
                public function editProcess():void
                {
                        this.type = "edit";
                        this.processObject = this.dg.selectedItem;
                        PopUpWindowHandler.createPopUp(this.parent, 
popUpWindow);       
                }
                
                public function selectProcess(evt:MouseEvent):void{
                }
                
                private function createNewProcess(evt:MouseEvent):void
                {
                        this.type = "new";
                        PopUpWindowHandler.createPopUp(this.parent, 
popUpWindow);
                }
                
                public function setCompany(companyObject:Object):void
                {
                        this.companyObject = companyObject;
                }
                
                public function setProcesses(processesArray:*):void
                {
                        var dp:Array = 
CompanyProcessDataProvider.convert(processesArray);
                        this.dg.dataProvider = dp;
                }
                
                private function getProcess(evt:*):void
                {
                        this.em.broadcastEvent("setProcess", {processObject:
this.processObject, type: this.type});
                }
                
                private function saveProcess(evt:*):void
                {
                        switch(this.type)
                        {
                                case "edit":
                                    this.processObject.name = evt.data.name;
                                    this.processObject.description = 
evt.data.description;              
                                    break;
                                case "new":
                                        this.processObject =
CompanyProcessDataProvider.createNewProcessObject(evt.data);
                                    break;                  
                        }
                        e.trace("TYPE: " + this.type);
                        e.trace(this.processObject, true);
                        
                        this.call("saveProcess");
                        PopUpWindowHandler.close();
                }
        
        public function saveProcessResult(result:*):void
        {
                this.call("findProcessesByCompany");
        }
        
                private function deleteProcess(evt:*):void
                {
                        this.call("deleteProcess");
                        PopUpWindowHandler.close();
                }
                
                public function deleteProcessResult(result:*):void
                {
                        this.call("findProcessesByCompany");
                }
                
                private function initEM():void
                {
                        this.em = EventManager.getInstance();
                        this.em.addEventListener("getProcess",
this.getProcess);
                        this.em.addEventListener("saveProcess",
this.saveProcess);
                        this.em.addEventListener("deleteProcess",
this.deleteProcess);
                }
        }
}



















------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to