ojay schrieb:
> I have user editor and when somebody clicks the delete button I show a
> popup in which the user has to confirm that all the data should be
> deleted. Only if this will be confirmed with yes, the data will be
> deleted in the database. Now is my problem that I do not know how I
> can wait until the button was pressed.
One solution would be to use the confirm-method in Window, showing
the standard Javascript confirm popup which is modal and returns
the moment, the user confirms (or denies) the question:
if (Window.confirm(CONSTANTS.AreYouSure())){
letBadThingsHappen();
}
> I am using the MVP architecture
> like it was diskussed in a lot of threads here, so my presenter calls
> a getConfirmed Method in which the popup will be shown. But know I do
> not know how to wait to this click.
If you want to use a GWT Dialog-box you can solve that by
calling a callback-function:
MyPanel.java:
[...]
MyConfirmDialog mcd = new MyConfirmDialog(this);
mcd.center();
public void onUserConfirmed(boolean clickedYes){
if (clickedYes){
letVeryBadThingsHappen();
}
}
MyConfirmDialog.java
public MyConfirmDialog(MyPanel parent){
super(false, true);
this.parent = parent;
}
...
yesButton.addClickLister(...
public void onClick(final Widget sender){
hide();
parent.onUserConfirmed(true);
}
);
noButton.addClickListener(...
public void onClick(final Widget sender){
hide();
parent.onUserConfirmed(false);
}
}
> Does somebody has a solution for this?
Above should give you an idea.
Regards, Lothar
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.