您的位置:首页 > 其它

金蝶EAS·BOS,客户端操作添加进度栏,进度条

2017-06-01 15:31 363 查看
金蝶EAS客户端中,数据导入等操作,需要等待较长时间时,添加进度栏相关代码。

仅供参考。

/**
* 引入模板
* 将科目余额数据从电子表格中读取到序时簿
*/
public void actionExcelImport_actionPerformed(ActionEvent e) throws Exception {

JFileChooser chooser = new JFileChooser();
chooser.showOpenDialog(this); //文件选择窗口
if(chooser.getSelectedFile() == null){
return;
}
String fileName = chooser.getSelectedFile().getName(); //获取文件名
if(!(fileName.indexOf(".xls") == (fileName.length() - 4) || fileName.indexOf(".XLS") == (fileName.length() - 4))){
MsgBox.showWarning(this, "选取的数据文件应为.xls格式。");
return;
}
comp = this; //用于指定父窗口
filePath = chooser.getSelectedFile().getPath(); //文件路径
LongTimeDialog dialog = new LongTimeDialog((Frame) SwingUtilities.getWindowAncestor(this)); //进度栏
dialog.setLongTimeTask(new ILongTimeTask() {

public void afterExec(Object obj) throws Exception {}
public Object exec() throws Exception {

long start = System.currentTimeMillis(); //开始计时
dataList = AccountBalanceUtil.parseExcel(filePath, 3, 9); //解析电子表格
initMappingData(); //初始化映射基础数据缓存
verifyDataList(dataList); //数据队列校验
verifyArticlan(dataList); //勾稽关系校验
fillData(dataList); //填充数据到序时簿表格
long end = System.currentTimeMillis(); //结束计时
String msg = "成功引入模板!共" + dataList.size() + "行数据,耗时" + (end - start) / 1000 + "秒。";
MsgBox.showInfo(comp, msg);

return null;

}

});
dialog.setTitle("正在引入模板,请稍等......");
dialog.show();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: