3

I'm trying to set a custom tree cell editor for the tree column of a JXTreeTable, but for some reason, my editor is never called.

Here's the bit that is supposed to set the editor:

dataTable.setDefaultEditor(DataEntity.class, new NumberedListEditor(hierarchyRelation));

My implementation of getColumnClass() returns DataEntity.class and I overrode isCellEditable() in my model to always return true.

What else could be the problem?

whatknight
  • 303
  • 1
  • 7
  • if you want that custom editor in the hierarchical column - that's not cleanly possible currently (see http://java.net/jira/browse/SWINGX-1272 which has a link to a workaround) If it's on another column, somehting else is wrong, please show an SSCCE that demonstrates the problem – kleopatra Jul 13 '12 at 13:08
  • I may have found that out the hard way. I ended up doing exactly what the workaround suggested. I never saw the default `TreeTableTextField` editor but that may be because my rendering component isn't a JLabel. It's a JRenderingPanel with two JLabels inside of it. Now I'm trying to override setBounds() to draw the editor in the right place (pretty much exactly how TreeTableTextField does it) but with minimal success. Thanks a bunch for your quick answer! – whatknight Jul 13 '12 at 13:53
  • @kleopatra : Could you please explain in some detail about the solution that you have explained here - java.net/jira/browse/SWINGX-1272 . I tried the same thing but no effect...You can see my question at - http://stackoverflow.com/questions/20909379/jxtreetable-custom-cell-editor – ayush Jan 03 '14 at 19:26
  • @kleopatra Workaround link on the JIRA is changed or dead, do you have new link? – digz6666 Mar 06 '17 at 10:28
  • no, sorry, kenai is dead :-( – kleopatra Mar 06 '17 at 15:25

1 Answers1

0

setDefaultEditor() works for me:

tbl_attribute.setDefaultEditor(String.class, new FeatureSearchAttributeTreeCellEditor());
digz6666
  • 1,798
  • 1
  • 27
  • 37