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

carlosrovira 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 ce0f796  fix item renderer issue using change event handler. More 
elegant but I think MouseEvents has some issues working wrong at least in List 
component, currentTarget seems not to be set and itemClicked seems not to be 
available from  mxml
ce0f796 is described below

commit ce0f796cc91cce135d786059b6014fc3e4049a82
Author: Carlos Rovira <[email protected]>
AuthorDate: Tue Jul 3 16:50:28 2018 +0200

    fix item renderer issue using change event handler. More elegant but I 
think MouseEvents has some issues working wrong at least in List component, 
currentTarget seems not to be set and itemClicked seems not to be available 
from  mxml
---
 .../src/main/resources/jewel-example-styles.css         |  4 ++--
 .../JewelExample/src/main/royale/MainContent.mxml       | 17 +++++++----------
 .../org/apache/royale/jewel/ApplicationMainContent.as   | 17 ++++++++++++-----
 .../controllers/ListSingleSelectionMouseController.as   |  2 +-
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git 
a/examples/royale/JewelExample/src/main/resources/jewel-example-styles.css 
b/examples/royale/JewelExample/src/main/resources/jewel-example-styles.css
index 4c13e1c..d098485 100644
--- a/examples/royale/JewelExample/src/main/resources/jewel-example-styles.css
+++ b/examples/royale/JewelExample/src/main/resources/jewel-example-styles.css
@@ -25,12 +25,12 @@
     margin: 20px;
 }
 
-.navIconLinItemRenderer
+.navIconLinkItemRenderer
 {
     IItemRenderer: 
ClassReference("itemRenderers.NavigationIconLinkItemRenderer");
 }
 
-.navIconLinItemRenderer .icon
+.navIconLinkItemRenderer .icon
 {
     margin-right: 24px;
 }
diff --git a/examples/royale/JewelExample/src/main/royale/MainContent.mxml 
b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
index c069751..354d6c9 100644
--- a/examples/royale/JewelExample/src/main/royale/MainContent.mxml
+++ b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
@@ -26,15 +26,12 @@ limitations under the License.
     
     <fx:Script>
         <![CDATA[
-            import org.apache.royale.jewel.supportClasses.INavigationRenderer;
-
-            private function clickHandler(event:MouseEvent):void
+            import vos.NavigationLinkVO;
+            
+            private function changeHandler(event:Event):void
             {
-                var renderer:INavigationRenderer = event.target as 
INavigationRenderer;
-                //if (renderer == null) return;
-
-                           var link:String = renderer.href;
-                main.showContent(link);
+                var item:NavigationLinkVO = (event.target as 
Navigation).selectedItem as NavigationLinkVO;
+                main.showContent(item.href);
                 drawer.close();
             }
         ]]>
@@ -53,7 +50,7 @@ limitations under the License.
             <j:Image src="assets/apache-royale-jewel-logo-white.svg"/>
         </j:DrawerHeader>
         <j:DrawerContent>
-            <j:Navigation click="clickHandler(event)" 
className="navIconLinItemRenderer">
+            <j:Navigation change="changeHandler(event)" 
className="navIconLinkItemRenderer">
                 <j:beads>
                     <js:ConstantBinding
                         sourceID="mainNavigationModel"
@@ -62,7 +59,7 @@ limitations under the License.
                 </j:beads>
             </j:Navigation>
             <j:Divider/>
-            <j:Navigation click="clickHandler(event)" 
className="navIconLinItemRenderer">
+            <j:Navigation change="changeHandler(event)" 
className="navIconLinkItemRenderer">
                 <j:beads>
                     <js:ConstantBinding
                         sourceID="mainNavigationModel"
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
index ade2756..39bc8e6 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
@@ -68,14 +68,21 @@ package org.apache.royale.jewel
                        for (var i:int = 0; i < numElements; i++)
                        {
                                var content:IActivable = getElementAt(i) as 
IActivable;
-                               
-                               if(content.id == id)
+
+                               try
                                {
-                                       content.isActive = true;
+                                       if(content.id == id)
+                                       {
+                                               content.isActive = true;
+                                       }
+                                       else
+                                       {
+                                               content.isActive = false;
+                                       }
                                }
-                               else
+                               catch (error:Error)
                                {
-                                       content.isActive = false;
+                                       throw new Error ("One or more content 
in ApplicationMainContent is not implementing IActivable interface.");    
                                }
                        }
         }
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/ListSingleSelectionMouseController.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/ListSingleSelectionMouseController.as
index f723b13..d2b5a9f 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/ListSingleSelectionMouseController.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/ListSingleSelectionMouseController.as
@@ -35,7 +35,7 @@ package org.apache.royale.jewel.beads.controllers
 
     /**
      *  The ListSingleSelectionMouseController class is a controller for
-     *  org.apache.royale.html.List.  Controllers
+     *  org.apache.royale.jewel.List.  Controllers
      *  watch for events from the interactive portions of a View and
      *  update the data model or dispatch a semantic event.
      *  This controller watches for events from the item renderers

Reply via email to