myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1735392 - in /myfaces/tobago/trunk: ./ tobago-core/src/main/java/org/apache/myfaces/tobago/model/ tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/
Date Thu, 17 Mar 2016 10:27:45 GMT
Author: lofwyr
Date: Thu Mar 17 10:27:45 2016
New Revision: 1735392

URL: http://svn.apache.org/viewvc?rev=1735392&view=rev
Log:
Merged from tobago-3.0.x
TOBAGO-1547 - ExpandedState of tree should be expandable with all parents [from revision 1735391]

Modified:
    myfaces/tobago/trunk/   (props changed)
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/ExpandedState.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java

Propchange: myfaces/tobago/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 17 10:27:45 2016
@@ -1,3 +1,3 @@
 /myfaces/tobago/branches/tobago-1.5.x:1356585,1357124
-/myfaces/tobago/branches/tobago-3.0.x:1646189,1646226,1650101,1660635,1672073,1678908-1678909,1679416,1708972,1714163,1714169,1716162,1719631,1730328
+/myfaces/tobago/branches/tobago-3.0.x:1646189,1646226,1650101,1660635,1672073,1678908-1678909,1679416,1708972,1714163,1714169,1716162,1719631,1730328,1735391
 /myfaces/tobago/branches/tobago-tree-table:1226794-1341423

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/ExpandedState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/ExpandedState.java?rev=1735392&r1=1735391&r2=1735392&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/ExpandedState.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/ExpandedState.java
Thu Mar 17 10:27:45 2016
@@ -81,8 +81,18 @@ public class ExpandedState implements Se
    * @param node The node to expand.
    */
   public void expand(final TreeNode node) {
+    expand(node, false);
+  }
+
+  /**
+   * Expands a single node.
+   *
+   * @param node The node to expand.
+   * @param parents Should the parents also be expanded?
+   */
+  public void expand(final TreeNode node, final boolean parents) {
     final TreePath path = new TreePath(node);
-    expand(path);
+    expand(path, parents);
   }
 
   /**
@@ -91,11 +101,24 @@ public class ExpandedState implements Se
    * @param path The path of the node to expand.
    */
   public void expand(final TreePath path) {
+    expand(path, false);
+  }
+
+  /**
+   * Expands a single node.
+   *
+   * @param path The path of the node to expand.
+   * @param parents Should the parents also be expanded?
+   */
+  public void expand(final TreePath path, final boolean parents) {
     if (path.getLength() >= defaultExpandedLevels) {
       expandedSet.add(path);
     } else {
       collapsedSet.remove(path);
     }
+    if (parents && ! path.isRoot()) {
+      expand(path.getParent(), true);
+    }
   }
 
   /**

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java?rev=1735392&r1=1735391&r2=1735392&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreePath.java
Thu Mar 17 10:27:45 2016
@@ -116,6 +116,14 @@ public class TreePath implements Seriali
     return path;
   }
 
+  public TreePath getParent() {
+    return new TreePath(Arrays.copyOf(path, path.length - 1));
+  }
+
+  public boolean isRoot() {
+    return path.length == 0;
+  }
+
   public int getLength() {
     return path.length;
   }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java?rev=1735392&r1=1735391&r2=1735392&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationState.java
Thu Mar 17 10:27:45 2016
@@ -55,7 +55,7 @@ public class NavigationState implements
   private void initState() {
     if (currentNode != null) {
       state.getSelectedState().clearAndSelect(currentNode.getTreePath());
-      state.getExpandedState().expand(currentNode.getTreePath());
+      state.getExpandedState().expand(currentNode.getTreePath(), true);
     }
   }
 



Mime
View raw message