Tuesday, February 12, 2008

Eclipse: Instantiations SWT Designer, GWT Designer, and RCP Developer

I'm speaking at EclipseCon 2008

Continuing on with my Eclipse centered articles, I am moving on to yet another set of tools I use quite often with Eclipse. Now, while I prefer not to do “product” endorsements, I do have to say I like using the Instantiations Window Builder series of products. In particular, I have been using the RCP Developer (well, more of the SWT Developer) and the GWT Designer products as of late. To put them into perspective, Instanatiations has a series of products that provide a simple, RAD type interface designers for a series of platforms, such as Swing, SWT, RCP and GWT. At last years EclipseCon, I won both a copy of GWT Designer and RCP Developer, which I mainly wanted to evaluate. RCP Developer, at the time, was my primary focus since I was tasked with building an RCP based application (I wrote on this previously 1, 2). However, I have since just been using the SWT Designer that came with it.

Figure 1. Designer Window

Figure 1 shows a screenshow of the Designer Window. This is where SWT Designer really gains its utility from. Having to hand code interfaces is a pain, so being able to quickly whip up an interface visually leads to cleaner visual designs and allows for rapid prototyping of visual interfaces. Here, you see the WYSIWYG designer that you would expect from most visual development environments nowadays, with a component palette next to a designer. You have components at your disposal, such as standard buttons, layout managers, text boxes, list and combo boxes, groupings, and menus. Here I have used a free form layout and built a simple interface, with buttons to connect to servers and edit server info, a code snippet insert below that, a large textbox in on the right, and the option to send a command to the a server. The designer also has the option to quickly test the interface without needing to compile or run (no functionality is provided), to quickly align components, and a quick little tool to externalize strings used in components. There is also a outline view to accurately select a correct component to work with and change properties. This is useful if you have many nested components.

Figure 2. Property Editor

Figure 2 shows the property editor. Here I have selected the Execute button. In the property editor, I can change things like the size, text displayed on the button, name of the button object, if it displays an image, and any other visual elements of the button.

Figure 3. Event handlers

If you double click on any component, or right-mouse click and choose add event handler, it will create a new event handler. Double-clicking adds a default handler (in the case of Buttons, widgetSelected). If you use the context menu, you have more control. In Figure 3, I have a widgetSelected event handler already, and am creating a mouseHover event handler. This will automatically import the correct class to use, and create a new instance of it in the addListener method, as seen in Figure 4.

Figure 4. Inserted Event Handler

Unlike with GWT Designer or RCP Developer, SWT Designer does not add a new launch command to Eclipses launch window, which is fine since SWT applications are Java applications anyway. It does, however, create a new Project type, and a number of new project file types, such as an Application Window, Dialog, and Shell.

Figure 5. New Types

RCP Developer provides similar mechanisms for RCP based applications, as does GWT Designer. The biggest differences are the inclusion of different launch mechanisms. With the GWT Designer, the launch mechanism not only launches, but will give you the ability to launch from within Eclipse and debug in Eclipse. With the new project wizard and this launch mechanism, it replaces the manual launch creator that I had previously illustrated.

Figure 6. GWT launch Mechanism

Figure 8. GWT Run Dialog

Figure 9 shows the designer for GWT Designer. As you can see, it is almost identical to the SWT Designer, except that it contains a GWT project, and uses the GWT Design components.

Figure 9. GWT Designer

In addition. GWT requires a little further configuration than either RCP Developer or SWT Designer in that you need to configure the location of the GWT libraries. This is available under the Window/Preferences dialog, under Designer/GWT.

Figure 10. Configure GWT Location

I will avoid my gripes about the license fees since they are more of personal gripes because I am cheap and have more or less spoiled myself with OSS offerings, and in no way reflect on the quality of the products themselves. Some programmers have to eat and pay the bills too, and these products have enabled me to build some cool little apps quickly, so I feel the price is worth it. If you’re at EclipseCon 2008, check out the Instantiations booth to see what else they have to offer. Maybe they will run the games they did last year to win a copy of the above mentioned products.

No comments: