@Override public void execute() { progressMultiplier = Fraction.getFraction(1, tasks.size()); while (!tasks.isEmpty()) { currentTask = tasks.poll(); setValues( currentTask.getMessage(), baseProgress.getNumerator(), baseProgress.getDenominator()); currentTask.addPCGenTaskListener(this); currentTask.execute(); currentTask.removePCGenTaskListener(this); baseProgress = baseProgress.add(progressMultiplier); } }
@Override public void progressChanged(PCGenTaskEvent event) { if (currentTask.getMaximum() == 0) { return; } Fraction progress = Fraction.getFraction(currentTask.getProgress(), currentTask.getMaximum()); progress = progress.multiplyBy(progressMultiplier); progress = baseProgress.add(progress); setValues(currentTask.getMessage(), progress.getNumerator(), progress.getDenominator()); }