The fact that a custom widget uses MVP should be hidden so you would end up 
having:

MyCustomWidget extends Composite implements CustomView {

  MyCustomWidget() {
    myPresenter = new Presenter(this); //takes CustomView as argument so 
you can mock the view while testing the presenter
  }  

   public void myCoolMethod() {
      myPresenter.doTheTestableWorkForMe(); //delegation to presenter if 
wanted/needed
   }

}

If your presenter needs additional dependencies you would pass through your 
ClientFactory, e.g.

MyCustomWidget(ClientFactory factory) {
  myPresenter = new Presenter(this, factory);
}

The presenter would be package private so no one outside the package can 
use it but you can still test the presenter as the test typically resides 
in the same package.

I think this works best for complex widgets and it is the same strategy as 
the cell widgets work internally (see AbstractHasData and its presenter).

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/__X6BsJV5ikJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to