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 2021/12/09 03:10:06 UTC

[royale-asjs] branch develop updated (47ff825 -> c0b9b43)

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 47ff825  Refactoring in reflection to add a lightweight getAncestry reflection method (with no TypeDefinition dependency).
     new c256c43  Improvements in ViewStack and LinkBar (startup behaviour and integration).
     new c0b9b43  Specific support for invalidate/commit deferred in emulation

The 2 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:
 .../MXRoyale/src/main/resources/defaults.css       |   7 +-
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   1 +
 .../src/main/royale/mx/containers/ViewStack.as     |  15 +++
 .../src/main/royale/mx/controls/LinkBar.as         |  33 +++---
 .../MXRoyale/src/main/royale/mx/controls/NavBar.as |   9 ++
 ...DataGridHeaderSeparator.as => LinkSeparator.as} | 116 ++++++++++++---------
 .../src/main/royale/MXRoyaleBaseClasses.as         |   1 +
 .../RoyaleUtil.as}                                 |  78 +++++++-------
 8 files changed, 156 insertions(+), 104 deletions(-)
 copy frameworks/projects/MXRoyale/src/main/royale/mx/skins/halo/{DataGridHeaderSeparator.as => LinkSeparator.as} (56%)
 copy frameworks/projects/MXRoyaleBase/src/main/royale/mx/{messaging/messages/AcknowledgeMessageExt.as => utils/RoyaleUtil.as} (51%)

[royale-asjs] 02/02: Specific support for invalidate/commit deferred in emulation

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 c0b9b4340965837d35af4871b64eeb1122a4c986
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Dec 9 16:09:53 2021 +1300

    Specific support for invalidate/commit deferred in emulation
---
 .../src/main/royale/MXRoyaleBaseClasses.as         |  1 +
 .../src/main/royale/mx/utils/RoyaleUtil.as         | 77 ++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
index 5f61d01..76ba29d 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
@@ -268,6 +268,7 @@ internal class MXRoyaleBaseClasses
 	import mx.utils.URLUtil;URLUtil;
 	import mx.utils.XMLNotifier;XMLNotifier;
 	import mx.utils.XMLUtil;XMLUtil;
