I found a working solution by the tip of Uluk Biy. Here is what has worked for me:
- Move the method
showConfigDialog()
to the caller. - Get a reference to the dialog and the UI instance (to get values of the configuration from there later) and add that reference to the call.
Here are the changes to above:
Controller
public void configureActionTrigger(ActionEvent actionEvent) {
Dialog dlg = new Dialog(null, "Configuration Dialog for Check SVN");
Action result = this.showConfigDialog(dlg);
...
}
protected Action showConfigDialog(Dialog dlg) throws IOException {
Node content = content = FXMLLoader.load(getClass().getResource("check-dialog.fxml"));
dlg.setResizable(false);
dlg.setIconifiable(false);
dlg.setContent(content);
dlg.getActions().addAll(Dialog.Actions.OK, Dialog.Actions.CANCEL);
return dlg.show();
}
ConfigUI
@FXML
TextField urlRepository;
No change was necessary to check-dialog.fxm
.
Now the TextField is bound properly, and when I enter something in the text field, the value of that field changes as expected.
So the solution was to move the responsibility of building the UI for the configuration dialog to another class, and let the controller only handle the input.