JavaFx 2.x treeView - How to assign a unique id to treeItems ?
842194Aug 16 2012 — edited Aug 22 2012Hi.
I'm trying to get unique id's from treeItems of a treeView to use them as indexes to retrieve other properties from an array.
The tree is built at runtime from an xml file and the structure is similar to:
rootitem
folderitem1
leafitem11
leafitem12
folderitem2
leafitem21
I've tried getValue, getId, getSelectdIndex, but none returns what I need (getSelectedIndex() returns different values when I expand the folders).
For example, folderitem21 should always return 5 even if folderitem1 was not expanded.
The values must be persistent when I add or remove treeitems at runtime, so the ideal will be to add an internal not visible property.
What will be the right method to achieve this ?
Thanks.
Suri