viernes, 21 de marzo de 2008

Netbeans PLatform: (Progress API) Basic usage

Overview (Progress API): "Use Cases
Basic usage

There are 3 types of progress indication:

* 1. indefinite when it's not known how much time will be needed to complete
* 2. definite with time estimate for completion (UI shows time that remains)
* 3. definite without time estimate where the UI shows percentage completed.

The default location of the progress indication is the status bar which aggregates all tasks running in the IDE that show progress. However it's possible to exclude the task from the default location and show the progress in one's custom dialog component. In such a case the same task should not appear in the status line component as well.

It's possible to request cancelling the task from status line progress aggregator if the task allows cancelling.

Progress tasks that get started as a result of explicit user action takes precedence in the status line docked component over tasks that are triggered by the system. (say filesystem refresh for example)

The most common usecase of the API looks like this:

ProgressHandle handle = ProgressHandleFactory.creatHandle('My custom task');
// we have 100 workunits
// at this point the task appears in status bar.
handle.progress('half way through', 50);
// at this point the task is finished and removed from status bar
// it's not realy necess"
Publicar un comentario