Tuesday, June 12, 2007

I'm perFLEXed

Yesterday Adobe released it's Flex 3 and naturally I went there to see this new cool technology. I downloaded it and got an Eclipse with a GUI-Builder to create SWF-Applications. The nice thing is that Flex uses an XML-Format to store the GUI, ... .



I guess you know what's coming now, don't you? I sat down and looked closer to find out that it would be fairly easy to write a Transformer to convert this in my custom EXSWT-Format used to build SWT/JFace-GUIs. After about 2 hours I now have a minimal XSLT-Stylesheet transforming MXML-Elements (currently mx:label, mx:combo, mx:button) to EXSWT and feeding it into my EXSWT-Lib. The only problem are different heights and widths needed by SWT and SWF but those are minor problems.

Here's the original Flex-Project View one can export as an SWF-Application:



And here the one displayed using SWT-Widgets:



This is only a simple example but it shows how easy it is to define highlevel dialects on top of EXSWT which is a more or less lowlevel XML-Language.

You can as always get the sources from my SVN-Repository and I have once more prepared a .psf-File for all Subclipse users.

10 comments:

Anonymous said...

That's super cool, Tom. I forwarded this to the Flex/Flex Builder teams. - Mike Morearty, Flex Builder

Anonymous said...

Tom, that's rad! I'd love to use that to design UI for Flex Builder...if you're ever in San Francisco, I think this deserves a beer :)

-David Zuckerman, Flex Builder
http://www.davidzuckerman.com/adobe/

Nikos said...

RAP, GWT and now Flex 3.

How I will choose between them to migrate my RCP app ? oO

And by the way I like the idea to develop only one GUI but I have some doubts on complex GUI.

Have to test it :)

Tom said...

Mike and David, thanks for the kind words, I much appreciated to here you like this.

Currently the project status is PRE-Alpha but things are evolving as you may have seen when reading my other blog entries but I'm working on it only in my sparetime :-) I'll blog about my future success/failure create a flexible XML-Specification and Lib to build GUIs ontop of SWT/JFace/Eclipse.

And David I love beer, here over in Austria (Europe) we grow up with it :)

Anonymous said...

I have downloaded the sources from your
SVN-Repository in a stupid manner (file by file),
put everything in folders
(at.bestsolution.exswt.transformer.mxml)
and from root folder, import project in eclipse workspace.
I have plan to “understand” how it work.
But for the beginning there is no class XSLTTransformer .
What have to be done?

Tom said...

Nikos. EXSWT is not meant to provide a platform to develop your application once and deploy it anywhere.

The interesting thing here is that it should be easily possible to define GUIs with a highlevel XML dialect (e.g. MXML, XUL, ...) and create transformers who convert it to EXSWT.

I think RAP,... are all cool technologies and of course I have their place in the future.

I only ask myself why should I be satisfied with JavaScript if I could have Java, OSGI, ... and defined my GUIs in some XML-Dialect making redeployment as easy as possible.

If you ask me the next few years RCP is going to be the platform most commercial applications are built on because of all those Browser-pecularities and the extensible and really big frame Eclipse-RCP provides to developers.

All those AJAX-Libs are far away from something that complete and if you can't do things on the client the user experience is not satisfying (something I have problems with when it comes to RAP but that's a personal problem and I don't want to start a flame war)

Tom said...

boris you should:
1. Install subclipse (http://subclipse.tigris.org/update_1.2.x)
2. Download the http://publicsvn.bestsolution.at/repos/java/at.bestsolution.exswt.examples/trunk/projectSet.psf
3. Copy the file to some project in your worspace
4. Right-Click and Select "Import Project Set"

This should automatically checkout the following needed projects:
- at.bestsolution.exswt
- at.bestsolution.exswt.examples
- at.bestsolution.exswt.groovy
- at.bestsolution.exswt.transformer.mxml

Having done this the last thing is to open at.bestsolution.exswt.examples/plugin.xml and click "Launch an Eclipse Application" which brings up a new IDE-Window and there you can find in "Window > Show View > Sample Category" the two views demonstrating GUIs defined with EXSWT directly and MXML.

Nikos said...

Tom,

I almost agree with you.

You're totally right about all those Browser-pecularities !!
And I choosed RCP to :)

But in some situations you have to use those browsers. For example, in bank or insurance companies, most of the time, your application will be a part of a portlet. And there is no possibilities to deploy something on the client machine.
So, I need to struggle with all the Ajax limitations. And that's right it's hard after enjoying Eclipse RCP development.

Anonymous said...

I have downloaded to a project in my workspace:
- at.bestsolution.exswt
- at.bestsolution.exswt.examples
- at.bestsolution.exswt.groovy
- at.bestsolution.exswt.transformer.mxml

But I have had error message:
The Constructor Status(int,String,String,Thrawable ) undefined in class:

package at.bestsolution.exswt;
public class Activator extends AbstractUIPlugin {
………
public IStatus createStatus(int errorCode, Map dynamicValues, Throwable e) {
return new Status(IStatus.ERROR, PLUGIN_ID, Activator.getDefault().getErrorHandler().getErrorMessage(errorCode, dynamicValues), e);
}
……….
}

Tom said...

Maybe you have to run 3.3 to make this work?