I've having trouble understanding the best way to organize my object 
relationships and code flow with GWT.  I'm finding a few of the examples 
leave a lot to be desired and do a poor job illustrating proper usage of 
the API (for example why does this 
example<https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCellWidgets#async-data-provider>push
 data directly into the widget (via setRowData() instead of calling 
updateRowData() as prescribed above?).

I'm using an AsyncDataProvider to provide data to a CellTable.  I allow the 
user to sort data in the CellTable and use 
ColumnSortEvent.AsyncHandle<http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/cellview/client/ColumnSortEvent.AsyncHandler.html>r
 
to fire a RangeChangeEvent upon sorting.  In onRangeChange() I then have to 
retrieve the column sort information from the CellTable inside my view to 
send back to the server, thus tightly coupling the AsyncDataProvider with 
view/CellTable.  I would think this to be undesirable as I thought the 
point of a DataProvider was to provide an abstract way to inform different 
displays that a new range of data has been made available. Also, 
DataProviders don't seem to account for the the fact that if different 
displays are using a different sort method, then the range of data is no 
longer applicable to every display.  If I use a custom ColumnSortEvent 
handler, either in the view or the activity, I'm then circumventing the 
DataProvider which creates multiple points of data insertion into my 
widget, which seems unclean.  So I guess what I'm saying is I can't see the 
best approach.

Another concept I'm struggling with is the life of the DataProvider.  
Assume I resign myself to tightly coupling it with the view as I 
illustrated above, should I then instantiate it in my view and just have is 
live on for the life of the view (currently all my views are singletons)?  
Or should I instantiate it in the Activity and addDataDisplay() in start() 
and removeDataDisplay() in onStop()?  It seems the DataProvider sort of 
shares responsibilities with the Activity

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to