aino-komal / mvp4g

Automatically exported from code.google.com/p/mvp4g
0 stars 0 forks source link

Cannot use EventBus in the View that implements ReverseViewInterface #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a view that implements ReverseViewInterface. Create a presenter.

example:

NavigationView.java

@Singleton
public class NavigationView extends Composite implements 
ReverseViewInterface<NavigationPresenter>, INavigationView {

    interface Binder extends UiBinder<Widget, NavigationView> {
    }

    private static final Binder binder = GWT.create( Binder.class );

    private NavigationPresenter presenter;

    @UiField Anchor navigationPath;

    @Override
    public NavigationPresenter getPresenter() {
        return presenter;
    }

    @Override
    public void setPresenter(NavigationPresenter presenter) {
       this.presenter = presenter;
    }

    @Inject
    public NavigationView() {

        initWidget( binder.createAndBindUi( this )

        navigationPath.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
               presenter.sendEventXX();

            }
        });
    }

}

NavigationPresenter.java

@Presenter( view = NavigationView.class )
public class NavigationPresenter extends 
BasePresenter<NavigationPresenter.INavigationView, MyEventBus> {

    public interface INavigationView {

    }

    public void onStart()
    {
        Common.log("Navigation presenter started");
    }

    public void bind(){
    }

    public void sendEventXX()
    {
        eventBus.eventXX("something");  
}
}

What is the expected output? What do you see instead?

In the developement mode everything works as expected. The event is always sent 
correctly.

After compilation:

eventBus.eventXX("something"); is not executed (the event is not sent) when the 
method is called directly from the view [ presenter.sendEventXX()); ].

In the firebug I get only a message:
uncaught exception: com.google.gwt.event.shared.UmbrellaException: One or more 
exceptions caught, see full set in UmbrellaException#getCauses

When the same method (sendEventXX("something")) is called from the presenter 
(ex. onStart(){sendEventXX("something")} it works correctly.

What version of the product are you using? On what operating system?
MVP4G 1.3.0-SNAPSHOT, WINDOWS 7, FF3.6.12

Original issue reported on code.google.com by jacekza...@gmail.com on 8 Dec 2010 at 1:05

GoogleCodeExporter commented 9 years ago
I tried to reproduce your bug but I couldn't. I modified the Mvp4gModules to 
reproduce your case, you can take a look at the attached files (in particular 
com.mvp4g.example.client.main.view.TestReverseView).

The project works in dev mode and after I compile.

Is there something else in your project that can produce this error? Does the 
error occur in the presenter or in the click handler? Maybe if your project is 
simple enough, you can post it.

Thanks,
Pierre

Original comment by plcoir...@gmail.com on 9 Dec 2010 at 1:40

Attachments:

GoogleCodeExporter commented 9 years ago
That issue can be closed. I'm sorry to trouble you. After cleaning the project 
from all already compiled java sources and removing cached files - everything 
started to work correctly.

Original comment by jacekza...@gmail.com on 9 Dec 2010 at 9:57

GoogleCodeExporter commented 9 years ago
It's not a problem, it could have been a bug from Mvp4g. Thanks for validating 
the 1.3.0 snapshot.

Original comment by plcoir...@gmail.com on 9 Dec 2010 at 11:59