google-code-export / gwt-platform

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

Client action handlers execute() and undo() to return a DispatchRequest #223

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In one codereview Phil proposed that execute() and undo() return a
DispatchRequest instead of accepting a ClientDispatchRequest. This would  make 
the code much cleaner.

Original issue reported on code.google.com by bren...@doherty.net.nz on 6 Oct 2010 at 8:06

GoogleCodeExporter commented 9 years ago
Code review:
http://codereview.appspot.com/2373042/

Original comment by brendanp...@gmail.com on 6 Oct 2010 at 9:46

GoogleCodeExporter commented 9 years ago
I've now got a bunch of classes that implement DispatchRequest. I've renamed 
DispatchRequestImpl class, and removed DispatchRequestFactory, as misko hevery 
says static methods are hard to test. 

- GwtHttpDispatchRequest (was DispatchRequestImpl)

- CompletedDispatchRequest (always returns isPending = false, for use by 
ClientActionHandlers that don't make async requests)

- CallbackDispatchRequest( is passed a AsyncCallback.  isPending returns true, 
until onComplete or onFailure is called, at which point isPending return false. 
 Also, calling cancel() will cause onComplete and onFailure not call the 
callback so client code will not be executed.  For use by ClientActionHandlers 
that don't use gwt-rpc - such as my geocoding client action handler).

- DelegatingDispatchRequest(is a DispatchRequest that will contain another 
DispatchRequest at some point in the future.  Needed for use with 
ClientActionHandlers that come from AsyncProviders.  

We'll use 'new' to create the DispatchRequest objects instead of the factory.  
I think the following presentation says it's ok, as these are all "value 
objects", not "service objects".  TESTING DESIGN SKILLS – 6 VALUE OBJECTS VS 
SERVICE OBJECTS http://misko.hevery.com/presentations/ 

Original comment by bren...@doherty.net.nz on 6 Oct 2010 at 9:51

GoogleCodeExporter commented 9 years ago

Original comment by bren...@doherty.net.nz on 7 Oct 2010 at 5:29

GoogleCodeExporter commented 9 years ago

Original comment by philippe.beaudoin on 8 Oct 2010 at 9:56

GoogleCodeExporter commented 9 years ago

Original comment by goudreau...@gmail.com on 15 Oct 2010 at 1:42