What would be the MVP approach for using GWT's ClickHandler?
I have a button in my view, which I would like to add a click handler to.
View button.addClickHandler(?)
What gets passed in? The presenter? newed up click handler?
Example case 1. View code:
this.myButton.addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
myPresenter.buttonClicked();
}
});
In this case, adding a click handler to the button can't be tested...
Example case 2. Presenter code:
this.view.addClickHandlerToButton(this);
@Override
public void onClick(ClickEvent event)
{
buttonClicked();
}
In this case, GWT code (ClickEvent) is introduced in the presenter, which should be avoided.