Discussions
Categories
- 197K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.8K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 556 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.4K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 110 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 205 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 468 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
Needing wisdom re NetBeans Outline ("tree table") component

skiaddict1
Member Posts: 72
Greetings all,
I realise I should be posting this on a netbeans forum, and I have already done so, but no-one seems to want to reply over there... :-< So I'm hoping someone here has some relevant experience with this component.
I have two questions:
1. Has anyone managed to get notifications when the user edits a node in the tree part of the treetable? I can get the nodes to be editable, I can type in a change to the text there, but I'm not getting any notification of the change! I have tried registering the Outline model as a TreeModelListener and implementing treeNodesChanged(). I have tried registering the Outline as a TableModelListener and implementing tableChanged(). Nothing is working: I don't get the notifications. Does some kind person have some sample code, or a pointer to some, which would get me going in the right direction? Unless absolutely necessary I would rather not post my code, since it's "complicated"... ;->
2. Can anyone confirm whether this component supports drag 'n' drop? I haven't even started on that journey yet, so knowing "yes" or "no" would be very helpful.
Grateful thanks, as always, for any and all help :->
I realise I should be posting this on a netbeans forum, and I have already done so, but no-one seems to want to reply over there... :-< So I'm hoping someone here has some relevant experience with this component.
I have two questions:
1. Has anyone managed to get notifications when the user edits a node in the tree part of the treetable? I can get the nodes to be editable, I can type in a change to the text there, but I'm not getting any notification of the change! I have tried registering the Outline model as a TreeModelListener and implementing treeNodesChanged(). I have tried registering the Outline as a TableModelListener and implementing tableChanged(). Nothing is working: I don't get the notifications. Does some kind person have some sample code, or a pointer to some, which would get me going in the right direction? Unless absolutely necessary I would rather not post my code, since it's "complicated"... ;->
2. Can anyone confirm whether this component supports drag 'n' drop? I haven't even started on that journey yet, so knowing "yes" or "no" would be very helpful.
Grateful thanks, as always, for any and all help :->
Answers
-
(Responding to my own thread in case the following is of use to someone else someday...)
Here is how to get this to work:private class TreeTable extends Outline implements TableModel { public void setValueAt(Object aValue, int rowIndex, int columnIndex) { NodeObjectType node= (NodeObjectType) getPathForRow(rowIndex).getLastPathComponent(); System.out.println("The user has finished editing the node."); System.out.println("Old value: " + node.toString()); System.out.println("New value: " + aValue); } public TreePath getPathForRow(int rowInUI) { int row = convertRowIndexToModel(rowInUI); if (getLayoutCache() != null) { return getLayoutCache().getPathForRow(row); } else { return null; } } ... }
where NodeObjectType is the object that you are using for each node of the tree.
I haven't yet gone into drag 'n' drop, so I can't advise anything on that one. TIA still for tips & pointers with that :->
This discussion has been closed.