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

来源:互联网 发布:网络公司简介怎么写 编辑:程序博客网 时间:2024/06/05 01:17

金蝶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();}


原创粉丝点击