I have a JXTreeTable with parent and child rows. I have a situation where I need to delete the parent, and move the child up to the level of the other parents. Is there a way to do this?
Asked
Active
Viewed 307 times
0
-
If it were a JTree, you could grab a reference to the parent (node.getParent()), get all the children an simply reinsert them using DefaultTreeModel.insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index), but I'm not sure about the JXTreeTable. Something simular might work. I think you're manually going have to reassign the child node's parent reference and fire the "nodesInserted" event your self – MadProgrammer Jul 20 '12 at 06:56
-
@Rex did you meaning Drag_and_Drop???, then yes is possible – mKorbel Jul 20 '12 at 07:00
-
How are your nodes implemented? From memory, JXTreeTable allows for Object nodes – MadProgrammer Jul 20 '12 at 21:44
-
same way as in a plain JTree: manipulate your treeTableModel (which must implement the correct notifications, of course :-) – kleopatra Jul 21 '12 at 16:46