You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by to...@apache.org on 2006/05/26 00:17:07 UTC

svn commit: r409487 - in /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu: HtmlCommandNavigationItem.java HtmlNavigationMenuRenderer.java

Author: tomsp
Date: Thu May 25 15:17:07 2006
New Revision: 409487

URL: http://svn.apache.org/viewvc?rev=409487&view=rev
Log:
bugfix in restoreOpenActiveStates

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlCommandNavigationItem.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlCommandNavigationItem.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlCommandNavigationItem.java?rev=409487&r1=409486&r2=409487&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlCommandNavigationItem.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlCommandNavigationItem.java Thu May 25 15:17:07 2006
@@ -163,7 +163,7 @@
             UIComponent parent = getParent();
 
             //close all siblings
-            closeAllChildren(parent.getChildren().iterator());
+            closeAllChildren(parent.getChildren().iterator(), this, true);
 
             //open all parents (to be sure) and search HtmlPanelNavigation
             UIComponent p = parent;
@@ -220,13 +220,15 @@
         }
     }
 
-    private static void closeAllChildren(Iterator children) {
+    private static void closeAllChildren(Iterator children, HtmlCommandNavigationItem current, boolean resetActive) {
         while (children.hasNext()) {
             UIComponent ni = (UIComponent) children.next();
             if (ni instanceof HtmlCommandNavigationItem) {
                 ((HtmlCommandNavigationItem) ni).setOpen(false);
+                if (resetActive)
+                    ((HtmlCommandNavigationItem) ni).setActive(false);
                 if (ni.getChildCount() > 0) {
-                    closeAllChildren(ni.getChildren().iterator());
+                    closeAllChildren(ni.getChildren().iterator(), current, current != ni);
                 }
             }
         }

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java?rev=409487&r1=409486&r2=409487&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java Thu May 25 15:17:07 2006
@@ -141,14 +141,14 @@
                 if (prevItem.isOpen() || prevItem.isActive()) {
                     HtmlCommandNavigationItem item = (HtmlCommandNavigationItem) panelNav.findComponent(uiComponent.getClientId(facesContext));
                     if (item != null) {
-                        if (item.getActiveDirectly() != null) {
+                        if (item.getActiveDirectly() != null && item.getActiveDirectly().booleanValue()) {
                             item.setActive(prevItem.isActive());
                         }
                         else {
                             copyValueBinding(prevItem, item, "active");
                         }
 
-                        if (item.getOpenDirectly() != null) {
+                        if (item.getOpenDirectly() != null && item.getOpenDirectly().booleanValue()) {
                             item.setOpen(prevItem.isOpen());
                         }
                         else {