How to call getChildren() without UI event ITreeContentProvider?

159 Views Asked by At
    @Override
    public Object[] getChildren(Object parentElement) {
        if (parentElement instanceof List) {
            List<?> arraysList = ((List<?>) parentElement).stream()
                    .filter(p -> p instanceof List && !((List<?>) p).isEmpty()).collect(Collectors.toList());
            datas = arraysList.toArray();
            return arraysList.toArray();
        }
        return null;
    }

getChildren() method is invoked and fill the child node data when a user tries to expand the child node. If I try to expand the child node programmatically before getChildren() get called it's showing the tree like this. So there any idea to initialize the child nodes or call getChildren() programmatically ?

when I call the item.setExpanded(true) to expand the child node and its showing like this

enter image description here

enter image description here

but if i expand any of the 1-9 node from UI it will call the getChildren() method and fill the child data for that specific node for eg: im expanding node 4 here and the next time when i click the searchAction (item.setExpanded(true)) its showing the child node of 4 only because it set data when i expanded from UI i need to set the child node data for all the nodes enter image description here

0

There are 0 best solutions below