Issue Details (XML | Word | Printable)

Key: SWINGX-1439
Type: Bug Bug
Status: Resolved Resolved
Resolution: Invalid
Priority: Critical Critical
Assignee: kleopatra
Reporter: elisad
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.

Duplicate nodes in JXTreeTable appearing as "Empty" nodes

Created: 26/Apr/11 09:20 AM   Updated: 27/Apr/11 09:27 AM   Resolved: 27/Apr/11 09:27 AM
Component/s: None
Affects Version/s: 1.6.2
Fix Version/s: 1.6.3

Time Tracking:
Not Specified

File Attachments: 1. Java Source File (1 kB) 26/Apr/11 09:21 AM - elisad
2. Java Source File (0.9 kB) 27/Apr/11 08:13 AM - elisad
3. Java Source File (2 kB) 26/Apr/11 09:21 AM - elisad
4. Java Source File (2 kB) 27/Apr/11 08:13 AM - elisad
5. Java Source File (2 kB) 27/Apr/11 08:38 AM - elisad

Participants: elisad and kleopatra

 Description  « Hide

This is about the rendering of a JXTreeTable.

Whenever the same instance of an object is inserted more than once to the tree component of a JXTreeTable, an empty node is being painted for every subsequent insertion.

We are not expecting those empty nodes.
Could you please advise us how to remove those empty nodes?

To reproduce the problem:
1- Run the attached example (
2- Click on the button "Add node D to A"
3- Expand node "A" to be able to see the added node "D"
4- Click on the button "Add node D to A" again
5- You must be able to see the blank node under node "D"
6- Repeat step 4 to see the problem again

kleopatra added a comment - 26/Apr/11 09:54 AM

looks like a problem in your model implementation - same happens in a plain JTree as well, replace the relevant part

tree = new JTree(model);
getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);

BTW: better let the TreeModelSupport do the notification, that's why it's there

To track it down, first make it work in a plain tree, if it's working there and not in JXTreeTable, you hit a treeTable issue - and we'll dig here

elisad added a comment - 27/Apr/11 08:46 AM

As you already said, using the old model implementation, the problem is also occurring in a "JTree".
Does that mean that their is a bug in the JTree or a bug in the model implementation?

I tried using the "TreeModelSupport" and it is working fine as I implemented it. You can check files [ and]

Could you please advise :
1. Is their any other way or implementation to avoid such problem?
2. Best way to insert/update/delete at runtime a node into the treetable?

Thank you

kleopatra added a comment - 27/Apr/11 09:26 AM

my guess is the model implementation (JTree is too long around as that a major bug as that would have gone undetected.

As it's not a SwingX related problem, I'm closing this. Please feel free to reopen if all works correctly in a JTree but not in a JXTreeTable.

Well, as much as I love evaluating code and digging - this is a SwingX issue tracker, not a free debug resource for custom code You might want to go to any of the public forums (first a core Swing forum to make your model work in a JTree) to try and get further help.

Hmm ... on a quick glance: it's a tree structure - this implies that each node has exactly one parent (except the root, which has no parent). So you can't add the same node twice ... What you can do is to add the same user-object to different nodes

Thanks for your interest