Java Swing has been the major Java graphical user interface (GUI) building block used by developers for many years. Can the Java Swing experience and skill be transferred to build ActionScript 3-based rich Internet application (RIA) systems? The AsWing Framework started with exactly that goal. InfoQ spoke with the AsWing lead developer iiley Chen to find out how AsWing could help RIA development.
When asked why AsWing was created rather than using other UI frameworks, he replied:
Yes, there were some pretty cool frameworks before Flex, but most of them are not easy to use and not full functioned. Most miss some important components, such as Tree, DataGrid and powerful Layout Manager. When I was developing my first large application, a flash online community in 2005, I needed a powerful UI framework. I had experience with Java Swing, and liked Swing’s architecture and design patterns. Nevertheless, I believed I could build our application UI very quickly and comfortably if there was a Flash UI framework similar to Swing. Hence, I started AsWing with ActionScript2 language and kept most API that same as Swing. AsWing is in ActionScript3 now, and it has been re-designed and refectoried many times. Some guys told me it is even easier to use than Swing and Flex. Thanks to them for making me feel it was worth the effort to develop AsWing.
With respect to the key benefits and uniqueness of AsWing, Chen comments:
The major benefit is that you can build liquid/dynamic UI easily with pure ActionScript coding. The core of AsWing is just ActionScript classes that are easy to handle and manage. If you have Java Swing experience, you can reuse most of the skills.
Also, AsWing provides more than 40 modern UI components, including professional ColorMixiers and some special components like JLabelButton, Form, Folder, and GridList.
In addition, the well-designed MVC pattern lets you easily update the data to the UI view. Just as Flex has data binding, AsWing has various data models that will automatically notify the view to update.
The SkinBuilder tool that is included helps developers create absolutely different skins simply by providing component images or Flash symbols. Besides, the GuiBuilder helps the UI layout design and later generates ActionScript source code.
Finally, AsWing is not heavy. It is purely UI related, unlike some other UI frameworks that are also application frameworks. You can combine AsWing with any other application framework.
In terms of the development environment, AsWing is flexible. Chen explains:
You need nothing special for development. Any ActionScript develop environment is okay, such as Flex Builder, FDT, FlashDevelop and so on. AsWing is just an ActionScript library that can be linked into your project. You can compile AsWing application with either Flex compiler or Flash compiler. The included GuiBuilder tool is an AIR application so that you need AIR runtime to run it.
With respect to the roadmap ahead for AsWing, Chen shares:
I'm currently working on AsWing 2.0, which it's a major version. The default look-n-feel will be re-designed with a better look. The most important new feature is the introduction of a new skinning technique. You will be able to change a component style just by coding a few lines on gradient, hue, round corner or shadow properties without the need to develop the complex ComponentUI classes. Also, some new components, like Numeric Stepper, Date Chooser, Advanced TextArea and Advanced Table will be added.
Chen provides the following Hello World AsWing application code:
package{
import flash.display.Sprite;
import org.aswing.*;
public class HelloWorld extends Sprite{
public function HelloWorld(){
AsWingManager.initAsStandard(this);
JOptionPane.showMessageDialog("Title", "Hello World!");
}
}
}
Does it look familiar to Java Swing developers?