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/06/10 07:58:52 UTC

[royale-asjs] branch develop updated (cb1bf69 -> 368c6fe)

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 cb1bf69  add null check for #852
     new af23e03  support reassignment of sourceID value in SimpleBinding, otherwise ContainerDataBinding does not cover some use cases in MXRoyale
     new 2fdc137  Constrain ToolTip display to the visible area in MXRoyale. This prevents ToolTips being clipped when near edges (but placement could still be improved)
     new 368c6fe  Improved emulation of PopUpMenuButton. Support for 'explicit' label assignment as per Flex. Added support for certain dataProvider changes. Still more to do here, I think.

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:
 .../org/apache/royale/binding/SimpleBinding.as     | 10 ++--
 .../src/main/royale/mx/controls/PopUpMenuButton.as | 57 ++++++++++++++++++++--
 .../main/royale/mx/controls/beads/ToolTipBead.as   | 28 +++++++++++
 3 files changed, 86 insertions(+), 9 deletions(-)


[royale-asjs] 02/03: Constrain ToolTip display to the visible area in MXRoyale. This prevents ToolTips being clipped when near edges (but placement could still be improved)

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 2fdc1370d0936033436e7cf38aeee41f227166ad
Author: greg-dove <gr...@gmail.com>
AuthorDate: Wed Jun 10 19:04:53 2020 +1200

    Constrain ToolTip display to the visible area in MXRoyale. This prevents ToolTips being clipped when near edges (but placement could still be improved)
---
 .../main/royale/mx/controls/beads/ToolTipBead.as   | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ToolTipBead.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ToolTipBead.as
index 6bae801..ab3f4fa 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ToolTipBead.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ToolTipBead.as
@@ -18,11 +18,15 @@
 ////////////////////////////////////////////////////////////////////////////////
 package mx.controls.beads
 {
+	import mx.core.FlexGlobals;
+	import mx.managers.SystemManager;
+
 	import org.apache.royale.core.IStrand;
 	import org.apache.royale.core.IUIBase;
 	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.MouseEvent;
 	import org.apache.royale.html.accessories.ToolTipBead;
+	import org.apache.royale.geom.Rectangle;
     
     import mx.core.UIComponent;
 	
@@ -73,8 +77,32 @@ package mx.controls.beads
                 if (tt)
                 {
                     tt.element.style.color = isError ? "#ff0000" : "#000";
+					adjustInsideBoundsIfNecessary();
                 }
             }
         }
+
+		COMPILE::JS
+		private function adjustInsideBoundsIfNecessary():void{ //could override determinePosition instead
+			var screen:Rectangle = ((FlexGlobals.topLevelApplication as UIComponent).systemManager as SystemManager).screen;
+			var deltaX:int = 0;
+			var deltaY:int = 0;
+			if (tt.x + tt.width > screen.width) {
+				deltaX -= (tt.x + tt.width - screen.width)
+			} else if (tt.x < 0) {
+				deltaX = tt.x;
+			}
+			if (tt.y + tt.height > screen.height) {
+				deltaY -= (tt.y + tt.height - screen.height)
+			} else if (tt.y < 0) {
+				deltaY = tt.y;
+			}
+
+			if (deltaX || deltaY) {
+				tt.x += deltaX;
+				tt.y += deltaY;
+			}
+		}
+
 	}
 }
\ No newline at end of file


[royale-asjs] 01/03: support reassignment of sourceID value in SimpleBinding, otherwise ContainerDataBinding does not cover some use cases in MXRoyale

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 af23e03a556ce5897f9a9d13ca3e456af4093a8b
Author: greg-dove <gr...@gmail.com>
AuthorDate: Wed Jun 10 19:02:09 2020 +1200

    support reassignment of sourceID value in SimpleBinding, otherwise ContainerDataBinding does not cover some use cases in MXRoyale
---
 .../src/main/royale/org/apache/royale/binding/SimpleBinding.as | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/SimpleBinding.as b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/SimpleBinding.as
