Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JavaFx 2.x treeView - How to assign a unique id to treeItems ?

842194Aug 16 2012 — edited Aug 22 2012
Hi.
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 19 2012
Added on Aug 16 2012
4 comments
1,221 views