Friday, 2 January 2009

Problem Mixing SmartSWT and GWT Widgets

I set out implementing my Address GUI using SmartGWT 1.0b1 together with GWT 1.5.3 for Windows - both are latest releases available for download. The SmartGWT does not have any formal documentation. Information are scattered in Javadoc, showcase and developer/user forums. Although not ideal, the documentation is generally adequate.

I quickly ran into problem with SmartGWT. I wanted to have a menu bar at the top of my application as shown in the following diagram (which is a screenshot of SWT-Ext implementation of the same application).

SmartGWT does have a MenuBar in its API. However, this class does not seem fully implemented - there is no method to add menus (the addMenus() method is missing from the download although it appears in the online javadoc). As a workaround, I decided to use GWT's own MenuBar and MenuItem in combination with SmartGWT's ToolStrip and TabSet widgets as shown below.

I have done the same thing with the SWT-Ext version of the Address GUI (as shown in the first diagram above) using GWT's Menu with SWT-Ext's ToolBar and TabPanel widgets without any problems. However, in SmartGWT, the drop-down menu appears behind the SmartGWT widgets and get obscured by them. So I cannot really use the menu items any more. This result is shown in the above diagram.

It seams that SmartGWT is not so smart after all. [Update 2009-01-03]: Just joking!


ckendrick said...

You didn't get the latest SmartGWT. While we are in beta, the JavaDoc reflects the latest nightlies, which are posted here:

setMenus() was fixed in late November.

The problem you encountered with using GWT's MenuBar is that the zIndex range used by GWT is much lower than that used by SmartGWT. See this post for details.

But, overall, with any two sets of widgets it's best to stick to just one set as much as you can, and only use other widgets when forced to. There are areas of interoperability between Ajax toolkits where there just aren't any real solutions yet. These include managing the tab order, layered modality, pixel-perfect layout, accessibility, and other hard problems. These are solved nicely by SmartClient but there are no standardized approaches for coordinating with other toolkits to handle these cases cleanly.

Anyway, if you run into other problems we'd prefer a post on the forums, which would most likely have been answered immediately, rather than taking the time to put together a public insult. Thanks.

Romen said...


Thanks for your input. I appreciate it.

When I read the online version of Javadoc I realised that it may have been fixed in a nightly build. However, it was not in the lastest release (1.0b1 as of today). As I am not building this application for work - it's just for learning SmartSWT, I did not explore the forums deeply enough.

Please don't take it wrong. There is no insult intended. I admire Sanjiv's work from SWT-Ext to SmartSWT. If there is any insult, it is directed at myself - as I have a pretty bad memory and I have to rely on my own posts to remind myself lessons learned and experiences gained... which is the main intention of my blog.