MVP For Popups

99 views
Skip to first unread message

Tim Hill

unread,
May 10, 2013, 6:58:50 PM5/10/13
to google-we...@googlegroups.com
Hi,

I would appreciate some advice, if anyone has any time to spare... I am slowly, but surely, getting to grips with GWT (I think) and I have hit my next stumbling block. The scenario is as follows:
> The app loads to the calendar view
> User clicks on a date and the 'add new event' dialog/popup is shown
> User enters event info, along with address of the event. If the address does not already exist within the app, the user can click a button to extend the popup to enter a new address
> User clicks save.
> Events fired to save new data.

My quandary is thus... I am attempting to implement my app using MVP (activities/presenters/places/views etc), but I am not sure how best to implement popups like I described above as there is more logic in there than a simple 'busy' popup, for example. My aim is to have as much of the app logic as possible separate from the UI implementation so I can easily port the app to a mobile interface. 

Thanks in advance!

Tim

Oliver Krylow

unread,
May 11, 2013, 4:14:50 PM5/11/13
to google-we...@googlegroups.com

Hi!

Implement your popups in the views and have callbacks as arguments for your presenters to provide logic when necessary .

Example :

view.showNewEventDialog(data,new NewEventCallback(){

@Override
public void onSave(String data){
....

}

@Override
public void onExtends (){
...
}

});

--
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-tool...@googlegroups.com.
To post to this group, send email to google-we...@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.
 
 
Message has been deleted

Tim Hill

unread,
May 20, 2013, 8:15:22 AM5/20/13
to google-we...@googlegroups.com
Thanks Oliver, that has got me on the right track :)

Next question... When I click on the save address button (for example), the callback registers that the save button for address has been clicked and runs the required method in the callback. This then calls an async method in another class to save the address to a local SQLite instance. What would be the best way to pass back the success/failure of the database operation? Would it be on the eventbus, or is there a more preferred way?

Sorry for the noddy questions, but still learning!

Cheers

Tim

David

unread,
May 21, 2013, 8:56:19 AM5/21/13
to google-we...@googlegroups.com

Typically you would have a Presenter that  initializes your view ( the static dom) , loads your view with data from an  async server invocation , and receives requests from the view for more data .   Have a look at https://developers.google.com/web-toolkit/articles/mvp-architecture-2.

Apart from dispatching url place requests via browser History, I personally hold off from using the event bus until  I have a situation where multiple views may be interested in a single event or a given view is reused by many use cases with different presenters.            The EventBus also is handy for managing a model cache (broadcasting model changes to interested views).

Here's a recent video from last weeks Google IO :https://www.youtube.com/watch?v=kilmaSRq49g   .  The EventBus is covered about halfway in.

David
Reply all
Reply to author
Forward
0 new messages