Убыстритесь расширяются/сворачивают все узлы JTree

У меня есть JTree приблизительно с 100 000 узлов или больше. Теперь я хочу развернуть целое дерево. Чтобы сделать так, я использую решение, которое я нашел здесь.

Моя проблема, это разворачивающее такое большое дерево берет как 60 секунд или больше, который не очень удобен. У кого-либо есть какие-либо предложения, как я мог ускорить расширение?

7
задан rypel 24 May 2015 в 16:12
поделиться

2 ответа

I think you need to think of a display strategy, either breadth-first (look at all direct children) or depth-first (look at all the descendants of just one child). 100,000 is far too many nodes to view on the screen and you will need to think about panning and zooming. You should think of filters that could select the subsets of descendants that you want.

One strategy could be to display the top children and when your mouse enters a child, display all its descendants and when you leave collapse them. In that way you could navigate over the tree displaying the current subtree of interest.

1
ответ дан 7 December 2019 в 07:46
поделиться

Yeah, rethink your UI element. A JTree is not what you are looking for to show 100,000 nodes. Use something where you can see a table and click items to drill-down into a table element. Then have a breadcrumb like history so the user can navigate up the hierarchy..

If you are insistent on having a JTree, there is a way to take over they way it repaints, but I don't know if that will help you with the expand problem.

0
ответ дан 7 December 2019 в 07:46
поделиться
Другие вопросы по тегам:

Похожие вопросы: