flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-33592 Fix issue when chaining data provider on MenuBar
Date Wed, 19 Jun 2013 14:53:18 GMT
Updated Branches:
  refs/heads/develop a7cf04dd4 -> fb27961bf


FLEX-33592 Fix issue when chaining data provider on MenuBar


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/fb27961b
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/fb27961b
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/fb27961b

Branch: refs/heads/develop
Commit: fb27961bff716b547c7876737e38e2a5a6084397
Parents: a7cf04d
Author: Justin Mclean <jmclean@apache.org>
Authored: Thu Jun 20 00:52:52 2013 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Thu Jun 20 00:52:52 2013 +1000

----------------------------------------------------------------------
 .../projects/mx/src/mx/controls/MenuBar.as      | 29 ++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/fb27961b/frameworks/projects/mx/src/mx/controls/MenuBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/controls/MenuBar.as b/frameworks/projects/mx/src/mx/controls/MenuBar.as
index 8d0fdb2..0c79f85 100644
--- a/frameworks/projects/mx/src/mx/controls/MenuBar.as
+++ b/frameworks/projects/mx/src/mx/controls/MenuBar.as
@@ -1204,6 +1204,9 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent
             //reset flags 
             dataProviderChanged = false;
             showRootChanged = false;
+			
+			// forget last menu
+			openMenuIndex = -1;
         
             // are we swallowing the root?
             if (_rootModel && !_showRoot && _hasRoot)
@@ -1746,7 +1749,12 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent
         if (dataProviderChanged)
             commitProperties();
 
-        var item:IMenuBarItemRenderer = menuBarItems[index];
+        var item:IMenuBarItemRenderer;
+		
+		if (index < 0 || index >= menuBarItems.length)
+			return null;
+		
+		item = menuBarItems[index];
       
         var mdp:Object = item.data;
         var menu:Menu = menus[index];
@@ -1964,7 +1972,7 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent
                     }
                     isDown = true;
                     
-                    if (m.dataDescriptor.getType(item.data) != "separator")
+                    if (m && m.dataDescriptor.getType(item.data) != "separator")
                     {
                         requiresEvent = true;
                         //fire the change event 
@@ -1981,8 +1989,10 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent
                 else
                 {
                     var mm:Menu = getMenuAt(index);
-                    mm.deleteDependentSubMenus();
-                    mm.setFocus();
+					if (mm) {
+	                    mm.deleteDependentSubMenus();
+	                    mm.setFocus();
+					}
                 }
             }
             else
@@ -2052,7 +2062,7 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent
                 isDown = false;
             }
             
-            if (m.dataDescriptor.getType(item.data) != "separator")
+            if (m && m.dataDescriptor.getType(item.data) != "separator")
             {
                 //fire the change event 
                 var menuEvent:MenuEvent = new MenuEvent(MenuEvent.CHANGE);
@@ -2076,7 +2086,10 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent
 
         if (item.enabled && !isDown)
         {
-            getMenuAt(index).hideAllMenus();
+			var m:Menu = getMenuAt(index);
+			
+            if (m)
+				m.hideAllMenus();
             item.menuBarItemState = "itemOverSkin";
         }
     }
@@ -2090,12 +2103,12 @@ public class MenuBar extends UIComponent implements IFocusManagerComponent
         var index:int = item.menuBarItemIndex;
         var m:Menu = getMenuAt(index);
 
-        if (item.enabled && openMenuIndex != index)
+        if (item.enabled && m && openMenuIndex != index)
         {
             menuBarItems[index].menuBarItemState = "itemUpSkin";
         }
         // Fire the appropriate rollout event
-        if (item.data && 
+        if (item.data && m &&
             (m.dataDescriptor.getType(item.data) != "separator"))
         {
             var menuEvent:MenuEvent = new MenuEvent(MenuEvent.ITEM_ROLL_OUT);


Mime
View raw message