# Revision history [back]

Now I see your point ... and I see the inconsistency which I'll post as a separate issue for investigation/fixing.

However as of your current code it looks you are doing something unnecessary. The DefaultTreeModel (implementing Selectable/TreeSelectableModel) will already synchronize the current selection automatically (without calling treeModel.setSelection), which is a huge benefit about using a model based approach (also the opened state it managed in a similar fashion).

So if you do nothing the current selection (treeModel.getSelection()) will automatically be up-do-date as in the updated example.

I hope this will help as a workaround for now. I'll post the related JIRA issue shortly.

Now I see your point ... and I see the inconsistency which I'll post as a separate issue for investigation/fixing.

However as of your current code it looks you are doing something unnecessary. The DefaultTreeModel (implementing Selectable/TreeSelectableModel) will already synchronize the current selection automatically (without calling treeModel.setSelection), which is a huge benefit about using a model based approach (also the opened state it managed in a similar fashion).

So if you do nothing the current selection (treeModel.getSelection()) will automatically be up-do-date as in the updated example.

I hope this will help as a workaround for now. I'll post the related JIRA issue shortly.now.

UPDATE: posted ZK-3738

Now I see your point ... and I see the inconsistency which I'll post as a separate issue for investigation/fixing.

However as of your current code it looks you are doing something unnecessary. The DefaultTreeModel (implementing Selectable/TreeSelectableModel) will already synchronize the current selection automatically (without calling treeModel.setSelection), which is a huge benefit about using a model based approach (also the opened state it managed in a similar fashion).

So if you do nothing the current selection (treeModel.getSelection()) will automatically be up-do-date as in the updated example.

I hope this will help as a workaround for now.

UPDATE: posted ZK-3738 -> FIXED (will be in 8.5.2)

Support Options
• Email Support
• Training
• Consulting
• Outsourcing