roskenet / spring-javafx-examples

Example apps for springboot-javafx-support. See
https://www.felixroske.de/page/programmierung/index.html
159 stars 66 forks source link

What's the idiomatic way of passing (non application context controlled) parameters to a controller? #5

Closed legezam closed 6 years ago

legezam commented 6 years ago

Hi

First of all, thank you for making this nice library.

Secondly, i have a question. What is the idiomatic way of accessing a controller and passing a non context controlled parameter to it from another controller? My use-case is about having a listview in a view, and i want to create custom view for the listview items through a cellitemfactory. The controller of the outer view wires the inner view through the controllerfactory. With this solution, i can describe both the outer layout and the listview item layout using fxml. I can build up this hierarchy easily, i have access to the inner view, but i cannot access the controller of the inner view. I could pass the parameter to the View class itself, but i don't have access to the parameter from the inner controller. This ui is about showing files in a folder. One listview item represents a file in the file system. How do i pass the filename to each item in the listview?

I hope i was clear, thanks for your help.

legezam commented 6 years ago

Aaa ignore me, it can be accessed through the view.presenter. 😄

roskenet commented 6 years ago

Hi @legezam Thanks for your comment. Good to hear, that you found a solution for your use case. Consider to add a stripped down example here! Perhaps other users might be interested in code examples and might find this useful, too.