You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2017/09/06 22:31:29 UTC
[36/50] git commit: [flex-asjs] [refs/heads/feature/amf] - get an
array of custom value objects
get an array of custom value objects
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a2debfab
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a2debfab
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a2debfab
Branch: refs/heads/feature/amf
Commit: a2debfab45ccf0dd590d13efc3c9afeea7e365f6
Parents: f12d90a
Author: Alex Harui <ah...@apache.org>
Authored: Mon Sep 4 09:26:58 2017 -0700
Committer: Carlos Rovira <ca...@apache.org>
Committed: Thu Sep 7 00:24:03 2017 +0200
----------------------------------------------------------------------
.../RemoteObjectAMFTest/src/main/flex/App.mxml | 23 ++++++++++-
.../main/flex/valueObjects/ClientValueObject.as | 41 ++++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a2debfab/examples/flexjs/RemoteObjectAMFTest/src/main/flex/App.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/RemoteObjectAMFTest/src/main/flex/App.mxml b/examples/flexjs/RemoteObjectAMFTest/src/main/flex/App.mxml
index 974bdd5..116bf8c 100644
--- a/examples/flexjs/RemoteObjectAMFTest/src/main/flex/App.mxml
+++ b/examples/flexjs/RemoteObjectAMFTest/src/main/flex/App.mxml
@@ -26,6 +26,7 @@ limitations under the License.
<![CDATA[
import org.apache.flex.net.events.FaultEvent;
import org.apache.flex.net.events.ResultEvent;
+ import valueObjects.ClientValueObject;
protected function sendName():void
{
@@ -35,13 +36,31 @@ limitations under the License.
private function onResult(evt:ResultEvent):void
{
trace("Result=" + evt.data);
- received.text = "Received: " + evt.data;
+ if (evt.data is String)
+ received.text = "Received: " + evt.data;
+ else
+ {
+ var arr:Array = evt.data as Array;
+ list.dataProvider = arr;
+ }
}
private function onFault(evt:FaultEvent):void
{
trace("Fault=" + evt.message);
}
+
+ protected function getVOs():void
+ {
+ service.send("getObjectArray1", []);
+ }
+
+ protected function reportChange():void
+ {
+ var vo:ClientValueObject = list.selectedItem as ClientValueObject;
+ received.text = "selected " + vo.id;
+ }
+
]]>
</fx:Script>
@@ -62,6 +81,8 @@ limitations under the License.
<js:TextInput id="name_txt" />
<js:TextButton text="Send Name to AMF" click="sendName()"/>
<js:Label id="received" width="300"/>
+ <js:TextButton text="Get Array of ValueObjects" click="getVOs()"/>
+ <js:List id="list" labelField="id" width="100" height="100" change="reportChange()"/>
</js:View>
</js:initialView>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a2debfab/examples/flexjs/RemoteObjectAMFTest/src/main/flex/valueObjects/ClientValueObject.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/RemoteObjectAMFTest/src/main/flex/valueObjects/ClientValueObject.as b/examples/flexjs/RemoteObjectAMFTest/src/main/flex/valueObjects/ClientValueObject.as
new file mode 100644
index 0000000..e328ca2
--- /dev/null
+++ b/examples/flexjs/RemoteObjectAMFTest/src/main/flex/valueObjects/ClientValueObject.as
@@ -0,0 +1,41 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package valueObjects
+{
+ [RemoteClass(alias="org.apache.flex.amfsamples.valueobjects.ServerCustomType")]
+ public class ClientValueObject
+ {
+ public function ClientValueObject()
+ {
+ }
+
+ private var _id:String;
+
+ public function get id():String
+ {
+ return _id;
+ }
+
+ public function set id(value:String):void
+ {
+ _id = value;
+ }
+
+ }
+}