• 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JTreeTable programmatic selection

 
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 guys,
For my treetable component I am using the code from the second article by Sun: JTreeTable II.
Rendering, user selection etc. works fine.
What my treetable does:
- it is not editable (except for expanding and collapsing the nodes, of course).
- via a JMenuItem it is possible to group leafs to nodes according to some data information in the model. I mean, by selecting the menuitem, the model will reorder its data and group specific leafs under a newly created node. the user has no influence on what nodes are grouped, he/she just triggers the process. (this changes the view from displaying simple terms to terms grouped by synonym relation.)
the grouping works fine. what does not work is:
when the nodes are regrouped, the current selection is lost as the treetable has to be rerendered. I would like to set the selection after the rendering is finished:

I placed System.out.printlns all over the place and I can see that:
- the current selection is stored
- the grouping is done, including updating the view
- the old selection is set in the selection model
- clearSelection is called three times
- the effect is: no row is selected, one cell in the formerly selected row is focused
Thread.dumpStack in clearSelection does not really clear things up. there are lots of pumpEvent calls, and some table.valueChanged calls. So obviously the table updates again. but why?
I am quite sure that I am not firing any update events at that time in any of the classes (I should have seen that with all the System.out.printlns).
Any ideas? Debugging tips?
Thanks!
Chantal
 
Hold that thought. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic