This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

JTree Update Design Question

Ranch Hand
Posts: 15304
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JTree with 3 Nodes, Unaccepted, Accepted, and Closed. Under these nodes, the leaves are Trouble Tickets. The tree gets populated from a Database.
Several people will be modifying the database therefore the ticket status will change periodically. I am developing a polling method to update the JTree every 5 minutes.
My question is:
1. Should I just query the database and rebuild the tree everytime no matter what?
2. Should I do some checking so that the Tree is only updated if there are new Trouble Tickets.
And, if 2 is the way to go, should I rebuild the entire tree, or should I only add those Tickets to the appropriate node that are new?
The main thing I am looking for is performance.
Thanks for any suggestions.
[ November 21, 2002: Message edited by: Gregg Bolinger ]
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Gregg,
IMHO updating of the tree is done automatically whenever the treemodel fires a change event. so, the kind of the update depends on the event that is fired. very similar to the JTabel-TableModel communication. I would try to reduce the updating as much as possible for if the tree gets big, it might flicker when it is updated from scratch. most of the time, updating the whole thing is simply unnecessary, I suppose.
What I just thought of: you could create a table in the database itself that stores the information that and what data was changed, and when. thus, you won't have to check changes against your treemodel. each client would have to know when the last change happened, or what ID it had or whatever, to know which changes haven't been applied to it, yet. don't know, if that would work.
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic