[REVIEW] Make controller instantiation customizable
Tom Schindl
tom.schindl at bestsolution.at
Tue Dec 13 19:27:18 PST 2011
Hi,
Having thought about this even more I think classloading is not the only
thing people might customize, the same goes for event and field binding,
all what I'd summerize below resolving and wireing.
I think we could address some of Daniel's requests and the classloading
with one delegating class people could customize.
It could look like this:
FXMLLoader f ....
f.setWireing(new DefaultWireing() {
@Override
public Class<?> loadClass(String fxmlFileId, String name) {
}
@Override
public ElementBinder getControllerElementBinder(
String fxmlFileId,
Object controller, // might be null
String elementId) {
}
@Override
public MethodBinder getControllerMethodBinder(
String fxmlFileId,
Object controller, // might be null
String methodName,
Class<?>... arguments) {
}
@Override
public String loadIncludeFile(
String fxmlFileId,
String includeFilePath) {
}
});
The reason I think FXMLLoader#setClassloader(Classloader)) is not enough
is that one could include a child fxml-Files who might need a complete
different Classloader.
To identify a fxml-File I'd suggest to add something like fx:componentid
but this is not a must and we could also pass the FQN-Name of the
fxml-File to identify it.
Tom
Am 14.12.11 00:50, schrieb Greg Brown:
>> Might I suggest that you add the possibility to set a custom classloader
>> to FXMLLoader (FXMLLoader#setClassloader(Classloader)) which is used for
>> the class look up?
>
> This might be a good alternative. Let me give that some thought.
>
> Thanks,
> G
>
--
B e s t S o l u t i o n . a t EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl geschäftsführer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5-7/1 A-6020 innsbruck fax ++43 512 935833
http://www.BestSolution.at phone ++43 512 935834
More information about the openjfx-dev
mailing list