You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2008/08/23 09:14:54 UTC

svn commit: r688272 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java

Author: matzew
Date: Sat Aug 23 00:14:53 2008
New Revision: 688272

URL: http://svn.apache.org/viewvc?rev=688272&view=rev
Log:
TRINIDAD-1189 - Tree Expand All Handling

Thx to Kamran Kashanian for his patch
I ported the fix to JSF 1.1 trunk as well

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java?rev=688272&r1=688271&r2=688272&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java Sat Aug 23 00:14:53 2008
@@ -40,35 +40,12 @@
     RowKeySet     state,
     MethodBinding disclosureListener) throws AbortProcessingException
   {
-  
-        // Notify the specified disclosure listener method (if any)
+    // Notify the specified disclosure listener method (if any)
     if (event instanceof RowDisclosureEvent)
     {
       RowDisclosureEvent dEvent = (RowDisclosureEvent) event;
       state.removeAll(dEvent.getRemovedSet());
-      RowKeySet added = dEvent.getAddedSet();
-      int size = 0;
-      // only do an unbounded expandAll if the number of new nodes is not
-      // too large:
-      // FIXME: Wouldn't .size() do the work instead of looping 100 times...
-      // FIXME RESPONSE: .size() can be expensive for RowKeySets.
-      // However, getSize() can be called, and will return -1 if it's
-      // expensive.  We should likely use getSize() first, see if it's
-      // >= 0 and < 100, then otherwise go into this code
-      for(Object key : added)
-      {
-        if (++size > 100)
-          break;
-      }
-      if (size < 100)
-        state.addAll(added);
-      else
-      {
-        // TODO : this method counts the nodes in a subtree again.
-        // optimize by just expanding the direct children, without
-        // having to count all over again:
-        TableUtils.__doSafeExpandAll(comp.getTreeModel(), state, 100);
-      }
+      state.addAll(dEvent.getAddedSet());
       //pu: Implicitly record a Change for 'disclosedRowKeys' attribute
       comp.addAttributeChange("disclosedRowKeys", state);
       comp.broadcastToMethodBinding(event, disclosureListener);