You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/11/20 16:16:57 UTC

[royale-asjs] branch develop updated: add the same examples for mx:RemoteObject of the latest commit for the Jewel test version (App_Jewel.mxml) and a comment in pom to easy switching between app files

This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 142c855  add the same examples for mx:RemoteObject of the latest commit for the Jewel test version (App_Jewel.mxml) and a comment in pom to easy switching between app files
142c855 is described below

commit 142c855d208213f82d72b1b404d5c5350e5ad2f5
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Tue Nov 20 17:16:51 2018 +0100

    add the same examples for mx:RemoteObject of the latest commit for the Jewel test version (App_Jewel.mxml) and a comment in pom to easy switching between app files
---
 examples/mxroyale/RemoteObjectAMFTest/pom.xml      |   1 +
 .../src/main/royale/App_Jewel.mxml                 | 123 ++++++++++++++++++---
 2 files changed, 111 insertions(+), 13 deletions(-)

diff --git a/examples/mxroyale/RemoteObjectAMFTest/pom.xml b/examples/mxroyale/RemoteObjectAMFTest/pom.xml
index 9d479ce..965aa60 100644
--- a/examples/mxroyale/RemoteObjectAMFTest/pom.xml
+++ b/examples/mxroyale/RemoteObjectAMFTest/pom.xml
@@ -47,6 +47,7 @@
         <extensions>true</extensions>
         <configuration>
           <mainClass>App.mxml</mainClass>
+          <!-- <mainClass>App_Jewel.mxml</mainClass> -->
           <targets>SWF,JSRoyale</targets>
           <debug>true</debug>
           <!-- <additionalCompilerOptions>-source-map=true;-js-dynamic-access-unknown-members=true</additionalCompilerOptions> -->
diff --git a/examples/mxroyale/RemoteObjectAMFTest/src/main/royale/App_Jewel.mxml b/examples/mxroyale/RemoteObjectAMFTest/src/main/royale/App_Jewel.mxml
index 8e338a9..bc6956b 100644
--- a/examples/mxroyale/RemoteObjectAMFTest/src/main/royale/App_Jewel.mxml
+++ b/examples/mxroyale/RemoteObjectAMFTest/src/main/royale/App_Jewel.mxml
@@ -27,24 +27,17 @@ limitations under the License.
 
     <fx:Script>
 		<![CDATA[
-            import valueObjects.ClientValueObject;
-            import valueObjects.Product;
-            import valueObjects.Zone;
-            import mx.rpc.events.FaultEvent;
-            import mx.rpc.events.ResultEvent;
-            import mx.rpc.remoting.Operation;
             import mx.rpc.AsyncToken;
             import mx.rpc.Responder;
+            import mx.rpc.events.FaultEvent;
+            import mx.rpc.events.ResultEvent;
+
+            import valueObjects.ClientValueObject;
+            import valueObjects.Product;
             
 			private function onFault(evt:FaultEvent):void
 			{
-                trace("Fault= " + evt.message);
-				for(var key:String in evt["message"])
-				{
-					var element:Object = evt["message"][key];
-					trace(key + ", " + element);					
-				}
-				//trace("Fault = " + evt.message);
+                trace("[onFault]", evt);				
 			}
 
             // Test AsyncToken - Responder
@@ -63,6 +56,100 @@ limitations under the License.
                 trace("[onEchoResult]", event);
                 result_txt.text = event.result as String;
             }
+
+            /**
+             * create a complex object in royale and send to java
+             */
+            public function sendClientVO(event:MouseEvent):void
+            {
+                trace("sendClientVO called");
+
+                var clientVO:ClientValueObject = new ClientValueObject();
+                clientVO.id = String(Math.random()*100);
+
+                var r:Responder = new Responder(sendClientVOResult, onFault);
+                var t:AsyncToken = serviceResp.sendClientVO(clientVO);
+                t.addResponder(r);
+                trace("the token: ", t);
+            }
+
+            private function sendClientVOResult(event:ResultEvent):void
+			{
+                trace("[sendClientVOResult]", event);
+                result2_txt.text = event.result as String;
+            }
+
+            /**
+             * create a complex object in royale and send to java
+             */
+            public function sendSomeProduct(event:MouseEvent):void
+            {
+                trace("sendSomeProduct called");
+
+                var product:Product = new Product();
+                product.name = "Some royale product";
+                product.description = "This product is only a test typed value object to test AMF strong types";
+                
+                // var taxonomy:Taxonomy = new Taxonomy();
+                // taxonomy.type = "a type";
+                // taxonomy.description = "a taxonomy for this product";
+
+                // product.taxonomy = taxonomy;
+
+                // Set<Zone> zones = new HashSet<Zone>();
+                
+                // Zone zone1 =  new Zone();
+                // zone1.setId(1);
+                // zone1.setName("Europe");
+                // zones.add(zone1);
+
+                // Zone zone2 =  new Zone();
+                // zone2.setId(2);
+                // zone2.setName("USA");
+                // zones.add(zone2);
+
+                // Zone zone3 =  new Zone();
+                // zone3.setId(3);
+                // zone3.setName("Asia");
+                // zones.add(zone3);
+                
+
+                /*Object[] zones = new Object[3];
+                for (int i = 0; i < zones.length; i++)
+                {
+                    Zone zone = new Zone();
+                    zone.setId(i);
+                    if (i == 0)
+                        zone.setName("Europa");
+                    else if (i == 1)
+                        zone.setName("USA");
+                    else if (i == 2)
+                        zone.setName("Asia");
+                    zones[i] = zone;
+                }*/
+
+                // product.setZones(zones);
+                
+                // List<CharSequence> list = new ArrayList<CharSequence>();
+                // list.add("A");
+                // list.add("B");
+                // list.add("A");
+                // list.add("C");
+                // list.add("C");
+                // list.add("B");
+                // product.setFlavors(new HashSet<CharSequence>(list));
+
+                var r:Responder = new Responder(onSendSomeProductResult, onFault);
+                var t:AsyncToken = serviceResp.sendSomeProduct(product);
+                t.addResponder(r);
+                trace("the token: ", t);
+            }
+
+            private function onSendSomeProductResult(event:ResultEvent):void
+			{
+                trace("[onSendSomeProductResult]", event);
+                result3_txt.text = event.result as String;
+            }
 		]]>
 	</fx:Script>
 
@@ -116,6 +203,14 @@ limitations under the License.
                 <j:Button text="Send to Name (With Responder)" click="sendEcho(event)"/>        
             </j:HGroup>        
             <j:Label id="result_txt"/>
+            <j:VGroup>
+                <j:Button text="Send client vo to java" click="sendClientVO(event)"/>        
+                <j:Label id="result2_txt"/>
+            </j:VGroup>
+            <j:VGroup>
+                <j:Button text="Send complex object to java" click="sendSomeProduct(event)"/>        
+                <j:Label id="result3_txt"/>
+            </j:VGroup>
         </j:VGroup>
         </j:ApplicationResponsiveView>
     </j:initialView>
@@ -129,5 +224,7 @@ limitations under the License.
         <mx:Button label="Get Some Product" click="service.getSomeProduct.send()"/>
         <mx:Label text="{((service.getSomeProduct as Operation).lastResult as Product).name}"/>
     </mx:VBox> -->
+
+    
 </j:Application>