+	import mx.utils.RoyaleUtil; RoyaleUtil;
 
 
 
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/RoyaleUtil.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/RoyaleUtil.as
new file mode 100644
index 0000000..42337a0
--- /dev/null
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/RoyaleUtil.as
@@ -0,0 +1,77 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.utils
+{
+
+
+COMPILE::SWF{
+
+    import flash.utils.setTimeout;
+}
+
+/**
+ *  The RoyaleUtil utility class is an all-static class
+ *  with methods for emulation support
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.9
+ */
+public class RoyaleUtil
+{	
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class methods
+    //
+    //--------------------------------------------------------------------------
+    public static const DELAY:uint = 5;
+
+    private static var timeOut:Number = -1;
+    public static function commitDeferred(commitPropertiesFunc:Function):Boolean{
+        if (deferreds.indexOf(commitPropertiesFunc) == -1) {
+            deferreds.push(commitPropertiesFunc);
+            if (timeOut == -1) {
+                timeOut = setTimeout(onDeferral, 5);
+            }
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @royaleignorecoercion Function
+     */
+    private static function onDeferral():void{
+        timeOut = -1;
+        var local:Array = deferreds;
+        deferreds = [];
+        var l:uint = local.length;
+        for (var i:uint = 0; i<l;i++) {
+            var commitPropertiesFunc:Function = local[i];
+            commitPropertiesFunc();
+        }
+    }
+
+    private static var deferreds:Array = [];
+
+}
+
+}

[royale-asjs] 01/02: Improvements in ViewStack and LinkBar (startup behaviour and integration).

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 c256c4342e1d2e16a938ab08ef9049c94489685c
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Dec 9 16:08:49 2021 +1300

    Improvements in ViewStack and LinkBar (startup behaviour and integration).
---
 .../MXRoyale/src/main/resources/defaults.css       |   7 +-
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   1 +
 .../src/main/royale/mx/containers/ViewStack.as     |  15 +++
 .../src/main/royale/mx/controls/LinkBar.as         |  33 ++++--
 .../MXRoyale/src/main/royale/mx/controls/NavBar.as |   9 ++
 .../src/main/royale/mx/skins/halo/LinkSeparator.as | 132 +++++++++++++++++++++
 6 files changed, 183 insertions(+), 14 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 37ecc3b..4ac02f9 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -415,9 +415,14 @@ NavBar
 	paddingLeft: 1;
 	paddingRight: 0;
 	paddingTop: 1;
-		horizontalGap: 6;
+	horizontalGap: 6;
 }
 
+LinkBar {
+	/* @todo restore this once rawChildren is working in LinkBar, otherwise selection indexing does not work
+	separatorSkin : ClassReference("mx.skins.halo.LinkSeparator");
+	*/
+}
 
 /*
 MenuItemRenderer {
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index cc9a808..4be7101 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -306,6 +306,7 @@ internal class MXRoyaleClasses
 	import mx.effects.IEffectTargetHost; IEffectTargetHost;
 	/*import mx.events.RSLEvent; RSLEvent;*/
 	import mx.skins.halo.DataGridHeaderSeparator; DataGridHeaderSeparator;
+	import mx.skins.halo.LinkSeparator; LinkSeparator;
 	import mx.filters.BaseDimensionFilter; BaseDimensionFilter;
 	import mx.filters.BaseFilter; BaseFilter;
 	import mx.filters.IBitmapFilter; IBitmapFilter;
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
index 614d473..de038dd 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
@@ -50,6 +50,8 @@ import mx.events.PropertyChangeEvent;
 //import mx.managers.HistoryManager;
 //import mx.managers.IHistoryManagerClient;
 
+import mx.utils.RoyaleUtil;
+
 import org.apache.royale.core.IChild;
 
 use namespace mx_internal;
@@ -354,6 +356,19 @@ public class ViewStack extends Container implements /*IHistoryManagerClient,*/ I
     //
     //--------------------------------------------------------------------------
 
+    //variation for emulation:
+    override public function invalidateProperties():void
+    {
+        var me:ViewStack = this;
+        if (RoyaleUtil.commitDeferred(commitProperties) && parent) {
+            //then force a view update after
+            RoyaleUtil.commitDeferred(function():void{
+                me.measure();
+                me.updateDisplayList(me.width, me.height);
+            })
+        }
+    }
+
     //----------------------------------
     //  autoLayout
     //----------------------------------
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/LinkBar.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/LinkBar.as
index 597d9cd..d75e036 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/LinkBar.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/LinkBar.as
@@ -22,6 +22,7 @@ package mx.controls
 
 
 import mx.core.UIComponent;
+import mx.core.IUIComponent;
 import mx.events.MouseEvent;
 import mx.core.ClassFactory;
 import mx.core.EdgeMetrics;
@@ -35,6 +36,8 @@ import mx.styles.StyleProxy;
 import mx.containers.Box;
 import mx.controls.NavBar;
 
+import org.apache.royale.events.IEventDispatcher;
+
 use namespace mx_internal;
 
 //--------------------------------------
@@ -316,7 +319,7 @@ public class LinkBar extends NavBar
     /**
      *  @private
      */
-  //  private static const SEPARATOR_NAME:String = "_separator";
+    private static const SEPARATOR_NAME:String = "_separator";
 
     //--------------------------------------------------------------------------
     //
@@ -555,10 +558,12 @@ public class LinkBar extends NavBar
 
     /**
      *  @private
+     *
+     *  @royaleignorecoercion Class
      */
-   /*  override protected function createNavItem(
+     override protected function createNavItem(
                                         label:String,
-                                        icon:Class = null):IFlexDisplayObject
+                                        icon:Class = null):IEventDispatcher
     {
         // Create the new LinkButton.
 
@@ -581,18 +586,20 @@ public class LinkBar extends NavBar
         newLink.addEventListener(MouseEvent.CLICK, clickHandler);
 
         // Create the new separator to the left of the LinkButton.
+        var separatorClass:Class = Class(getStyle("separatorSkin")); //@todo, need to support rawChildren working below first
+        if (separatorClass) {
+            //porting notes, this conditional clause is different to the original Flex implementation, allowing native browser styles to create 'separation'
+            var separator:IUIComponent = IUIComponent(new separatorClass());
+
+            separator.name = SEPARATOR_NAME + (numChildren - 1);
+            if (separator is ISimpleStyleClient)
+                ISimpleStyleClient(separator).styleName = this;
+//@todo, need to support rawChildren working below:
+            rawChildren.addChild(separator);
+        }
 
-        var separatorClass:Class = Class(getStyle("separatorSkin"));
-        var separator:DisplayObject = DisplayObject(new separatorClass());
-
-        separator.name = SEPARATOR_NAME + (numChildren - 1);
-        if (separator is ISimpleStyleClient)
-            ISimpleStyleClient(separator).styleName = this;
-
-        rawChildren.addChild(separator);
-        
         return newLink;
-    } */
+    }
 
     /**
      *  @private
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/NavBar.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/NavBar.as
index 28738f5..19df4c7 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/NavBar.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/NavBar.as
@@ -45,6 +45,8 @@ import mx.managers.ISystemManager;
 import mx.managers.SystemManager;
 //import mx.styles.StyleProtoChain;
 
+import mx.utils.RoyaleUtil;
+
 use namespace mx_internal;
 
 //--------------------------------------
@@ -158,6 +160,13 @@ public class NavBar extends Box
 		showInAutomationHierarchy = true;
     }
 
+
+    //variation for emulation:
+    override public function invalidateProperties():void
+    {
+        RoyaleUtil.commitDeferred(commitProperties);
+    }
+
     //--------------------------------------------------------------------------
     //
     //  Variables
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/skins/halo/LinkSeparator.as b/frameworks/projects/MXRoyale/src/main/royale/mx/skins/halo/LinkSeparator.as
new file mode 100644
index 0000000..7dd48c3
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/skins/halo/LinkSeparator.as
@@ -0,0 +1,132 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.skins.halo
+{
+
+import mx.display.Graphics;
+import org.apache.royale.reflection.getQualifiedClassName;
+import org.apache.royale.reflection.describeType;
+import org.apache.royale.reflection.getAncestry;
+
+import mx.containers.BoxDirection;
+import mx.skins.ProgrammaticSkin;
+
+
+
+/**
+ *  The skin for the separator between the Links in a LinkBar.
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class LinkSeparator extends ProgrammaticSkin {
+	//include "../../core/Version.as";
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Constructor.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function LinkSeparator() {
+		super();
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Overridden methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	override protected function updateDisplayList(w:Number, h:Number):void {
+		super.updateDisplayList(w, h);
+
+		var separatorColor:uint = getStyle("separatorColor");
+		var separatorWidth:Number = getStyle("separatorWidth");
+
+		var isVertical:Boolean = false;
+
+		var g:Graphics = graphics;
+
+		g.clear();
+
+		if (separatorWidth > 0) {
+			if (isBox(parent))
+				isVertical = Object(parent).direction == BoxDirection.VERTICAL;
+
+			g.lineStyle(separatorWidth, separatorColor);
+			if (isVertical) {
+				g.moveTo(4, h / 2);
+				g.lineTo(w - 4, h / 2);
+			} else {
+				g.moveTo(w / 2, 6);
+				g.lineTo(w / 2, h - 5);
+			}
+		}
+	}
+
+	/**
+	 *  We don't use 'is' to prevent dependency issues
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	private static var boxes:Object = {};
+
+	private static function isBox(parent:Object):Boolean {
+		var s:String = getQualifiedClassName(parent);
+		if (boxes[s] == 1)
+			return true;
+
+		if (boxes[s] == 0)
+			return false;
+
+		if (s == "mx.containers.Box") {
+			boxes[s] == 1;
+			return true;
+		}
+
+		var ancestry:Array = getAncestry(parent);
+		if (ancestry.indexOf('mx.containers.Box') != -1) {
+			boxes[s] = 0;
+			return false;
+		}
+
+
+		boxes[s] = 1;
+		return true;
+	}
+}
+}
\ No newline at end of file