Re: EventBus mechanism
Seems that the onAddButtonClicked and onItemClicked methods perform some actions that involve other Presenters/Views that listen to those kinds of events. deleteSelectedContacts is just performing local changes that don´t affect other views. If there would be a different view that is showing a (for example) contact count and this view needs to know about some changes in your contacts, you would fire an event in deleteSelectedContacts.
Am Dienstag, 1. Mai 2012 15:01:20 UTC+2 schrieb Adio:
Hi everyone, now that i am working with GWT i am facing a problem with--
the event handling mechanism the first problem was (
http://groups.google.com/group/google-web-toolkit/ browse_thread/thread/ 17b679b499311756/ 8f06531e30bf0996# 8f06531e30bf0996
), but when i read this article MVP II (
https://developers.google.com/web-toolkit/articles/mvp- architecture-2
) - actually i read it several times - i still don't understand when u
to use EventBus mechanism and when not ? and if i have to use when u
use EventBus Handler and HandlerManage ?.
Here is what confuses me:
public class ContactsPresenter implements Presenter,
ContactsView.Presenter<ContactDetails> {
......
public void onAddButtonClicked() {
eventBus.fireEvent(new AddContactEvent());
}
public void onDeleteButtonClicked() {
deleteSelectedContacts();
}
public void onItemClicked(ContactDetails contactDetails) {
eventBus.fireEvent(new EditContactEvent(contactDetails.getId()));
}
....
}
Why one method fires and event and the other just do some logic witch
is defined the class ?
Thank you all for your replies.
the source code of the example is here :
http://google-web-toolkit.googlecode.com/files/Tutorial- Contacts2.zip
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/-4L9VQklj1QJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home