index 19884f9..d17d146 100644
--- a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/SimpleBinding.as
+++ b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/SimpleBinding.as
@@ -210,16 +210,16 @@ public class SimpleBinding implements IBead, IDocument, IBinding
 			if (sourceID != null)
 			{
 				source = dispatcher = document[sourceID] as IEventDispatcher;
+				document.addEventListener("valueChange", sourceChangeHandler);
 				if (source == null)
 				{
-					document.addEventListener("valueChange",
-							sourceChangeHandler);
 					return;
 				}
-			} else
-			source = dispatcher = document as IEventDispatcher;
-		}
+			} else {
+				source = dispatcher = document as IEventDispatcher;
+			}
 
+		}
 
 		dispatcher.addEventListener(eventName, changeHandler);
 		try


[royale-asjs] 03/03: Improved emulation of PopUpMenuButton. Support for 'explicit' label assignment as per Flex. Added support for certain dataProvider changes. Still more to do here, I think.

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 368c6fe91b6847c50c2331f8b4810a201eefcd5d
Author: greg-dove <gr...@gmail.com>
AuthorDate: Wed Jun 10 19:07:44 2020 +1200

    Improved emulation of PopUpMenuButton. Support for 'explicit' label assignment as per Flex. Added support for certain dataProvider changes. Still more to do here, I think.
---
 .../src/main/royale/mx/controls/PopUpMenuButton.as | 57 ++++++++++++++++++++--
 1 file changed, 53 insertions(+), 4 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/PopUpMenuButton.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/PopUpMenuButton.as
index 4df49cc..59639a4 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/PopUpMenuButton.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/PopUpMenuButton.as
@@ -203,6 +203,43 @@ public class PopUpMenuButton extends PopUpButton
         
         //invalidateProperties();     
     }
+
+
+    //--------------------------------------------------------------------------
+    //  label
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Storage for the label property.
+     */
+    private var _label:String = "";
+    /**
+     *  @private
+     */
+    private var labelSet:Boolean = false;
+
+    [Inspectable(category="General", defaultValue="")]
+
+    /**
+     *  @private
+     */
+    override public function set label(value:String):void
+    {
+        // labelSet is different from labelChanged as it is never unset.
+        labelSet = true;
+        _label = value;
+        setLabel();
+    }
+
+    override public function get label():String{
+        if (labelSet) return _label
+        var val:String = super.label;
+        if (val) {
+            val = val.substr(0, val.lastIndexOf(downArrowString)).replace("&nbsp;"," ");
+        }
+        return val;
+    }
     
     //--------------------------------------------------------------------------
     //  labelField
@@ -307,7 +344,11 @@ public class PopUpMenuButton extends PopUpButton
             /*if (labelSet)
                 super.label = _label;
             else*/
-                super.label = popUpMenu.itemToLabel(event.item).replace(" ", "&nbsp;") + downArrowString;
+            //    super.label = popUpMenu.itemToLabel(event.item).replace(" ", "&nbsp;") + downArrowString;
+
+            var labelBase:String = labelSet ? _label || '' : popUpMenu.itemToLabel(event.item);
+            super.label = labelBase.replace(" ", "&nbsp;") + downArrowString
+
             //setSafeIcon(popUpMenu.itemToIcon(event.item));
             menuEvent.menu = popUpMenu;
             menuEvent.menu.selectedIndex = menuEvent.index = 
@@ -335,15 +376,23 @@ public class PopUpMenuButton extends PopUpButton
         
         if (dataProvider != null)
         {
-            getPopUp();
+            if (popUpMenu) popUpMenu.dataProvider = dataProvider;
+            else getPopUp();
             if ((popUpMenu.dataProvider as ICollectionView).length > 0)
             {
                 var cursor:IViewCursor = (popUpMenu.dataProvider as ICollectionView).createCursor();
                 var value:Object = cursor.current;
-                lbl = popUpMenu.itemToLabel(value).replace(" ", "&nbsp;") + lbl;
+                if (labelSet) lbl = _label ? _label + lbl : lbl;
+                else lbl = popUpMenu.itemToLabel(value) + lbl;
+            }
+        } else {
+            if (popUpMenu) {
+                close();
+                popUpMenu = null; //tbc
             }
+            if (labelSet) lbl = _label ? _label + lbl : lbl;
         }
-        label = lbl;
+        super.label = lbl.replace(" ", "&nbsp;");
     }
 
 	}