0 Replies Latest reply on Apr 7, 2009 6:57 AM by hclselvs

    setter getter methods in RemoteObject

    hclselvs

      Hi,

       

      I am trying to use RemoteObject to connect Flex and Spring. In this following example, I am getting 6 values as testinput and sending to the javafile as a arguments. I would like to use getter and setter methods and instead of sending all these variables to java class, need to send the object which holds the getter setter method. Is it pssible and can you provide me sample code snippet?

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
      xmlns:custom="Components.*" fontWeight="normal" creationComplete="init()">

      <mx:Script>
        <![CDATA[
        import flash.sampler.StackFrame; 
        import mx.validators.Validator;
               import mx.events.ValidationResultEvent;
               import mx.controls.Alert;


                  [Bindable]

        private function resetForm(evt:MouseEvent):void {
         contractId.text = "";
         contractName.text = "";
         contractVersion.text = "";
         contractStartDate.text = "";
         contractEndDate.text = "";               
                  }
         private function sendContractHeaderInfo():void
         {

          var contractId:String = contractId.text;
          var contractName:String = contractName.text;
          var contractVersion:String = contractVersion.text;
          var contractStartDate:String = contractStartDate.text;
          var contractEndDate:String = contractEndDate.text;
          remoteObject.setContractHeaderInfo(contractId,contractName,contractVersion,contractStartD ate,contractEndDate);   
         }
                            
        ]]>
      </mx:Script>
          
          <mx:RemoteObject id="remoteObject"
              destination="contractheaderinfo" />    
      <mx:Panel title="Contract Creation - Header Information"  x="261" y="61">
        <mx:Form label="Contract Creation Form" id="contractCreationForm"
         x="372" y="93">
         <mx:FormItem label="Contract Id:" required="true">
                <mx:TextInput id="contractId" restrict="0-9"/>
            </mx:FormItem>
           
            <mx:FormItem label="Contract Name:" >
                <mx:TextInput id="contractName" />
            </mx:FormItem>   
           
            <mx:FormItem label="Contract Version:" >
                <mx:TextInput id="contractVersion"  />
            </mx:FormItem>       
           
            <mx:FormItem label="Contract Start Date:">
                <mx:DateField id="contractStartDate" />
            </mx:FormItem>
           
            <mx:FormItem label="Contract End Date:">
                <mx:DateField id="contractEndDate" />
            </mx:FormItem>        
           
            <mx:FormItem >
                <mx:Button label="Next" id = "submit" click="sendContractHeaderInfo()" />
                <mx:Button label="Reset" id="reset" click="resetForm(event)" />
            </mx:FormItem>
        </mx:Form>
      </mx:Panel>

      </mx:Application>

       

       

      Thanks,
      Srinivasan S