Hi, i have a treeview which holds some elements. At the moment, those are just strings. I attached a ContextMenu to that Treeview. The ContextMenu has some items like delete, refresh, etc. which should interact on the object in the treeview. My problem is that when the menu appears, i do not know how i can get the selected element(s). And i believe, my design is broken/procedural.
There is my first question: what is best practice to have a treeview (or anything like that) and elements in that list. Guess i should add the complete object to the treeview, register a special renderer for that treeview which holds a reference to the selected elements. When the user rightclicks on one of the elements and selects the delete menuitem, i can get the selected element(s) from the treeview-renderer, which inform the underlying classes that these element(s) should be removed. Is this correct?
I am new to javafx, if someone has any advice, i really appreciate that, thanks!
ps.: there is a tool called jdownloader, which has pretty exactly what i need from the design of the table/tree. Maybe someone can tell me what would be the "best" way to get something like that:
https://browse.startpage.com/do/show_picture.pl?l=deutsch&rais=1&oiu=https%3A%2F%2Fi.imgur.com%2F7d26f0u.png&sp=07c549cf7c3207fe4387d521caea089f&t=default but with context menu's when someone right-clicks on one of the listed elements.