我正在调用数据库。结果必须用于子表单。所以我想等到数据库的结果出来。为此,我需要同步。我的想法是使用 java.lang 中的 Object.notifyAll(),但 GWT 不支持这一点。对于 notifyAll(),GWT 中是否有任何等效的方法?
edit1:我正在使用 gxt FormPanel 提交数据。我可以更改 buttonBar 的类型,但我认为 addSubmitCompleteHandler 不会解决我的问题。
这里有一些代码片段:
final Button submit = new Button("Submit");
submit.addListener(Events.OnClick, new Listener<ButtonEvent>() {
@Override
public void handleEvent(ButtonEvent be) {
// 1. Get the data from Database (here i must wait for the response from DB)
// 2. Submit the form
}
);
final FormPanel buttonBar = new FormPanel();
buttonBar.addStyleName("abUploadField");
buttonBar.setHeaderVisible(false);
buttonBar.setBorders(false);
buttonBar.setStyleAttribute("margin", "0px");
buttonBar.setEncoding(FormPanel.Encoding.MULTIPART);
buttonBar.setMethod(FormPanel.Method.POST);
buttonBar.add(file);
buttonBar.add(submit);
buttonBar.setAction("myURL");
edit2:我想从数据库中获取序列 ID(这是事件处理程序中的第一步)。此 ID 将用于提交。在提交时,我正在用数据填充数据库中的一些表格。该 ID 将用于识别哪个用户启动了提交,对于这个用户,我想显示带有“提交成功”消息的对话框。我希望,你明白我的意思:)(对不起,我的英语不好)