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:08:04 UTC

svn commit: r688270 - /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java

Author: matzew
Date: Sat Aug 23 00:08:03 2008
New Revision: 688270

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

Thx to Kamran Kashanian for his patch

Modified:
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java?rev=688270&r1=688269&r2=688270&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java Sat Aug 23 00:08:03 2008
@@ -40,42 +40,12 @@
     RowKeySet     state,
     MethodExpression method) throws AbortProcessingException
   {
-  
     // 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
-      
-      size = added.getSize();
-      if(size < 0)
-      {
-        size = 0;
-        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.broadcastToMethodExpression(event, method);