Proposal for improving nested controller interaction in JavaFX 2.2

Greg Brown greg.x.brown at
Wed Feb 22 05:16:38 PST 2012


To reiterate my earlier point - while the backing controller pattern may not be a perfect fit for your requirements, I still don't see anything aside from personal preference that would prevent you from using FXML within a design pattern of your choice.

> I think that the above could all be achieved through a fairly simple application of the Inversion of Control pattern (which is the pattern behind the modern popular trend towards Dependency Injection oriented frameworks).

I'm familiar with DI/IOC. In fact, I think FXML already adheres pretty closely to the concepts. By using markup to instantiate objects and inject them into the controller, we're applying DI. By allowing a caller to register event listeners on elements within the markup, we're applying IOC.

> Basically FXML could act less like the boss of the GUI dictating to everything else how things need to be done. Instead it could just be a humble worker, which is handed the resources it needs to do its job of building a scene graph and handing that scene graph back to whoever requested it. 

I think you are missing the point. You are not required to use the FXML controller as the "boss" of your application. The controller is just a convenient way to associate logic with markup. How your application uses that logic is up to you.


More information about the openjfx-dev mailing list