On Friday, June 7, 2013 1:37:41 PM UTC+2, Sahli Sabrina wrote:
thank you for the reply here is the code--public class AddSoumissionEvent extends GwtEvent<AddSoumissionHandler>{
public static Type<AddSoumissionHandler>TYPE= new Type<AddSoumissionHandler>();
private Soumission soumission;
public AddSoumissionEvent(Soumission soumission) {
this.soumission=soumission;
}
public Soumission getSoumission() {
return soumission;
}
public void setSoumission(Soumission soumission) {
this.soumission = soumission;
}
@Override
protected void dispatch(AddSoumissionHandler handler) {
handler.onAddSoumissionHandler(this);
}
@Override
public com.google.gwt.event.shared.GwtEvent.Type< AddSoumissionHandler> getAssociatedType() {
// TODO Auto-generated method stub
return TYPE;
}
}
Le vendredi 7 juin 2013 13:21:27 UTC+2, Thomas Broyer a écrit :Can you show the code of the AddSoumissionEvent?
On Friday, June 7, 2013 1:10:17 PM UTC+2, Sahli Sabrina wrote:Hi everyBody,
I want to transfer an object from an activity to another one, for that i used the event bus:
1. i created an event "AddSoumissionEvent" and handler "AddSoumissionHandler"
2.intialise the eventbus of the first activity with the eventBus offered in the start Function
public void start(AcceptsOneWidget containerWidget, EventBus eventBus) {
this.eventBus=eventBus;
.......
}
3.i fire event in the first activitypublic void createSoumission(DynamicForm form) {
//create soumission
Soumission soumission=new Soumission();
//initialize values
................
//fire event
eventBus.fireEvent(new AddSoumissionEvent(soumission));
}
4. the second activity receive the event ,i created the handler in in start funtionpublic void start(AcceptsOneWidget container, EventBus eventBus) {
eventBus.addHandler(AddSoumissionEvent.TYPE, new AddSoumissionHandler(){
public void onAddSoumissionHandler(AddSoumissionEvent event) {
System.out.println(" event received youpiiii");
onAddSoum();
}
});
}
the problem is the second activity doesn't receive the event :( i can't see where is the mistake .
can anyone here tell me where is the mistake or give me a link for an example who shows how to use the eventBus with activities and places
Thank you,
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+unsubscribe@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.
No comments:
Post a Comment