triggering tree update when tree node user object changes

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

triggering tree update when tree node user object changes

Postby pfriend » Sun Dec 04, 2011 4:43 pm

Greetings,

I dug through the forums for some time looking for a solution to this and must have missed it. I have been evaluating the library and am pleased so far but having issues with dynamic node updates.

I am using CheckBoxTree with a DefaultTreeModel. The toString() method of the nodes user object changes over time, and when I make this change I use this bit of code to update the node:

Code: Select all
DefaultTreeModel model = (DefaultTreeModel)tree.getModel();
model.nodeChanged(node);


What I end up seeing is the original text label of the node with "..." following. Debug output confirms that toString() is returning the string I expect. Currently I am just changing the text of node, but later I will be modifying the icons dynamically as well. What is the proper way to get the UI to refresh properly.

This is being run outside of the UI event thread but it's wrapped in a runnable and invoked with invokeLater();

Thanks in advance,

Peter
pfriend
 
Posts: 18
Joined: Sun Dec 04, 2011 3:47 pm

Re: triggering tree update when tree node user object change

Postby pfriend » Sun Dec 04, 2011 5:12 pm

Ok this one ended up being developer error, the text is updating properly now (passing null to nodeChanged() doesn't work so hot). I blame lack of coffee... Will continue with eval.

Thanks,

Peter
pfriend
 
Posts: 18
Joined: Sun Dec 04, 2011 3:47 pm


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: Google [Bot] and 6 guests

cron