0

I have a panel that contains a checkboxTree , I populate the tree when open the panel , the problem is when i have to much items to be selected in the checkboxtree (about 4000) the panel take a long time to open . this is my code:

checkBoxTree.getCheckBoxTreeSelectionModel().setDigIn(true);

    List<TreePath> paths = new ArrayList<TreePath>();
    Enumeration<?> e = projectNode.breadthFirstEnumeration();

    while (e.hasMoreElements())
    {
        IconNode node = (IconNode) e.nextElement();
        if(node.isLeaf() && node.isSelected())
            paths.add(new TreePath(node.getPath()));
    }

    TreePath[] array = new TreePath[paths.size()];
    array =  paths.toArray(new TreePath[0]);        
    checkBoxTree.getCheckBoxTreeSelectionModel().setSelectionPaths(array);

any suggestions will be welcomed :) ,

  • having 4000 checkbox is a bad idea in terms of usability too.. can't you use something else.. like select dropdown .. or first reduce the number of usecases for which you require 4000 checkboxes – AurA Apr 30 '14 at 08:31
  • this is the requirement :( I need to show all elements in the tree and check the already selected elements – user3588393 Apr 30 '14 at 08:37

0 Answers0