Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gwt ProgressMessageBox未更新_Gwt_Gxt - Fatal编程技术网

Gwt ProgressMessageBox未更新

Gwt ProgressMessageBox未更新,gwt,gxt,Gwt,Gxt,在GXT(来自Sencha)中,我试图使用ProgressMessageBox向用户显示工作正在完成,但直到所有工作完成后,我才看到消息框。代码如下: final ProgressMessageBox messageBox=new ProgressMessageBox(“任务描述”, “执行任务…”); setProgressText(“正在计算…”); messageBox.setPredefinedButtons(); messageBox.show(); 对于(int i=0;i

在GXT(来自Sencha)中,我试图使用ProgressMessageBox向用户显示工作正在完成,但直到所有工作完成后,我才看到消息框。代码如下:

final ProgressMessageBox messageBox=new ProgressMessageBox(“任务描述”,
“执行任务…”);
setProgressText(“正在计算…”);
messageBox.setPredefinedButtons();
messageBox.show();
对于(int i=0;i<5;++i){
用于(长l=0l;l<1000000000L;++l){
如果(l==12345l){
MyUtil.info(60,“+System.currentTimeMillis()/1000);
}
}
updateProgress((双精度)(i+1)/5,“{0}%完成”);
}
此代码位于菜单项的
SelectionHandler
中。显然,我实际上并不是在“真实”代码中循环数十亿次,而是当我执行我想要执行的工作时,我得到了相同的结果。。。所有工作完成后,将显示消息框。我看到了“info”消息(
MyUtil#info
只是GXT
info
功能的包装,它会导致在指定的秒数内显示一条info消息)。。。在我的机器上,运行显示的代码,每条消息的值都比前一条消息大7秒左右(但它们都与消息框同时显示)


调用
ProgressMessageBox#updateProgress
强制刷新屏幕或消息框后,我需要做些什么吗?

我可以通过将任务放入
调度程序#execute
方法来实现这一点。Sencha Explorer演示中的示例使用了
计时器
,但由于我不知道执行需要多长时间,所以我选择使用
调度程序
方法。以下是相关的最终代码:

。。。
menuItem.addSelectionHandler(新的SelectionHandler(){
@凌驾
选择时公共无效(最终选择事件选择事件){
final ProgressMessageBox messageBox=新的ProgressMessageBox(“调整所有列的大小”//
“调整列大小…”);
setProgressText(“正在计算…”);
//messageBox.setPredefinedButtons();
messageBox.show();
resizeNextColumn(messageBox,
_复选框selectionModel?1的selectionModel实例:0,
_grid.getColumnModel().getColumnCount()-1);
}
});
...
private void resizeNextColumn(最终进度messageBox messageBox,
最终int列索引,
最终整数(索引){
Scheduler.get().ScheduledDeferred(新的ScheduledCommand(){
@凌驾
public void execute(){
ResizeColumntOffit(columnIndex);
if(columnIndex==lastColumnIndex){
messageBox.hide();
_grid.getView().refresh(true);
返回;
}
messageBox.updateProgress((双)columnIndex/(lastColumnIndex+1),
“{0}%完成”);
resizeNextColumn(messageBox,columnIndex+1,lastColumnIndex);
}
});
}

一件似乎不起作用的事情是
messageBox.setPredefinedButtons()
调用。。。当我使用它时,消息框中的进度条根本不会更新。我真的不希望对话框上有一个“OK”按钮,但现在它必须这样做。我正在使用GXT的3.1.0。

不,我们不需要任何刷新,请按照此处的进度条示例进行操作。这会有帮助的谢谢Vivek。。。我在GXT浏览器演示中查看了这个示例,这是一个有用的指南。也许我需要使用计时器来控制我的处理,或者可能使用GWT
调度程序
类一次执行一个请求?我会尝试一下,并在这里添加一条评论。