AsyncTreeModel getSelectionPath() cache problem
Answered
After AsyncTreeModel refreshes the tree with treeStructureChanged(null, null, null), it finds that the TreePath obtained by calling this.myTree.getSelectionPath() is still the old TreePath, and it will take a few minutes to refresh to the latest TreePath. Is there a way to do this? Get the latest TreePath immediately
Please sign in to leave a comment.
I have found a solution, please delete this post, thank you
Could you please elaborate? especially about "after a few minutes", does your model really take that long to re-calc?
I don't know why this is happening, but the phenomenon is: my tree seems to be changed to the latest, and I debug to see that the data in the tree is the latest, but when getSelectionPath, it returns the old data, etc. After a few minutes, I call this method again or I reopen the project to get the data in the latest model,
I feel that it is a calculation bug. I tested it later and found that this problem is related to the hashcode and equels methods of the model. When the field that calculates these two values is not in this, the field will appear above if it is modified. The problem, if the field that calculates the above value is inside, there will be no such problem