Sunday, December 21, 2014

Using ControlsFX in a Drombler FX application

Earlier this year I've contributed a patch to ControlsFX to provide OSGi meta data in the Manifest file.

This patch allows ControlsFX to be used more or less out-of-the-box in an OSGi environment such as Drombler FX.

I'm writing "more or less out-of-the-box" since you still need an additional configuration in a Drombler FX application to be able to use ControlsFX.

The latest Drombler FX release provides some documentation in the sample generated by the Drombler FX Maven Archetype about this additional configuration.

You can find this in the generated test-application project in the file src/main/app/conf/

You basically have to uncomment some lines there, which looks then like this:

The reason you need this additional configuration is that ControlsFX uses some non-published, internal JavaFX implementation classes and the OSGi environment with the configuration provided by Drombler FX is hiding these classes by default. Adding the necessary packages to org.osgi.framework.system.packages.extra allows ControlsFX to use these classes as well.

Note however that with this configuration these packages are available not only to ControlsFX but to any OSGi bundle in the application. Generally it's strongly discouraged to rely on non-published internal classes as they can change even with any minor release. Backwards compatibility is not maintained for these classes! Using this configuration the OSGi environment cannot protect your own OSGi bundles from using the classes of these packages.

The configuration has been tested with org.controlsfx:controlsfx:8.0.6 and org.controlsfx:controlsfx:8.0.6_20.