进度状态报告模式

进度状态报告模式

本文介绍了进度状态报告模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行需要显示进程栏(或进度百分比)的长时间运行的进程。长时间运行的过程的整体逻辑是复杂的(各种分页数据检索),因此,我最终在代码中的各个地方硬编码了很多百分比。



在更新完成百分比时,被认为是最佳设计模式?

解决方案

我发现使用的模式在JFace周围很好地工作。你可以通过看课程来获得一些洞察力。要查看的其他课程是和。您还可以找到的一些帮助。 p>

I am implementing long running processes that require to a process bar - or progress percentage - to be displayed. The overall logic of the long running process is complex (various paged data retrieval), and as a result, I end up hardcoding lots of percentages in various places within the code.

What are considered as the best design patterns when it comes to update a completion percentage?

解决方案

I've found the pattern used in JFace around IProgressMonitor to work out pretty nicely. You might gain some insight by having a look at the class. Additional classes to look at are ProgressMonitorDialog and IRunnableWithProgress. You may also find this article of some help.

这篇关于进度状态报告模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 03:34