JavaFX 2.0, Swing & SWT Renderers for the Eclipse 4.x Application Platform
I wish you all a Happy New Year!
During the last weeks I had a bit of spare time and started experimenting with new rendering engines for the Eclipse 4.x Application Platform. Based on my experiences with JavaFX 2.0 renderers in e(fx)clipse (by Tom Schindl from BestSolution.at, great JavaFX support for Eclipse), I started an experiment: Would it be possible to create a generic rendering engine that only has dependencies to the Eclipse 4.x workbench model and then delegate all UI toolkit specific logic to the UI toolkit specific renderers?
When I took a deep look at the projects org.eclipse.e4.ui.workbench.swt, org.eclipse.e4.ui.workbench.renderers.swt and org.eclipse.e4.ui.workbench.addons.swt, I figured out that most of the workbench model related code could be useful for other renderes, too. But there is a very strong coupling to SWT, so it is not possible to reuse any code without copying it. My approach is a simple generic rendering engine, that also provides a generic e4 application. Then, for every supported UI toolkit, just a derived application and new renderers have to be implemented. The basic bahavior is driven only by model changes, the renderes have to react on those changes. The engine also takes care of letting each renderer do the binding from the specific UI toolkit back to the model.
Currently I have implemented simple rendering engines for JavaFX 2.0, Swing, and SWT. I also started the same approach with a generic MinMax model addon. The addon gets the additions needed to adapt to a specific UI toolkit through DI.
I reimplemented my e4 contacts demo and split it into a generic project that contains the workbench model, the domain model and all parts, which are not UI toolkit specific. Then I created a UI toolkit specific implementation for JavaFX 2.0, Swing and SWT. The Details and the Table widgets I had to implement with the UI toolkits natively. Here are a few screen shots of the results, click on them to see the images in original size.
JavaFX 2.0 based contacts demo with 3 different CSS based themes:
Swing based contacts demo with Nimbus and Napkin Look & Feel (Napkin is my favorite Look & Feel to show prototypes to the management :)):
SWT based contacts demo (my new rendering engine) with 2 different CSS based themes:
The current alpha version 0.0.1 you find at GitHub: https://github.com/toedter/e4-rendering
If you want to run the JavaFX 2.0 Contacts Demo, you also need to have the latest version (0.0.11 or better) of e(fx)clipse installed. The easiest way is to download the pre-configured Eclipse 4.x SDK from http://efxclipse.org/install.html#the-lazy-ones and then clone the above git repository.
Right now this is just a proof of concept, only very basic stuff is implemented. But I am planning to enhance the engine and UI toolkit specific renderers until EclipseCon 2012. If there is enough interest in the community, I would love to organize a BOF at EclipseCon to discuss the pros and cons of this approach.
What do you think?