swingx
  1. swingx
  2. SWINGX-1442

Fix scalability when expanding a very large treetable

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.6.2
    • Fix Version/s: 1.6.3
    • Component/s: TreeTable
    • Labels:
      None
    • Environment:

      Mac OS X,
      % java -version
      java version "1.6.0_24"
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
      Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)

      Description

      I fixed a problem with expanding all of the nodes in a very large JXTreeTable. The problem is that JXTreeTable.expandAll() ends up calling TreeTableCellRenderer.getExpandedDescendants() for every expanded node; and it is recursive which make it very expensive. It takes a couple of minutes to open 25K nodes with four levels of descendents.

      The fix is to override getExpandedDescendants() so that it does nothing during an expandAll()

      Index: swingx-core/src/main/java/org/jdesktop/swingx/JXTreeTable.java
      ===================================================================
      — swingx-core/src/main/java/org/jdesktop/swingx/JXTreeTable.java (revision )
      +++ swingx-core/src/main/java/org/jdesktop/swingx/JXTreeTable.java (revision )
      @@ -135,7 +135,7 @@

      • {@link #isHierarchical(int) hierarchical}

        column.

      • renderer extends JXTree and implements TableCellRenderer
        */
      • private TreeTableCellRenderer renderer;
        + protected TreeTableCellRenderer renderer;

      /**

      • Editor used to edit cells within the
        @@ -2555,7 +2555,7 @@
        private JXTreeTable treeTable = null; // logically immutable
        }
      • static class TreeTableCellRenderer extends JXTree implements
        + public static class TreeTableCellRenderer extends JXTree implements
        TableCellRenderer
        // need to implement RolloverRenderer
        // PENDING JW: method name clash rolloverRenderer.isEnabled and
        @@ -2603,8 +2603,17 @@
        return shouldApplyDropHack() ? false : super.isVisible();
        }

      + public boolean skipExpandedDescendants = false;

      + @Override
      + public Enumeration<TreePath> getExpandedDescendants(TreePath parent) {
      + if (skipExpandedDescendants)

      { + return null; + }

      + return super.getExpandedDescendants(parent); //To change body of overridden methods use File | Settings | File Templates.
      + }
      +

        Issue Links

          Activity

          permeable created issue -
          kleopatra made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.6.3 [ 13366 ]
          Resolution Won't Fix [ 2 ]
          kleopatra made changes -
          Link This issue is related to SWINGX-1467 [ SWINGX-1467 ]

            People

            • Assignee:
              kleopatra
              Reporter:
              permeable
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: