You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2020/11/25 03:15:57 UTC

[royale-asjs] branch develop updated (2902b35 -> 76027dc)

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

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


    from 2902b35  Add text decoration to spark labels
     new a852a29  minor: standardise part of the toString implemenation of TypeDefinition between swf and js
     new 5e4da6c  Adding a new utility method for reflection use. This is useful in many serialization/deserialization implementations.
     new 76027dc  Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/royale/ReflectionClasses.as           |  1 +
 .../org/apache/royale/reflection/TypeDefinition.as |  1 +
 .../apache/royale/reflection/utils/MemberTypes.as  |  4 ++
 .../utils/getInstanceVarsAndAccessors.as           | 73 ++++++++++++++++++++++
 4 files changed, 79 insertions(+)
 create mode 100644 frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/utils/getInstanceVarsAndAccessors.as


[royale-asjs] 01/03: minor: standardise part of the toString implemenation of TypeDefinition between swf and js

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a852a29831d7f6f9463736c9e0f02ea32823e224
Author: greg-dove <gr...@gmail.com>
AuthorDate: Wed Nov 25 16:12:57 2020 +1300

    minor: standardise part of the toString implemenation of TypeDefinition between swf and js
---
 .../src/main/royale/org/apache/royale/reflection/TypeDefinition.as       | 1 +
 1 file changed, 1 insertion(+)

diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/TypeDefinition.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/TypeDefinition.as
index a7d3415..7c2614b 100755
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/TypeDefinition.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/TypeDefinition.as
@@ -890,6 +890,7 @@ COMPILE::SWF {
             while (collections.length) {
                 var collectionType:String = collections.shift();
                 var collection:Array =collections.shift();
+                collection.sort(function (item1:Object, item2:Object):int{ return item1.name < item2.name ? -1 : 1 });
                 s += collectionType+" :";
                 if (!collection || !collection.length) {
                     s+= "\n\t{none}\n"


[royale-asjs] 03/03: Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 76027dcb250327d780dc00d94945800d8bd3a8ce
Merge: 5e4da6c 2902b35
Author: greg-dove <gr...@gmail.com>
AuthorDate: Wed Nov 25 16:15:14 2020 +1300

    Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

 .../Basic/src/main/resources/basic-manifest.xml    |  1 +
 .../org/apache/royale/html/beads/SelectableBead.as | 90 ++++++++++++++++++++++
 .../src/main/royale/mx/core/UIComponent.as         | 25 +++++-
 .../src/main/royale/spark/components/Label.as      | 19 ++++-
 4 files changed, 128 insertions(+), 7 deletions(-)


[royale-asjs] 02/03: Adding a new utility method for reflection use. This is useful in many serialization/deserialization implementations.

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5e4da6c244a1686de701d505134f0fd16a9bb24f
Author: greg-dove <gr...@gmail.com>
AuthorDate: Wed Nov 25 16:14:20 2020 +1300

    Adding a new utility method for reflection use. This is useful in many serialization/deserialization implementations.
---
 .../src/main/royale/ReflectionClasses.as           |  1 +
 .../apache/royale/reflection/utils/MemberTypes.as  |  4 ++
 .../utils/getInstanceVarsAndAccessors.as           | 73 ++++++++++++++++++++++
 3 files changed, 78 insertions(+)

diff --git a/frameworks/projects/Reflection/src/main/royale/ReflectionClasses.as b/frameworks/projects/Reflection/src/main/royale/ReflectionClasses.as
index 754c3a1..24a9f62 100644
--- a/frameworks/projects/Reflection/src/main/royale/ReflectionClasses.as
+++ b/frameworks/projects/Reflection/src/main/royale/ReflectionClasses.as
@@ -48,6 +48,7 @@ internal class ReflectionClasses
 	//utils
 	import org.apache.royale.reflection.utils.getMembersWithMetadata; getMembersWithMetadata;
 	import org.apache.royale.reflection.utils.getMembers; getMembers;
+	import org.apache.royale.reflection.utils.getInstanceVarsAndAccessors; getInstanceVarsAndAccessors;
 	import org.apache.royale.reflection.utils.MemberTypes; MemberTypes;
 	import org.apache.royale.reflection.utils.getStaticConstantsByConvention; getStaticConstantsByConvention;
 	import org.apache.royale.reflection.utils.getMembersWithNameMatch; getMembersWithNameMatch;
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/utils/MemberTypes.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/utils/MemberTypes.as
index cf2e2b4..545cd97 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/utils/MemberTypes.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/utils/MemberTypes.as
@@ -35,6 +35,10 @@ package org.apache.royale.reflection.utils {
         public static const ACCESSORS:uint = 2;
         public static const METHODS:uint = 4;
         public static const STATIC_ONLY:uint = 8;
+
+        public static const ACCESS_READ_ONLY:uint=1;
+        public static const ACCESS_WRITE_ONLY:uint=2;
+        public static const ACCESS_READ_WRITE:uint=4;
     }
     
     
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/utils/getInstanceVarsAndAccessors.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/utils/getInstanceVarsAndAccessors.as
new file mode 100644
index 0000000..3ebdd39
--- /dev/null
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/utils/getInstanceVarsAndAccessors.as
@@ -0,0 +1,73 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.reflection.utils
+{
+	import org.apache.royale.reflection.*;
+	
+	
+    /**
+     *  A utility method to retrieve all exposed variable and accessor members
+	 *  It will return variables, and readwrite-only accessors that are public by default, but
+	 *  you can specific different options to retrieve other combinations.
+	 *  
+     *  @param fromDefinition the definition to retrieve the member definitions from
+	 *  @param accessorFilter bitflag combination of MemberTypes.ACCESS_READ_WRITE (the default) or MemberTypes.READ_ONLY or MemberTypes.WRITE_ONLY. Set this to 0 (zero) to exclude all accessors.
+ 	 *  @param publicOnly true if only public namespaced members should be returned (the default)
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.0
+	 *
+	 *  @royaleignorecoercion org.apache.royale.reflection.AccessorDefinition
+	 *  @royaleignorecoercion org.apache.royale.reflection.VariableDefinition
+     */
+    public function getInstanceVarsAndAccessors(fromDefinition:TypeDefinition, accessorFilter:uint = 4, publicOnly:Boolean=true):Array
+	{
+		var ret:Array = [];
+		if (!fromDefinition) return ret;
+		ret = ret.concat(fromDefinition.variables);
+		var accessors:Array = accessorFilter ? fromDefinition.accessors : [];
+		if (accessors.length && ((accessorFilter & 7) != 7)) {
+			var l:uint = accessors.length;
+			while(l--) {
+				var access:String = AccessorDefinition(accessors[l]).access;
+				var includeItem:Boolean = (access == 'readwrite' && (accessorFilter & MemberTypes.ACCESS_READ_WRITE)) ||
+						(access == 'readonly' && (accessorFilter & MemberTypes.ACCESS_READ_ONLY)) ||
+						(access == 'writeonly' && (accessorFilter & MemberTypes.ACCESS_WRITE_ONLY));
+				if (includeItem) {
+					accessors.splice(l,1);
+				}
+			}
+		}
+		ret = ret.concat(accessors);
+
+		if (publicOnly) {
+			l = ret.length;
+			while(l--) {
+				var varDef:VariableDefinition = VariableDefinition(ret[l]);
+				if (varDef.uri) ret.splice(l,1);
+			}
+		}
+
+		return ret;
+    }
+	
+	
+}