You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/08/07 01:24:45 UTC

svn commit: r801841 - /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Frame.java

Author: gbrown
Date: Thu Aug  6 23:24:44 2009
New Revision: 801841

URL: http://svn.apache.org/viewvc?rev=801841&view=rev
Log:
Minor fix to menu bar handling in Frame.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Frame.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Frame.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Frame.java?rev=801841&r1=801840&r2=801841&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Frame.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Frame.java Thu Aug  6 23:24:44 2009
@@ -82,45 +82,47 @@
 
     @Override
     protected void setFocusDescendant(Component focusDescendant) {
-        Component previousFocusDescendant = getFocusDescendant();
-
-        // Walk down previous focus descendant hierarchy and call cleanupMenuBar()
-        if (previousFocusDescendant != null) {
-            LinkedList<Component> previousFocusDescendantPath = new LinkedList<Component>();
-
-            Component previousFocusAncestor = previousFocusDescendant;
-            while (!(previousFocusAncestor instanceof Display)) {
-                previousFocusDescendantPath.insert(previousFocusAncestor, 0);
-            }
+        if (menuBar != null) {
+            // Walk down previous focus descendant hierarchy and call cleanupMenuBar()
+            Component previousFocusDescendant = getFocusDescendant();
+
+            if (previousFocusDescendant != null) {
+                LinkedList<Component> previousFocusDescendantPath = new LinkedList<Component>();
+
+                Component previousFocusAncestor = previousFocusDescendant;
+                while (!(previousFocusAncestor instanceof Display)) {
+                    previousFocusDescendantPath.insert(previousFocusAncestor, 0);
+                }
 
-            for (Component component : previousFocusDescendantPath) {
-                MenuHandler menuHandler = component.getMenuHandler();
+                for (Component component : previousFocusDescendantPath) {
+                    MenuHandler menuHandler = component.getMenuHandler();
 
-                if (menuHandler != null) {
-                    menuHandler.cleanupMenuBar(component, menuBar);
+                    if (menuHandler != null) {
+                        menuHandler.cleanupMenuBar(component, menuBar);
+                    }
                 }
             }
-        }
-
-        super.setFocusDescendant(focusDescendant);
 
-        // Walk down focus descendant hierarchy and call configureMenuBar()
-        if (focusDescendant != null) {
-            LinkedList<Component> focusDescendantPath = new LinkedList<Component>();
-
-            Component focusAncestor = focusDescendant;
-            while (!(focusAncestor instanceof Display)) {
-                focusDescendantPath.insert(focusAncestor, 0);
-            }
+            // Walk down focus descendant hierarchy and call configureMenuBar()
+            if (focusDescendant != null) {
+                LinkedList<Component> focusDescendantPath = new LinkedList<Component>();
+
+                Component focusAncestor = focusDescendant;
+                while (!(focusAncestor instanceof Display)) {
+                    focusDescendantPath.insert(focusAncestor, 0);
+                }
 
-            for (Component component : focusDescendantPath) {
-                MenuHandler menuHandler = component.getMenuHandler();
+                for (Component component : focusDescendantPath) {
+                    MenuHandler menuHandler = component.getMenuHandler();
 
-                if (menuHandler != null) {
-                    menuHandler.configureMenuBar(component, menuBar);
+                    if (menuHandler != null) {
+                        menuHandler.configureMenuBar(component, menuBar);
+                    }
                 }
             }
         }
+
+        super.setFocusDescendant(focusDescendant);
     }
 
     @Override