• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTreeTable programmatic selection

Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • 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?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic