my problem is about my GWT project. i got 2 files named Main.java(EntryPoint) and Registration.java(Composite) in my client package. Registration class is just user interface for registration.(it has text boxes and button)
There is a register button in Registration class which takes all information from registration form. My problem is here. how can i send this information from Registration class to EntryPoint class when user clicks button?
this is my onModuleLoad method;
....
Registration registration = new Registration();
dockLayoutPanel.add(registration);
....
Use Command Pattern, for example I also have an Interface
public interface SuperPuperHandler<T> {
public void onFire(T t);
}
and in your Registration class add save handler:
public class Registration extends Composite{
private SuperPuperHandler<MySavedObject> saveHandler;
public void addSaveHandler(SuperPuperHandler<MySavedObject> saveHandler){
this.saveHandler=saveHandler;
}
.....
savebutton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
if(saveHandler!=null){
saveHandler.onFire(mysavedObject);
}
}
});
}
So here is what to do in your EntryPoint
public class Main implements EntryPoint {
....
Registration registration =new Registration();
registration.addSaveHandler(new SuperPuperHandler<MySavedObject>(){
public void onFire(MySavedObject t){
// here is saved objects in registration form
}
});
}