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 2019/07/03 22:26:48 UTC

[royale-asjs] branch feature/Crux updated (86b1c9f -> e71fc12)

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

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


    from 86b1c9f  Fix Jewel Crux quickstart example
     new 5d16f48  EventHandler processing of event properties works via reflection (works for public vars in release build)
     new 94ae6a0  make LogEntry bindable to create getter/setters for labelFields to work in release build. updates to maven build.
     add d61cfc8  If draggable item was clicked, mouse up wasn't being detected.
     add 268ccc3  Merge branch 'develop' of https://github.com/apache/royale-asjs into develop
     add 64eb735  children should only include elements
     new e71fc12  Merge branch 'develop' into feature/Crux

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:
 examples/crux/GitHubCommitLogViewer/pom.xml        | 40 +++++++++
 .../src/main/royale/crux/model/LogEntry.as         | 19 ++---
 .../src/main/royale/crux/view/MainContent.mxml     |  1 -
 examples/crux/pom.xml                              |  3 +-
 .../crux/processors/EventHandlerProcessor.as       |  3 -
 .../royale/crux/reflection/TypeDescriptor.as       |  4 -
 .../apache/royale/crux/utils/event/EventHandler.as | 94 +++++++++++++++-------
 .../html/beads/controllers/DragMouseController.as  |  2 +
 frameworks/projects/XML/src/main/royale/XML.as     |  7 +-
 9 files changed, 125 insertions(+), 48 deletions(-)


[royale-asjs] 01/03: EventHandler processing of event properties works via reflection (works for public vars in release build)

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

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

commit 5d16f48182c7005a91ebbe2d4f3ba9a3f01a52a1
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Jul 4 09:51:56 2019 +1200

    EventHandler processing of event properties works via reflection (works for public vars in release build)
---
 .../crux/processors/EventHandlerProcessor.as       |  3 -
 .../royale/crux/reflection/TypeDescriptor.as       |  4 -
 .../apache/royale/crux/utils/event/EventHandler.as | 94 +++++++++++++++-------
 3 files changed, 66 insertions(+), 35 deletions(-)

