gabrial11392 / gwt-platform

Automatically exported from code.google.com/p/gwt-platform
0 stars 0 forks source link

Add a reference to presenter within view #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Adding a reference to the presenter within the view makes it possible to use 
the @UiHandler annotation of UiBinder. This is relatively simple to automate 
in GWTP and shouldn't even be a breaking change.

See:
http://code.google.com/intl/fr/webtoolkit/articles/mvp-architecture-2.html

For details.

Original issue reported on code.google.com by philippe.beaudoin on 25 Apr 2010 at 6:42

GoogleCodeExporter commented 9 years ago
Bumping up, preparing for release 0.2.

Original comment by philippe.beaudoin on 13 May 2010 at 9:49

GoogleCodeExporter commented 9 years ago
In my sample app I had a reference to the presenter from within the views 
without modifying 
gwtp.

- My View interface has a Presenter sub-interface (not sure for the technical 
term for 
this).  It defines methods that handle events, such as onSelect, onXXX and 
onYYY.
- My Presenter implements the View's Presenter sub-interface.
- My ViewImpl is constructor injected with a provider of the presenter 
sub-interface.
- My View's Presenter sub-interface is bound to my Presenter using bind().to();
- My ViewImpl has @UiHandler methods that handle events are then forward them 
on to the 
presenter using this.presenterProvider.get().onXXX()

gwtp could possibly automate the last 3 steps.

You can view the sample code here: http://code.google.com/r/brendanpdoherty-
breadcrumbs/source/browse/breadcrumbs/src/nz/co/doherty/gwtpbreadcrumbs/client/u
i/home/

Original comment by brendanp...@gmail.com on 18 May 2010 at 2:47

GoogleCodeExporter commented 9 years ago
Brendan's approach is simple enough, and I've been doing something similar in 
my own application. Bottom line I believe it is best to leave that up to the 
user, so GWTP will not be enforcing passing the presenter into the view.

Original comment by philippe.beaudoin on 27 Jun 2010 at 6:31

GoogleCodeExporter commented 9 years ago
We could at least document this pattern in a how to section with a simple 
example.

Original comment by goudreau...@gmail.com on 27 Jun 2010 at 7:11

GoogleCodeExporter commented 9 years ago
I totally agree, I've added Issue 123 for this.

Original comment by philippe.beaudoin on 28 Jun 2010 at 5:55

GoogleCodeExporter commented 9 years ago
See Issue 164.

Original comment by philippe.beaudoin on 10 Sep 2010 at 12:42

GoogleCodeExporter commented 9 years ago

Original comment by philippe.beaudoin on 10 Sep 2010 at 12:43