Could FXML use an interface and dynamic proxy for the passive view interface?

Roman Kennke roman at kennke.org
Mon Dec 12 11:28:58 PST 2011


Hi Richard,

> Which got me thinking. Can't we have FXMLLoader use dynamic proxies to allow the FXML file to refer to a passive view interface rather than a concrete controller implementation? That at least would allow for the "Passive View" design pattern to apply extremely cleanly. It still would mean, from the developer's perspective, 2 classes instead of 1 (an interface for the view and a controller which talks to that interface). I would have to think through this a little more (I guess the controller is still required, so that the FXML document has something to call for event handlers and such, but that the controller would only talk to the view via this Passive View interface rather than by grabbing nodes and binding things directly??)

Yeah I am thinking the same. The FXML should generate a class that
implements an interface that would need to be defined by the developer.
I think it's fine (and actually clean/best practice) to require a
passive view interface in addition to the presenter class.

Regards, Roman




More information about the openjfx-dev mailing list