Re: Sequential workflow in an asynchronous GWT world

2009-03-06 Thread George Georgovassilis

Hello Robert

I had the same problem in various GWT projects until I accidentally
stumbled across a little used feature of GWT that completely changed
the way I write GWT-apps now: history tokens. History tokens are used
to implement control points in the application towards the user can
jump at will, but are unfortunately perceived merely as walking-sticks
to get bookmarks and the back button working.

But if you think about it, history tokens can do so much more.
Essentially they are a messaging mechanism between the view and the
business logic. User-driven events (clicks on links, buttons etc) can
be captured as history tokens and server-driven events (responses to
RPC calls etc) can be covered by programmatically creating new history
tokens. Thus you easily separate the sources of events (user actions,
server actions) from the control logic and the view.

In my applications I typically have four types of classes:

1. The data model which consists of POJOs containing the data the
client works with
2. The service classes which consists of the business logic, client
side validation and the communication with the server
3. The view which consists of widgets, render the data model and
manipulate it. I can feed a model object into a view and get it back
from the view, similar to the way Swing works. User actions in the
view do _not_ call code from the service classes, but instead create
History tokens.
4. The control logic. This is with regard to your question the most
interesting part. It implements a HistoryListener and listens to
events from the view and asynchronous events from the service classes.
It knows the current state and based on the history item it receives
via the listener can decide which view to manipulate or which service
to call. Essentially, this is the implementation of a control flow.

Hope that helps!
G.



On Mar 5, 4:15 am, rlaferla robertlafe...@comcast.net wrote:
 How is everyone managing to implement sequential workflows when GWT
 only allows async calls?

 I have a series of panels that user must respond to in sequence and
 their answers may lead to a different path of panels (warnings, error
 panels, etc..)  I think every GWT programmer working on a large
 project must have run into this.   I'm interested in what strategies/
 techniques/code you used to help keep the complexity down.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
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
-~--~~~~--~~--~--~---



Re: Sequential workflow in an asynchronous GWT world

2009-03-05 Thread gregor

In general I think it is better to try to avoid this situation if
possible - and often it is if you think about it for a bit - because
a) the less RPC round trips you make the better, and b) the less
callbacks you have in your client code the simpler it is. In general
two good question to ask are:

1. Can the various logic branches be resolved automatically in the
happy days use case on the server as a result of one call? Often they
can if you look at things in a different way. If so you can then think
about how to deal with edge cases.
2. How much of the server state would the client really need to know
to successfully control the logic branches?  Often less than you'd
think at first.

For example, it may be that in your app the first selections the user
makes in this work flow are sufficient to generate a graph of
permissible branches and/or additional required data values on the
server from a single initial RPC call. In effect, create a simple
model for your work flow process on the server and transfer it to the
client up front. Thereafter the client could handle the UI dialog by
itself until completed (with no horrible async callback interruptions
and chains in the code) and then send the transaction details in one
final RPC call.

Of course this may not in the end be possible in your application, but
it's worth looking into as it will increase performance and decrease
complexity, as I think you have realized from your OP

regards
gregor.

On Mar 5, 6:12 am, hazy1 matt.egyh...@gmail.com wrote:
 Making an async call appear to be sequential is easy, just block or
 fade out or have a pop up progress bar until the async operation
 completes.

 On Mar 4, 10:15 pm, rlaferla robertlafe...@comcast.net wrote:

  How is everyone managing to implement sequential workflows when GWT
  only allows async calls?

  I have a series of panels that user must respond to in sequence and
  their answers may lead to a different path of panels (warnings, error
  panels, etc..)  I think every GWT programmer working on a large
  project must have run into this.   I'm interested in what strategies/
  techniques/code you used to help keep the complexity down.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
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
-~--~~~~--~~--~--~---



Sequential workflow in an asynchronous GWT world

2009-03-04 Thread rlaferla

How is everyone managing to implement sequential workflows when GWT
only allows async calls?

I have a series of panels that user must respond to in sequence and
their answers may lead to a different path of panels (warnings, error
panels, etc..)  I think every GWT programmer working on a large
project must have run into this.   I'm interested in what strategies/
techniques/code you used to help keep the complexity down.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
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
-~--~~~~--~~--~--~---



Re: Sequential workflow in an asynchronous GWT world

2009-03-04 Thread Vitali Lovich
You have to think about what kind of UI the users actions have caused.  For
instance, if you would expect all inputs to become disabled (or at least the
one which would generate more async calls).  Perhaps also some kind of
waiting indicator that you are in an async call.

On Wed, Mar 4, 2009 at 10:15 PM, rlaferla robertlafe...@comcast.net wrote:


 How is everyone managing to implement sequential workflows when GWT
 only allows async calls?

 I have a series of panels that user must respond to in sequence and
 their answers may lead to a different path of panels (warnings, error
 panels, etc..)  I think every GWT programmer working on a large
 project must have run into this.   I'm interested in what strategies/
 techniques/code you used to help keep the complexity down.


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
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
-~--~~~~--~~--~--~---



Re: Sequential workflow in an asynchronous GWT world

2009-03-04 Thread Vitali Lovich
Sorry - so to make it more applicable to what you were asking:

disable your current UI/indicate that the application is working.  you may
also want to prefetch the UI here if necessary.

when you receive your result in your async callback, perform the transition.

On Wed, Mar 4, 2009 at 10:32 PM, Vitali Lovich vlov...@gmail.com wrote:

 You have to think about what kind of UI the users actions have caused.  For
 instance, if you would expect all inputs to become disabled (or at least the
 one which would generate more async calls).  Perhaps also some kind of
 waiting indicator that you are in an async call.


 On Wed, Mar 4, 2009 at 10:15 PM, rlaferla robertlafe...@comcast.netwrote:


 How is everyone managing to implement sequential workflows when GWT
 only allows async calls?

 I have a series of panels that user must respond to in sequence and
 their answers may lead to a different path of panels (warnings, error
 panels, etc..)  I think every GWT programmer working on a large
 project must have run into this.   I'm interested in what strategies/
 techniques/code you used to help keep the complexity down.


 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
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
-~--~~~~--~~--~--~---



Re: Sequential workflow in an asynchronous GWT world

2009-03-04 Thread hazy1

Making an async call appear to be sequential is easy, just block or
fade out or have a pop up progress bar until the async operation
completes.

On Mar 4, 10:15 pm, rlaferla robertlafe...@comcast.net wrote:
 How is everyone managing to implement sequential workflows when GWT
 only allows async calls?

 I have a series of panels that user must respond to in sequence and
 their answers may lead to a different path of panels (warnings, error
 panels, etc..)  I think every GWT programmer working on a large
 project must have run into this.   I'm interested in what strategies/
 techniques/code you used to help keep the complexity down.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
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
-~--~~~~--~~--~--~---