[REVIEW] Make controller instantiation customizable

Tom Schindl tom.schindl at bestsolution.at
Wed Dec 14 07:29:19 PST 2011

Am 14.12.11 16:15, schrieb Greg Brown:
>>>> But I guess this flag does not help with e.g. the include directive
>>>> which uses the current class path, right?
>>> I'm not sure what you mean by that.
>> Well if have an project structure like this;
>> src
>> + my.package.test
>>   HeaderPart.fxml
>> + my.package.test.ui
>>   ApplicationView.fxml
>> and where ApplicationView.fxml looks like this:
>> <BorderPane>
>> <top>
>>  <fx:include source="/my/package/test/HeaderPart.fxml" />
>> </top>
>> <center>
>>  <!-- -->
>> </center>
>> </BorderPane>
>> If you now want to render a preview of the document the FXMLLoader
>> locates the file by walking the Classpath so to render the preview I'll
>> have to make up the complete classpath (well including even libraries
>> defined).
> Includes are still resolved when "staticLoad" is set to true.

Yeah but you require me to make up an classpath to make to look up
succeed which when you'd give me a way to intercept the lookup where I
simply return the files content (or URL) would not be needed!

What I'm really trying to say: I think you can't define/anticipate all
possible solutions inside the FXMLLoader but should allow developers to
customize those things based upon the specific usecase. This makes you
own everyones problems (like you currently do for the Scenegraph Builder

Doing lookups is really something very special when it comes to tooling
because you don't have the classpath you are used to at runtime making
things that are quite simply at runtime much more complex at designtime.

E.g. take the example from above where I have to make up classpath
including an external jar I have to use an URLClassloader which on
Windows locks the jar until it the ClassLoader gets GC'ed which means
you can delete, ... the jar until this GCing happened (=the preview got
closed + JVM deems its time to wipe it - well on Java7 this can solved
after the loading has finished by closing the URLClassLoader but not for
Java6 you are out of luck).

In contrast to this would be if you'd provide a way to intercept the
look up the included file I don't have to make this classloader but look
up the FXML by other means through the IDEs resource system and hand
over e.g. the URL you use open the stream. No locking and you are not
owning my tooling developers problem.


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