* A progression event.
*
* @param progress
- * the {@link Progress} object that generated it
+ * the {@link Progress} object that generated it, not
+ * necessarily the same as the one where the listener was
+ * attached (it could be a child {@link Progress} of this
+ * {@link Progress}).
* @param name
* the first non-null name of the {@link Progress} step that
* generated this event
/**
* Add a {@link ProgressListener} that will trigger on progress changes.
+ * <p>
+ * Note: the {@link Progress} that will be reported will be the active
+ * progress, not necessarily the same as the current one (it could be a
+ * child {@link Progress} of this {@link Progress}).
*
* @param l
* the listener
// Note: this is quite inefficient, especially with many children
// TODO: improve it?
progress.addProgressListener(new ProgressListener() {
- public void progress(Progress progress, String name) {
+ public void progress(Progress pg, String name) {
double total = ((double) localProgress) / (max - min);
for (Entry<Progress, Double> entry : children.entrySet()) {
total += (entry.getValue() / (max - min))
name = Progress.this.name;
}
- setTotalProgress(progress, name,
+ setTotalProgress(pg, name,
(int) Math.round(total * (max - min)));
}
});