You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2018/04/13 13:42:13 UTC

[myfaces-tobago] branch master updated: Demo: Nav-Tree: close the other nodes, if opening a new

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

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new f6955a8  Demo: Nav-Tree: close the other nodes, if opening a new
f6955a8 is described below

commit f6955a824eae1ea9d521eec5c3ad6bb4ad0f32cc
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Fri Apr 13 15:41:43 2018 +0200

    Demo: Nav-Tree: close the other nodes, if opening a new
---
 .../org/apache/myfaces/tobago/example/demo/NavigationState.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
index 53f35e3..4db32a7 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
@@ -57,6 +57,7 @@ public class NavigationState implements Serializable {
   private void initState() {
     if (currentNode != null) {
       state.getSelectedState().clearAndSelect(currentNode.getTreePath());
+      state.getExpandedState().collapseAllButRoot();
       state.getExpandedState().expand(currentNode.getTreePath(), true);
     }
   }
@@ -101,9 +102,11 @@ public class NavigationState implements Serializable {
     if (node == null) {
       return gotoFirst();
     } else {
-      currentNode = node;
+      if (!node.equals(currentNode)) {
+        currentNode = node;
+        LOG.info("Navigate to '" + currentNode.getOutcome() + "'");
+      }
       initState();
-      LOG.info("Navigate to '" + currentNode.getOutcome() + "'");
       return currentNode.getOutcome();
     }
   }

-- 
To stop receiving notification emails like this one, please contact
lofwyr@apache.org.