You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixing this will be harder then expected. At the moment I'm working on a refactoring of the FxmlViewLoader class so that the loading process is easier to understand.
We will only be able to verify that the root view has the correct controller type defined in the FXML file.
For all other sub-views we can't guarantee this because we only know that the FXMLLoader is requesting a controller instance of a given type. We don't know at this point what the filename of the fxml file is. It's similar to the many other problems we have due to the limitations of the FXMLLoader.
However, like with the scope encapsulation and some other checks, we can include this in the upcoming dev tools (see #425).
See this example:
This fxml file is named "MyView.fxml" but the
fx:controller
attribute is pointing toMySecondView
.If you load this with:
the
MySecondView
codeBehind andMySecondViewModel
viewModel are loaded which is definitely the wrong behavior.If you write this:
a
ClassCastException
is thrown but if you only use the root view from the ViewTuple like this:no exception is thrown. This error isn't simple to detect and can be easily be overseen by the developer.
The framework should detect this situation and throw an Exception in the moment the view is loaded.
The text was updated successfully, but these errors were encountered: