A quirk updating to GWT 2.5

GWT 2.5 code inconsistently uses the new EventBus.

While updating some GWT code to version 2.5 I found that PlaceController using com.google.gwt.event.shared.EventBus has been deprecated for methods using com.google.web.bindery.event.shared.EventBus. No problem, just a quick refactor I think, only to find that now my Activities do not compile as they require the old EventBus. Catch 22.

This is a known problem (Issue 6653).  Using a suggestion from there I created the following wrapper to resolve this. Now my Activities implement my NewAbstractAcitivty using the new EventBus and when Issue 6653 is fixed the wrapper can be easily removed.

 

package com.whoson2day.client.activity;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.web.bindery.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;

/**
 * The Class NewAbstractActivity.
 *
 * Wrapper to correct GWT issue 6653 –
 * com.google.gwt.activity.shared.Activity should use the new EventBus in 2.4
 * http://code.google.com/p/google-web-toolkit/issues/detail?id=6653
 * http://gwtramblings.blogspot.com.au/2011/09/gwt-24-new-placecontrollereventbus.html
 *
 */
public abstract class NewAbstractActivity extends AbstractActivity {

    /**
     * Instantiates a new new abstract activity.
     */
    public NewAbstractActivity() {
    }

    /* (non-Javadoc)
     * @see com.google.gwt.activity.shared.Activity#start(com.google.gwt.user.client.ui.AcceptsOneWidget, com.google.web.bindery.event.shared.EventBus)
     */
    @Override
    public void start(AcceptsOneWidget panel, com.google.gwt.event.shared.EventBus eventBus) {
        start(panel, (EventBus)eventBus);
    }
   
    /* (non-Javadoc)
     * @see com.google.gwt.activity.shared.Activity#start(com.google.gwt.user.client.ui.AcceptsOneWidget, com.google.gwt.event.shared.EventBus)
     */
    public abstract void start(AcceptsOneWidget panel, EventBus eventBus);

}

75 views

Need help? Let me take of your IT issues.

Share this page

Share on facebook
Share on linkedin
Share on twitter
Share on print
Share on email
Scroll to Top

By continuing to use this website, you consent to the use of cookies in accordance with our Cookie Policy