how to apply custom editor to hierarchical column in JXTreeTable? -
i have jxtreetable data model extends defaulttreetablemodel, , customnode extends abstractmutabletreetablenode. each column editable expected, hierarchical tree node.
how apply custom editor (treetablecelleditor) hierarchical column in jxtreetable?
the following several attempts, yet yielded not expected results:
treetable.setcelleditor(editor) treetable.getcolumnmodel().getcolumn(0).setcelleditor(editor) treetable.getcolumn(0).setcelleditor(editor) treetable.getcolumnext(0).setcelleditor(editor)
i able inherent tree used rendering hierarchical column, unable specify custom editor through it.
private jtree gettree(jxtreetable treetable){ try{ field field = jxtreetable.class.getdeclaredfield("renderer"); field.setaccessible(true); return (jtree)field.get(treetable); }catch(nosuchfieldexception | securityexception | illegalargumentexception | illegalaccessexception ex){ throw new runtimeexception(ex); } }
it seems there "workaround" posted previsouly not able access page content: http://forums.java.net/jive/message.jspa?messageid=387603 (in https://java.net/projects/swingx/lists/issues/archive/2012-06/message/22)
any clue specify custom editor tree column?
thank feedback.
i have no reputation comment, wayback machine "workaround" mentioned "will": https://web.archive.org/web/20120831192839/http://www.java.net/node/701358
in case (if link removed) here "workaround" answer (as is), powered kleopatra:
hmmm ... right: looks have no api hook custom editor. please file issue don't forget? not there high probability have tackled time soon, knows (volunteering anybody?)
meanwhile, way see subclass treetable , override getcelleditor, like:
@override public tablecelleditor gettablecelleditor(row, column) { if (ishierachicalcolumn(column)) { return mytreetablecelleditor; } return super.... }
the way hold of tree (it's tightly protected family secret :) dirty:
jxtree tree = (jxtree) treetable.getcellrenderer(anyrow, gethierarchicalcolumn()); mytreetablecellrenderer r = new mytreetablecellrenderer(tree);
arrgghhh ...
cu jeanette
now, i'll try if works, @ least take idea :)
Comments
Post a Comment