Fwd: [royale-asjs] branch develop updated: handle showRoot=false and item click event

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fwd: [royale-asjs] branch develop updated: handle showRoot=false and item click event

serkan
I found it !

I guess this one you mentioned Alex,

I am checking it.

Thanks,
Serkan


-------- İletilmiş İleti --------
Konu: [royale-asjs] branch develop updated: handle showRoot=false and item click event
Tarih: Thu, 14 May 2020 08:01:51 +0000
Kimden: [hidden email]
Reply-To: [hidden email]
Kime: [hidden email] [hidden email]


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

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


The following commit(s) were added to refs/heads/develop by this push:
new 928e3a2 handle showRoot=false and item click event
928e3a2 is described below

commit 928e3a2779b15c5e0cbe012407b9b4dd53aa76d3
Author: Alex Harui [hidden email]
AuthorDate: Thu May 14 01:00:09 2020 -0700

handle showRoot=false and item click event
---
.../MXRoyale/src/main/royale/mx/controls/Menu.as | 5 ++++-
.../CascadingMenuSelectionMouseController.as | 22 ++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Menu.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Menu.as
index b4d292b..0097265 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Menu.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Menu.as
@@ -939,7 +939,10 @@ package mx.controls
_hasRoot = true;
var xl:XMLList = new XMLList();
xl += value;
- _rootModel = new XMLListCollection(xl);
+ if (showRoot)
+ _rootModel = new XMLListCollection(xl);
+ else
+ _rootModel = new XMLListCollection(xl.children());
}
//if already a collection dont make new one
else if (value is ICollectionView)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/controllers/CascadingMenuSelectionMouseController.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/controllers/CascadingMenuSelectionMouseController.as
index 919f1cb..37dc6be 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/controllers/CascadingMenuSelectionMouseController.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/controllers/CascadingMenuSelectionMouseController.as
@@ -24,6 +24,10 @@ package mx.controls.beads.controllers
import org.apache.royale.html.beads.controllers.CascadingMenuSelectionMouseController;
import org.apache.royale.html.beads.models.CascadingMenuModel;
import org.apache.royale.html.CascadingMenu;
+ import org.apache.royale.events.ItemClickedEvent;
+
+ import mx.controls.Menu;
+ import mx.events.MenuEvent;
/**
* The CascadingMenuSelectionMouseController is the default controller for emulation cascading menu
@@ -55,6 +59,24 @@ package mx.controls.beads.controllers
return (node as XML).children().length() > 0;
}
+ override protected function selectedHandler(event:ItemClickedEvent):void
+ {
+ super.selectedHandler(event);
+ var menuEvent:MenuEvent = new MenuEvent(MenuEvent.ITEM_CLICK);
+ var data:Object = event.target.data;
+ var menu:Menu = findMenuDispatcher() as Menu;
+ var label:String;
+ if (data is XML)
+ {
+ label = data.attribute(menu.labelField);
+ }
+ else
+ {
+ label = data[menu.labelField];
+ }
+ menuEvent.label = label
+ findMenuDispatcher().dispatchEvent(menuEvent);
+ }
/**
* @private