I am new to this GWT MVP pattern even though I've been doing GWT for a
while.

Let me explain the problem I have. There is view in my application
which is a list of words and the info within them.
It's pretty much like the home page of UrbanDictionary. There are a
list of words, and each word has much more info and UI components than
ContactsView in Contacts example on Google's MVP tutorial page. My
question is if we should not let View know about the data model, then
how I can pass those info to this view and also I want to user to
navigate to another view when they click word's title, and they can
rate each word when they click thumb up or down.

So right now I have a DailyWordsView and DailyWordsPresenter. In this
view, there should be couple items and each of them represents one
word of a day.  Now there are two things I can do after I retrieve a
list of word infos from server (List<DefinitionInfo>).

1, I can create a view for each DefinitionInfo and add it to
DailyWordsView. So simply DailyWordsView is a vertical panel and
couple WordOfDayViews reside in it.
Two problems if I do this. One, there is no action I need from
DailyWordsView, because all interactions I need are within each
WordOfDayView. Two, when I pass a DefinitionInfo to a WordOfDayView,
it doesn't attach to the view-does-not-know-data-model rule anymore.
It's more coupled this way.

2, I can only have one view which is DailyWordsView, and awkwardly
pass a list of lists of info,
it could look something like:
 void setData(ArrayList<Date> dates, ArrayList<String> titles,
                                ArrayList<String> definers, ArrayList<String> 
contents,
                                ArrayList<String> examples, ArrayList<Integer> 
rateUps,
                                ArrayList<Integer> rateDowns);
and then create each item, but not new views, and add them to
DailyWordsView. Now it becomes hard for me to keep track on which item
is reacting to user's action. So I must have
int getClickedRateUpId(ClickEvent event);
int getClickedRateDownId(ClickEvent event);
int getClickedTitleId(ClickEvent event);
in my Display interface in DailyWordsView,
and also keep the list of DefinitionInfo for the moment I fire an
event.
This is more decoupled but very awkward.

I am looking for some suggestion to get my out of this bog.
Thank you very much.

-- 
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-tool...@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