diff --git a/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/processors/EventHandlerProcessor.as b/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/processors/EventHandlerProcessor.as
index d4c2141..0f82c73 100644
--- a/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/processors/EventHandlerProcessor.as
+++ b/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/processors/EventHandlerProcessor.as
@@ -103,9 +103,6 @@ package org.apache.royale.crux.processors
 		{
 			var eventHandlerTag:EventHandlerMetadataTag = metadataTag as EventHandlerMetadataTag;
 			
-		/*	if( eventHandlerTag.name == MEDIATE )
-				logger.warn( "[Mediate] has been deprecated in favor of [EventHandler]. Please update {0} accordingly.", bean );
-*/
 			if( validateEventHandlerMetadataTag( eventHandlerTag ) )
 			{
 				var expression:EventTypeExpression = new EventTypeExpression( eventHandlerTag.event, crux );
diff --git a/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/reflection/TypeDescriptor.as b/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/reflection/TypeDescriptor.as
index ffe210f..79c2b54 100644
--- a/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/reflection/TypeDescriptor.as
+++ b/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/reflection/TypeDescriptor.as
@@ -57,10 +57,6 @@ package org.apache.royale.crux.reflection
 		/**
 		 * @royalesuppresspublicvarwarning
 		 */
-        // public var description:XML;
-		/**
-		 * @royalesuppresspublicvarwarning
-		 */
         public var typeDefinition:TypeDefinition;
 		
 		/**
diff --git a/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/utils/event/EventHandler.as b/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/utils/event/EventHandler.as
index d2fbd9d..ce8097f 100644
--- a/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/utils/event/EventHandler.as
+++ b/frameworks/projects/Crux/src/main/royale/org/apache/royale/crux/utils/event/EventHandler.as
@@ -43,6 +43,11 @@ package org.apache.royale.crux.utils.event
 	import org.apache.royale.crux.utils.async.AsyncTokenOperation;
 	import org.apache.royale.crux.utils.async.IAsynchronousEvent;
 	import org.apache.royale.crux.utils.async.IAsynchronousOperation;
+	import org.apache.royale.reflection.TypeDefinition;
+	import org.apache.royale.reflection.MethodDefinition;
+	import org.apache.royale.reflection.VariableDefinition;
+	
+	import org.apache.royale.reflection.utils.getMembersWithNameMatch;
 	
 	/**
 	 * Represents a deferred request for mediation.
@@ -160,7 +165,7 @@ package org.apache.royale.crux.utils.event
 				if( hostMethod.parameterCount > 0 && event is getParameterType( 0 ) )
 					result = method.apply( null, [ event ] );
 				else
-					result = method.apply();
+					result = method.call(null);
 			}
 			
 			if( event is IAsynchronousEvent && IAsynchronousEvent( event ).step != null )
@@ -199,6 +204,9 @@ package org.apache.royale.crux.utils.event
 				throw new Error( "The properties attribute of " + metadataTag.asTag + " is not compatible with the method signature of " + hostMethod.name + "()." );
 		}
 		
+		
+		protected var accessChains:Object ;
+		
 		/**
 		 * Validate Event
 		 *
@@ -210,26 +218,54 @@ package org.apache.royale.crux.utils.event
 		 */
 		protected function validateEvent( event:Event, metadataTag:EventHandlerMetadataTag ):Boolean
 		{
-			for each( var property:String in metadataTag.properties )
-			{
-				if( property.indexOf( "." ) < 0 && !( property in event ) )
-				{
-					throw new Error( "Unable to handle event: " + property + " does not exist as a property of " + getQualifiedClassName( event ) + "." );
-				}
-				else
+			
+			if (!accessChains) {
+				//set up access chains
+				accessChains = {};
+				var eventClassDescriptor:TypeDescriptor = TypeCache.getTypeDescriptor( eventClass );
+				var eventDefinition:TypeDefinition = eventClassDescriptor.typeDefinition;
+				
+				for each( var property:String in metadataTag.properties )
 				{
 					var chain:Array = property.split( "." );
-					var o:Object = event;
-					while( chain.length > 0 )
-					{
+					var accessChain:Array = [];
+					var definition:TypeDefinition = eventDefinition;
+					while (chain.length) {
 						var prop:String = chain.shift();
-						
-						if( prop in o )
-							o = o[ prop ];
-						else
-							throw new Error( "Unable to handle event: " + prop + " does not exist as a property of " + getQualifiedClassName( o ) + " as defined in " + metadataTag.asTag + "." );
+						var search:Array = getMembersWithNameMatch(definition.variables,prop);
+						if (search.length==0) getMembersWithNameMatch(definition.accessors,prop, search);
+						if (search.length != 1) {
+							throw new Error( "Unable to handle event: " + property + " does not exist as a property of " + eventClassDescriptor.className + "." );
+						}
+						var varDef:VariableDefinition = search[0];
+						accessChain.push(varDef);
+						if (chain.length) {
+							//continue with next definition
+							definition = varDef.type;
+						}
+					}
+					accessChains[property] = accessChain;
+				}
+			}
+			
+			//now validate it
+			for each( property in metadataTag.properties )
+			{
+				accessChain = accessChains[property];
+				var o:Object = event;
+				var defName:String = eventDefinition.qualifiedName;
+				if (accessChain.length > 1) {
+					var index:int = 0;
+					var l:int = accessChain.length-1;
+					while (index<l) {
+						if (o == null) {
+							throw new Error( "Unable to handle event: " + varDef.name + " is null as a property of " + defName + " as defined in " + metadataTag.asTag + "." );
+						}
+						varDef = accessChain[index];
+						o = varDef.getValue(o)
 					}
 				}
+				
 			}
 			
 			return true;
@@ -247,21 +283,23 @@ package org.apache.royale.crux.utils.event
 			
 			for each( var property:String in properties )
 			{
-				if( property.indexOf( "." ) < 0 )
-				{
-					args[ args.length ] = event[ property ];
-				}
-				else
-				{
-					var chain:Array = property.split( "." );
+				
+				var varDef:VariableDefinition;
+				var chain:Array = accessChains[property];
+				var l:uint = chain.length;
+				if (l == 1) {
+					varDef = chain[0];
+					args[ args.length ] = VariableDefinition(chain[0]).getValue(event);
+				} else {
 					var o:Object = event;
-					while( chain.length > 1 )
-						o = o[ chain.shift() ];
-					
-					args[ args.length ] = o[ chain.shift() ];
+					for (var i:int=0; i<l;i++) {
+						o = VariableDefinition(chain[i]).getValue(o);
+					}
+					args[ args.length ] = o
 				}
+				
 			}
-			
+			//trace('EventHandler... args', args)
 			return args;
 		}
 		


[royale-asjs] 02/03: make LogEntry bindable to create getter/setters for labelFields to work in release build. updates to maven build.

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

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

commit 94ae6a08ac820ccd938d642cdedd35610ce75ac8
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Jul 4 09:56:07 2019 +1200

    make LogEntry bindable to create getter/setters for labelFields to work in release build.
    updates to maven build.
---
 examples/crux/GitHubCommitLogViewer/pom.xml        | 40 ++++++++++++++++++++++
 .../src/main/royale/crux/model/LogEntry.as         | 19 +++++-----
 .../src/main/royale/crux/view/MainContent.mxml     |  1 -
 examples/crux/pom.xml                              |  3 +-
 4 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/examples/crux/GitHubCommitLogViewer/pom.xml b/examples/crux/GitHubCommitLogViewer/pom.xml
index 0626535..be33914 100644
--- a/examples/crux/GitHubCommitLogViewer/pom.xml
+++ b/examples/crux/GitHubCommitLogViewer/pom.xml
@@ -53,6 +53,46 @@
           <flashOutputFileName>swf/${project.artifactId}.swf</flashOutputFileName>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>3.1.0</version>
+        <executions>
+          <execution>
+            <id>copy-resources-debug</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${compiler.output-dir-debug}</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>src/main/resources</directory>
+                  <filtering>true</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+          <execution>
+            <id>copy-resources-release</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <!-- Copy the assets to the assets output directory -->
+              <outputDirectory>${compiler.output-dir-release}</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>src/main/resources</directory>
+                  <filtering>true</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <profiles>
diff --git a/examples/crux/GitHubCommitLogViewer/src/main/royale/crux/model/LogEntry.as b/examples/crux/GitHubCommitLogViewer/src/main/royale/crux/model/LogEntry.as
index e355499..4859949 100644
--- a/examples/crux/GitHubCommitLogViewer/src/main/royale/crux/model/LogEntry.as
+++ b/examples/crux/GitHubCommitLogViewer/src/main/royale/crux/model/LogEntry.as
@@ -16,14 +16,15 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
-package crux.model{
-
-public class LogEntry
+package crux.model
 {
-  public var date:String;
-  public var author:String;
-
-  [Bindable("__NoChangeEvent__")]
-  public var message:String;
-}
+    
+    [Bindable]
+    public class LogEntry
+    {
+        
+        public var date:String;
+        public var author:String;
+        public var message:String;
+    }
 }
diff --git a/examples/crux/GitHubCommitLogViewer/src/main/royale/crux/view/MainContent.mxml b/examples/crux/GitHubCommitLogViewer/src/main/royale/crux/view/MainContent.mxml
index 17d7410..2b369d0 100644
--- a/examples/crux/GitHubCommitLogViewer/src/main/royale/crux/view/MainContent.mxml
+++ b/examples/crux/GitHubCommitLogViewer/src/main/royale/crux/view/MainContent.mxml
@@ -57,7 +57,6 @@ limitations under the License.
                     trace('requesting ', repo);
                     dispatchEvent(event);
                 }
-
             } else {
                 projectName = '';
                 commits = [];
diff --git a/examples/crux/pom.xml b/examples/crux/pom.xml
index 519f248..0293f62 100644
--- a/examples/crux/pom.xml
+++ b/examples/crux/pom.xml
@@ -30,11 +30,12 @@
   <version>0.9.6-SNAPSHOT</version>
   <packaging>pom</packaging>
 
-  <name>Apache Royale: Examples: CruxCheck</name>
+  <name>Apache Royale: Examples: Crux</name>
 
   <modules>
     <module>CruxQuickStart</module>
     <module>CruxQuickStartBasic</module>
+    <module>GitHubCommitLogViewer</module>
   </modules>
 
   <build>


[royale-asjs] 03/03: Merge branch 'develop' into feature/Crux

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

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

commit e71fc12e42679ce6d906479551d8abc65b2e7d89
Merge: 94ae6a0 64eb735
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Jul 4 09:58:11 2019 +1200

    Merge branch 'develop' into feature/Crux

 .../apache/royale/html/beads/controllers/DragMouseController.as    | 2 ++
 frameworks/projects/XML/src/main/royale/XML.as                     | 7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)