Sunday, December 13, 2009

Upgrading to GWT 2.0 with GXT 2.1.0

I had to upgrade my GWT version to 2.0.0 with GXT 2.1.0. For the most part this was pretty straight forward. One change that impacted me was the usage of ImageBundle being deprecated. To convert it to the GWT version of doing things I had to do the following:
  1. extend com.google.gwt.resources.client.ClientBundle instead of ImageBundle
  2. replace @Resource with @Source (from ClientBundle)
  3. the return types will need to change to com.google.gwt.resources.client.ImageResource for each of the image methods.

Instead of using the interface directly (after being runtime binded with GWT.create()), you will need to convert the ImageResource to an AbstractImagePrototype. This can be done by calling the create(ImageResource) method.

The thing that is unfortunate about this, is all my setIcon() calls simply referred to a singleton instance of the images. Now they all need to convert to via the create() call. Hopefully I can work out a nicer solution for the future.

The article that helped guide me in this came from the google wiki: ImageResource

Version Info
GXT: 2.1.0
GWT: 2.1.0

Friday, December 11, 2009

GXT 2.1.0 Conversion

The following is a list of the issues I ran into when I converted from GXT 2.0.1 to GXT 2.1.0. This is not the complete exhaustive list, however these may provide others with some of the workarounds.

  1. My dialogs will cascade events to the form panels and their contents on the dialog. A change was made to Layout which requires all components which are receiving the event to have a layoutData defined. Since dialogs would normally not hold a layoutData (in my case they were using FitLayout which results in a null layoutData), I had to change the cascading to start at the dialog's FormPanel.
  2. All text input components have the wrapper set to the id used to create the component (this should be a <div/> tag). The physical input field now has a "-input" added to the end of the id. This impacted my Selenium tests.
  3. The StoreFilterField required the setProperty("name") to be called in order for the filtering to actually be invoked. I also changed my overloaded applyFilters() method to be similiar to the super method in the way it adds/removes the filter on the store.
  4. @Override
    protected void applyFilters(Store<ModelData> store) {
     if (getRawValue().length() >= 3) {
      store.addFilter(filter);
         store.applyFilters(super.getProperty());
        } else {
         store.removeFilter(filter);
        }
    }
  5. In my country ListView, when the Events.Select was raised I was retrieving the selected countries from the selection model. This either changed or I was doing it incorrectly, as now the selection model was returning the items before the selection is registered. Instead, I switched to use the getIndex() of the ListViewEvent to find the country that was selected.
  6. For my image panel, I was using a GWT HTML component. This now required the parent to implement HasWidgets interface, which the ContentPanel in GXT doesn't (since all GXT components extend Widget from GWT). Fortunately there is a GXT component Html which does pretty much the same as the GWT one, and converting to use this worked.
  7. Nodes in a TreePanel had their rendering changed from a <li> tag to a <div> tag. This impacted Selenium tests.
  8. Popup menus changed from using <li> tags to using <div> tags. This impacted Selenium tests.

Overall, the changes took me approximately 5 hours to incorporate and resolve the differences in my selenium tests. Some of it was due to changes in the rendering of the GXT components (which is to be expected and is not difficult to reconcile) and some of it was related to event sequencing and component model changes. It was these later changes which impacted my time the greatest.


Version Info
GXT: 2.1.0
Selenium: 1.0.1