Toggle Menu [-]

Moving forward, getting deeper…

Published by admin on Monday, November 23, 2009 - 03:55:59 - Filed under General, News, Development

So I was happy with my little integration of DJ-NativeSwing as a plugin (3 plugins in fact: one for the browser, one for the flash player and one for the html editor).

I knew that they would be better implemented as beans because they were real components, and they had a UI, so I needed to rewrite the whole thing to make this easier to use, and make them Servoy-Aware (you can attach a data provider to them) and have a bunch of properties and event callbacks, and still be fully scriptable… Quite a lot to write, really, although I could sense that the DJ-NativeSwing API was solid and well written and allowed for all of this.

I had some discussions in PM about that with a few Servoy users, and I sensed that there was some real interest but all I could tell these guys was that there was no support for Mac OS X yet.

Still I tried, mostly stealing Mac time from colleagues at work, to try deploying DJ-NativeSwing with SWT, and trying MozSwing as well, and even plain Mozilla XULRunner to see what was working or not and trying to understand why.

I had tons of trouble finding a way to deploy XULRunner from JNLP using an <installer-desc> node.
Most of the times it was just not working, and sometimes it had the weirdest of behaviours, like launching an instance of windows in Parallels Desktop for example! I’m telling you: Java Web Start is a very strange beast! And on Mac OS X particularly. In the end I wrote my own XULRunner installer that I can rely on, or at least debug ;-)

I managed to make the MozSwing demo to work on Mac OS X Tiger, but couldn’t make DJ-NativeSwing to launch at all. I even started to think that maybe I could write a regular implementation on Windows/Linux and a special (limited) implementation using MozSwing for Mac OS X. Easier said than done.

In the meantime I did the SVGBean, and was quite happy about it, but I still had these plugins waiting for me in my Eclipse workspace, and I was playing around that from time to time. I knew that if I was to embark on that thing, it could take a big effort to release it to the public.

So I started digging a little bit into that, and playing with a few options of the NativeSwing frameworks, noticed a few bugs (or thought I did :) and posted a few messages on the DJ-NativeSwing sourceforge forum. I was not too confident that there will be answers to my messages because it seemed that there was no reply for a long time already on that forum.

But I was wrong! It turned out that Christopher Deckers was off for a few weeks, but when he came back he was very quick to answer and very helpful. On a particular problem I had, he told me to contact him in private, which I did, and we exchanged on a very regular basis ever since!

Christopher Deckers is a very nice guy, and a very talented Java programmer, he crafted alone this library which is a very clever piece of Java software and address so elegantly most of the pitfalls of native integration. If you are interested, have a look at his sources, you will learn a lot. I know I did. This guy knows SWT and Swing like his own pocket, and I couldn’t have done this thing without his very active help. He had no idea what Servoy was at the start, of course, but nevertheless, he was very dedicated to help me work around all the problems with Servoy integration. I cannot thank him enough for his invaluable help. And you know what? He is French too.

Funny how this goes: when I was in Lyon a few years ago, I used to work closely with a guy who was located in Boston on the JGenerator framework (an open source java replacement for the Macromedia Generator tool, used to build swf files on the fly based on external datasources - the project was later licensed by Macromedia and is now part of… Flex). Now that I am in Canada, I work with this guy in France!

Of course, the first thing I did when I started exchanging with Christopher was to ask about Mac support but he was having the same problem I had at the time: no Mac to test! So I started looking around for a good occasion on a Mac, on eBay there were a few, but I took care not to tell that to my wife who is already fed up of all the hardware we have at home! :)

Then one day, Robert J.C. Ivens, my generous host, to whom I told earlier that I was limited with my tests because I didn’t have a Mac, announced that he had a Mac Mini sitting on his desk doing nothing and that he was willing to send it to me if I wanted because I could put it to a better use! You betcha!
I am forever in debt with this guy for his generousity, and now that I even have his ’sponsored by ROCLASI Software Solutions’ I’m proud to wear it!

I immediately told Christopher Deckers that I was expecting a Mac (almost like pregnancy, that was), and that I was willing to devote 100% of my time to crack that problem. Well, 100% is of course a little bit more than anyone can do, especially when one has a full time job during the day and an 8 year old daughter who doesn’t want to hear about it… but still, I was prepared to spend all the time I had to work on that thing.

Almost at the same time (it seems the stars were aligned for us) the SWT team started to move on one of the biggest obstacle we were facing. This bug was preventing any use of the SWT_AWT bridge on Mac OS X. You can see it here, this is well worth a read. The bug was first reported on Sept. 2008 and there was still no visible progress about it in July 2009! Christopher pointed me to this one, so I voted for it, and I also added a comment asking for clues on how to address the problem because it was a major pain in the bum…

My comment from the 25 Aug. 2009 somehow triggered a few discussions between the SWT developers in the swt-dev list and some comments on the bug report. Finally they were moving! With Christopher Deckers we were waiting for this bug to be fixed, to try a SWT nightly build asap and start getting into some serious Mac OS X test. That is until I had the Mac safely home because coming from Belgium to Canada took a while, for such a little case…

Meanwhile I asked a few Servoy users to vote for the bug too. Most of them had absolutely no idea what they were voting for - but they did anyway, and some of them even commented with some hilarious conviction! You should read these comments, you would actually believe that these guys knew what they were talking about :) Thanks again, guys!

In the end, the Mac Mini arrived just in time for the bug fix that was announced. Robert nicely upgraded it before sending it to me, with 4Gb RAM and even a power plug adapter! This little box really rocks! And it has been working faithfully ever since.

So I downloaded the first nightly build that actually did build (that’s not always the case, unfortunately).
Everything was set for some serious testing and debug sessions, and that is the next episode of the saga that I will tell you soon…