Ruckus
09/14/2016, 9:12 PMfx:controller
have to be the UIComponent
loading the FXML?Ruckus
09/14/2016, 9:14 PMclass MyView : View() { ... val controller = MyController by inject() ... }
, can I have fx:controller="package.MyController"
?edvin
09/14/2016, 9:16 PMfx:controller
in your FXML file, because if you didn't, I need to call setController
first so that FXMLLoader
will wire up event listeners etc correctly.edvin
09/14/2016, 9:17 PMfx:controller
attribute if we're at the root element, but that would be hard/error prone I think.Ruckus
09/14/2016, 9:17 PMedvin
09/14/2016, 9:18 PMedvin
09/14/2016, 9:18 PMRuckus
09/14/2016, 9:19 PMRuckus
09/14/2016, 9:19 PMedvin
09/14/2016, 9:19 PMfx:controller
attribute was found, controllerFactory
should be called none the less.Ruckus
09/14/2016, 9:20 PMedvin
09/14/2016, 9:20 PMjonathan
09/14/2016, 9:21 PMjonathan
09/14/2016, 9:21 PMjonathan
09/14/2016, 9:21 PMRuckus
09/14/2016, 9:21 PMjonathan
09/14/2016, 9:21 PMedvin
09/14/2016, 9:22 PMjonathan
09/14/2016, 9:23 PMedvin
09/14/2016, 9:25 PMloadListener
wasn't private, we could use that to call setController
once the root element was loaded and there was no call to fx:attribute
. But sadly, that's private as well, and probably removed in JDK9 I guess.edvin
09/14/2016, 9:26 PMimpl_setLoadListener
)edvin
09/14/2016, 9:27 PMRT-21228
is about promoting LoadListener to public API!Ruckus
09/14/2016, 9:28 PMedvin
09/14/2016, 9:29 PMRuckus
09/14/2016, 9:29 PMedvin
09/14/2016, 9:30 PMedvin
09/14/2016, 9:33 PMedvin
09/14/2016, 9:38 PMcarlw
09/14/2016, 9:41 PMedvin
09/14/2016, 9:43 PMfxml
delegate is a part of the controller class, but it is possible to return that instance from a controller factory. The issue is that the controller factory is only consulted if the user actually put the fx:controller
attribute in his FXML file. If he didn't, you need to call setController
before you load the file.